Question 8.9: You want to send and receive serial commands from a Terminal......

You want to send and receive serial commands from a Terminal session.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

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.

8,4

Related Answered Questions

Question: 8.16

Verified Answer:

The PiFace Digital (“Modules” on page 381) is an e...
Question: 8.15

Verified Answer:

Use a boost regulator module (Figure 8-10). The mo...
Question: 8.14

Verified Answer:

A typical project using a Raspberry Pi requires 5V...
Question: 8.11

Verified Answer:

Use a Pi Cobbler, a device consisting of a small p...
Question: 8.21

Verified Answer:

You can use the paddle terminal breakout board sho...
Question: 8.20

Verified Answer:

The Pi Plate (Figure 8-16) is a prototyping board ...
Question: 8.19

Verified Answer:

The Humble Pi (Figure 8-15) is a prototyping board...
Question: 8.17

Verified Answer:

Figure 8-13 shows a Gertboard attached to a Raspbe...
Question: 8.18

Verified Answer:

Figure 8-14 shows the RaspiRobot board (version 1)...