To use the Raspberry Pi 4’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 4 brought more speed and memory to the Pi platform, and its GPIO serial port remains one of the simplest ways to connect 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 4 Model B, and the Raspberry Pi 400, which is configured the same way, running current Raspberry Pi OS, the operating system installed by Raspberry Pi Imager. 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 4 (or Raspberry Pi 400)
- 1× USB-C 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?
Like the Raspberry Pi 3 before it, the Pi 4 connects its full-featured PL011 UART to the Bluetooth radio, leaving the mini UART for the GPIO header. 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 |
| PL011 (UART2 to UART5) | Assigned when enabled | Disabled, available via overlays |
Freeing the GPIO port 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.
Unlike the Pi 3, the Pi 4 also has four additional PL011 UARTs (UART2 through UART5) on other GPIO pins. They are disabled by default and can be enabled with device tree overlays; see the documentation linked below if your project needs several serial ports or a full-featured UART without giving up Bluetooth.
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 the UART2 to UART5 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, Packet Serial with the Raspberry Pi 3 and Standard Serial with the Raspberry Pi 3 walk through wiring a RoboClaw to the GPIO serial pins and controlling it from Python; the pins and the /dev/serial0 port name are the same on the Pi 4. 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. If you are configuring a different model, see Configuring the Raspberry Pi 3 Serial Port.



