7

I have an Arduino Uno connected via USB to a Raspberry Pi. The Raspberry Pi is accessible via SSH only.

Just started a bit with arduino-cli. I upload a sketch which reads my analog pins. How can I access the serial monitor to get the data?

2
  • I'm trying to upload a program for serial communication with 9600 Br with 1sec delay. but this error is avrdude: stk500_recv(): programmer is not responding what should I do?
    – user137442
    Commented Aug 16, 2021 at 8:17
  • @user137442, Welcome! Placing a question in the comments section under an existing one, will probably not get your question answered. Please consider asking a separate question once you've made sure your question has not been answered elsewhere on Arduino Stack Exchange.
    – StarCat
    Commented Aug 16, 2021 at 15:29

4 Answers 4

13

Programs such as screen, minicom or (my favorite) picocom are useful if you want bidirectional communication between the Arduino and the host computer. If you only want to read what the Arduino sends, that can be done with cat:

stty -F /dev/ttyACM0 raw 115200
cat /dev/ttyACM0
8

I use minicom.

$ sudo apt-get install minicom
... blah blah blah ...
$ minicom -D /dev/ttyACM0 -b 115200

Minicom can take a bit of getting used to. Use CTRL-A to initiate a command sequence. CTRL-A X is exit. CTRL-A O is configuration ("Options") where you can configure flow control and such.

Many people also use screen to do the same job, but I like the interface that minicom gives - it's more terminal-like.

5
  • thx! Forgot about that, I knew it and also screen. Obviously did a bad job at web search on the topic :P Commented Nov 3, 2020 at 22:31
  • And how do you send "Hi Arduino" to the Arduino board?
    – user171780
    Commented Jul 11, 2022 at 13:09
  • @user171780 With minicom? Just type it when connected. With screen? Just type it when connected. From the command line? echo "Hi Arduino" > /dev/ttyACM0
    – Majenko
    Commented Jul 11, 2022 at 14:34
  • If I type and hit enter, nothing happens. I only see whatever Arduino sent (after reset) but he is not listening to me (so no answer either).
    – user171780
    Commented Jul 12, 2022 at 10:49
  • @user171780 Unless you have programmed your Arduino to echo back what it receives you won't see anything. Without knowing what your code is I cannot help you.
    – Majenko
    Commented Jul 12, 2022 at 11:16
1

I also had the problem that arduino-cli includes no serial monitor. I tried out screen, minicom and other but they are a bit difficult to get used with them. So I created a small python script which works as an serial monitor in the command line: https://github.com/PBahner/Serial-Monitor

0

You can easily access the monitor with Arduino CLI:

arduino-cli monitor [flags]

For example, you can use this command for Arudino UNO:

arduino-cli monitor -p /dev/ttyACM0 -b arduino:avr:uno

Using this, you can get the values you read from the analog pins on the Arduino UNO via the serial monitor. You can view the Arduino CLI documentation about using the monitor here.

New contributor
Çınar Civan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • Note that this tool is very poorly documented. You can get out of it with Ctrl-C. Commented 2 days ago
  • I absolutely agree that the documentation is very poor, I think there is not enough explanation in the documentation. But it's still useful, isn't it? Commented yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.