You want to send and receive serial commands from a Terminal session.
Install Minicom:
$ sudo apt-get install minicom |
Before you can use Minicom for serial communication on your own projects, you need to disable the Raspberry Pi’s serial console by following Recipe 8.7.
Once Minicom is installed, you can start a serial communications session with a serial device connected to the RXD and TXD pins of the GPIO connector using this command:
$ minicom -b 9600 -o -D /dev/ttyAMA0 |
The parameter after -b is the baud rate, and after -D the serial port. Remember to use the same baud rate as set on the device you are communicating with.
This will start a Minicom session. One of the first things you want to do is turn on local echo so you can see the command that you are typing. To do this, press Ctrl-A and then Z; you’ll see the menu shown in Figure 8-4. Press E to turn on local echo.
Now anything you type will be sent to the serial device, and all messages coming from the device will also be displayed.
Discussion
Minicom is a great tool for checking out the messages coming from a serial device or making sure that it’s working. Having established that you will probably want to write a Python program to handle the serial communications, you will need the Python serial library (Recipe 8.8).
See Also
Check out the Minicom documentation. For an example of using Minicom, see Recipe 13.3.