Friday, January 2, 2015

Interacting With Arduino Serial Out From Linux Terminal

While testing a wireless transceiver module which is connected to an Arduino Uni board, I had to interact with the program running on the Arduino board. For that, the standard way available is the serial monitor in Arduino IDE. However I'm not happy with this serial monitor utility. I wanted to interact with it from my Linux terminal. After trying different options, finally the method I selected is 'CU' tool.

We can install it from the terminal using the following command.

sudo apt-get install cu

After plugging the Arduino Uno board into the computer through USB cable, it was shown as /dex/ttyACM1. Since my program in Arduino board communicate in serial with a baud rate of 57600, I can start interacting with the serial port through terminal using following command.

cu -l /dev/ttyACM1 -s 57600

The way to exit from this tool is a bit weird. We have to enter the following key combination on the terminal to exit from the tool.


I hope this tool will be useful to me in the future works which involves serial communication with Arduino boards.

Note (2015-07-09):
In case we need to log this output into a file while the output is displaying on the screen, we can use the following command.
cu -l /dev/ttyACM0 -s 9600 2>&1 | tee mylog.txt

No comments:

Post a Comment