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?
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?
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
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.
echo "Hi Arduino" > /dev/ttyACM0
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
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.