Setting Up UART Serial Communication between Raspberry Pis


This post shows how to setup serial communication between two Raspberry Pi boards.

Here is the list of contents of this post.

Contents

 

Prerequisites

 

Steps
1. Wiring
Connect jumper wires between two Raspberry Pi boards. Check this useful site for pinout (GND, Tx, and Rx).

Note: Rx pin on one Raspberry Pi should be connected to Tx pin on the other Raspberry Pi.

 

Note: Step 2 to Step 4 need to be done on both Raspberry Pis. 

2. Enabling UART
2-1. Open “/boot/config.txt”.

2-2. Add the lines below at the end of the file.

 

3. Disabling console service
3-1. Disable serial-getty service.

3-2. Open “/boot/cmdline.txt”.

3-3. Remove “console=serial0,115200”, then save the file.

3-4. Reboot.

 

4. Setting up terminal emulator
To send and receive data, I’ll use minicom, a text-based terminal emulator.

4-1. Install minicom.

4-2. Type below to launch minicom and connect to UART.

4-3. Press Ctrl-A then E to enable local echo. You should see “Local echo ON” message at the bottom of the screen.

4-4. Press Ctrl-A then A to enable linefeed. You should see “Add linefeed ON” message at the bottom of the screen.

 

5. Verify
5-1. Type something in minicom on one Raspberry Pi. You should be able to see the text on the other Raspberry Pi.

5-2. Type something back on the other Raspberry Pi.

 

Note: You can exit minicom by pressing Ctrl-A, and X, then select “Yes”.

 

 

Sponsor Link

Leave a Reply

Your email address will not be published. Required fields are marked *