Raspberry PI 3 B+ How to Enable & Test UART Tx/Rx
Saravanan AL Saravanan AL
48.4K subscribers
547 views
21

 Published On Sep 5, 2024

This video explains how to enable UART on RPI 3 B+ for a serial communication.
On a Raspberry Pi 3, you should use /dev/ttyS0 for UART communication.
/dev/ttyS0: This is typically the UART serial port available for general use.

Disable LOGIN SHELL to be accessible over serial
Serial port hardware only to be enabled
serial login shell disabled
Serial interface is enabled
REBOOT required for changes to take effect
On the Raspberry Pi, the serial port /dev/serial0 is a symlink that points to the actual UART device, which can be either /dev/ttyAMA0 (the primary UART) or /dev/ttyS0 (the secondary UART).

ls -l /dev/serial0

This will show you whether /dev/serial0 points to ttyAMA0 or ttyS0.
in code you can use the symlink serial0 instead of ttyS0

Before executing a python script
prefer using a virtual environment, first create and activate it:

python3 -m venv myenv
source myenv/bin/activate

Then install pyserial within the virtual environment:

pip install pyserial

show more

Share/Embed