To use the Raspberry Pi 3’s serial port, free it from the Linux serial console. Run sudo raspi-config, open Interface Options, select Serial Port, answer No to the login shell question and Yes to the serial port hardware question, then reboot. The freed port appears at /dev/serial0 on GPIO pins 14 and 15.
The Raspberry Pi is a powerful single board computer, and its GPIO serial port is one of the simplest ways to connect it to external hardware: motor controllers, GPS receivers, microcontrollers, and other serial devices. Out of the box, however, the port is not usable: the Pi’s best hardware UART is assigned to the onboard Bluetooth radio, and Raspberry Pi OS attaches a Linux login console to the one that remains.
This application note covers the Raspberry Pi 3 family (Model B, Model B+, and Model A+) running current Raspberry Pi OS, the operating system installed by Raspberry Pi Imager. The configuration details differ on other Raspberry Pi models. Once the port is freed it can drive any 3.3V serial device, including RoboClaw motor controllers in packet serial or standard serial mode.
What You Need
- 1× Raspberry Pi 3 (Model B, B+, or A+)
- 1× USB power supply for the Raspberry Pi
- 1× MicroSD card with current Raspberry Pi OS installed
- 1× Monitor, keyboard, and mouse, or an SSH connection to the Pi
Why Does the Serial Port Need to Be Configured?
The Raspberry Pi 3 has two hardware UARTs, but neither is ready for external hardware by default. The full-featured PL011 UART is connected to the onboard Bluetooth radio, so the UART available on the GPIO header is the mini UART. The mini UART is disabled out of the box, and Raspberry Pi OS is configured to attach a login console to whichever UART sits on the GPIO pins.
| UART | Linux device | Default assignment |
|---|---|---|
| PL011 (UART0) | /dev/ttyAMA0 |
Bluetooth radio |
| Mini UART (UART1) | /dev/ttyS0 |
GPIO 14 and 15, disabled by default |
Freeing the port therefore takes two changes: enable the mini UART and remove the serial console from it. Enabling the UART also locks the Pi’s core clock so the mini UART’s baud rate stays stable; Raspberry Pi OS handles this automatically. The mini UART is reliable at typical serial baud rates such as 38400 and 115200, so there is no need to give up Bluetooth to get the PL011 back.
How Do You Enable the Serial Port with raspi-config?
The raspi-config tool makes all of the required changes in one place. This is the recommended method on current Raspberry Pi OS and works on both the desktop and Lite versions of the operating system.
- Open a terminal window on the Pi’s desktop, or connect to the Pi over SSH.
- Start the configuration tool:
sudo raspi-config - Select Interface Options.
- Select Serial Port.
- When asked if you would like a login shell to be accessible over serial, select No. This removes the Linux console from the port.
- When asked if you would like the serial port hardware to be enabled, select Yes. This enables the mini UART.
- Select Finish, then reboot the Pi so the changes take effect:
sudo reboot
How Do You Configure the Serial Port Manually?
The same configuration can be made by editing two files. This is useful for headless setups: both files live on the SD card’s boot partition, so they can be edited from another computer before the Pi ever boots. On current Raspberry Pi OS the files are found under /boot/firmware/; on Raspberry Pi OS Bullseye and earlier they were located at /boot/config.txt and /boot/cmdline.txt.
- Open the boot configuration file:
sudo nano /boot/firmware/config.txt - Scroll to the bottom of the file and add the following line, then press Ctrl+X, Y, and Enter to save:
enable_uart=1 - Open the kernel command line file:
sudo nano /boot/firmware/cmdline.txt - Delete the following portion of the single line in the file, leaving the rest of the line intact, then save:
console=serial0,115200 - Reboot the Raspberry Pi.
Everything in cmdline.txt must remain on a single line. If the console entry is not present, there is nothing to remove; raspi-config may have already made the change. The official Raspberry Pi UART configuration documentation covers additional options such as device tree overlays.
How Do You Verify the Serial Port Is Working?
After the reboot the mini UART is available on GPIO 14 (transmit, physical pin 8) and GPIO 15 (receive, physical pin 10). Raspberry Pi OS also creates /dev/serial0, an alias that always points at the UART assigned to the GPIO header. Confirm it with:
ls -l /dev/serial0
The output should show serial0 pointing at ttyS0:
lrwxrwxrwx 1 root root 5 Jul 23 12:00 /dev/serial0 -> ttyS0
Use /dev/serial0 as the port name in Python or other code; it continues to work even if a future configuration changes which UART the GPIO header uses.
The Raspberry Pi’s GPIO pins, including the serial port pins, are 3.3V only. Devices with 3.3V logic connect directly; RoboClaw motor controllers, for example, output 3.3V logic and tolerate up to 5V on their inputs, so no level shifter is needed. Never connect 5V logic or an RS-232 port directly to the Pi’s GPIO pins; doing so will damage the Pi.
Next Steps
If you are using the serial port to drive a motor controller, continue with Packet Serial with the Raspberry Pi 3 or Standard Serial with the Raspberry Pi 3, depending on the control mode you plan to use. To run several controllers from one Pi, see Packet Serial Bus Operation with the Raspberry Pi 3 and Standard Serial Bus with the Raspberry Pi 3.



