Accessing the Linux Console on a Raspberry Pi via Serial
A Raspberry Pi is a full-fledged Linux computer. Most of the time, you interact with it over a network using SSH or by connecting a monitor and keyboard. But what happens when the network is down, or you're setting it up for the first time and don't know its IP address?
~6 minutes

A Raspberry Pi is a full-fledged Linux computer. Most of the time, you interact with it over a network using SSH or by connecting a monitor and keyboard. But what happens when the network is down, or you're setting it up for the first time and don't know its IP address?
The answer is the serial console. It's a powerful, low-level way to get a full command-line login prompt, giving you complete control over the Pi, no networking or display required.
Why Use the Serial Console?
- Headless Setup: It's the easiest way to configure Wi-Fi on a new Raspberry Pi without ever connecting it to a monitor.
- Network Troubleshooting: If your Pi loses its network connection, you can log in via serial to fix misconfigured network files or restart services.
- Kernel Debugging: When the Pi's operating system (Linux) is booting, it prints all its startup messages (known as
dmesg) to the serial port. This is invaluable for diagnosing boot problems. - Guaranteed Access: It's the connection that works when nothing else does.
The Hardware You'll Need
You can't just plug a standard USB cable into the Pi's USB ports. You need to connect directly to its GPIO pins. This requires a special cable called a USB-to-TTL Serial Adapter or "Console Cable". These are inexpensive and widely available. They typically have four wires:
- Red: 5V Power (Usually not connected)
- Black: Ground (GND)
- White: RX (Receives data from the Pi's TX pin)
- Green: TX (Transmits data to the Pi's RX pin)
Step 1: Connecting the Wires
First, unplug all power from your Raspberry Pi. Never connect or disconnect GPIO wires while the Pi is on.
You need to connect three wires from your USB-to-TTL adapter to the Pi's GPIO header.
| Adapter Wire | Pi GPIO Pin | Pi Pin Number |
|---|---|---|
| Black (GND) | Ground | Pin 6 |
| White (RX) | GPIO 14 (TXD) | Pin 8 |
| Green (TX) | GPIO 15 (RXD) | Pin 10 |
Important: The connection is crossed over: RX on the adapter goes to TX on the Pi, and TX on the adapter goes to RX on the Pi. Think of it as a conversation: your 'mouth' (TX) talks to their 'ear' (RX). Do not connect the red (5V) wire, as the Pi will be powered separately.
Step 2: Enabling the Serial Console
On modern versions of Raspberry Pi OS, you need to enable the serial console. The easiest way is to do it before you boot the Pi for the first time.
- Flash Raspberry Pi OS to your microSD card.
- Before ejecting the card, find the file named
config.txtin the "boot" partition. - Open
config.txtin a text editor and add this line to the very end:enable_uart=1 - Save the file and safely eject the card.
Step 3: Connecting with a Serial Terminal
- Insert the microSD card into your Pi.
- Plug the USB end of your console cable into your computer.
- Power up your Raspberry Pi.
- Open a serial terminal application like serialterminal.app.
- In the connection settings, choose the correct serial port that your adapter created.
- Set the baud rate to 115200. This is the standard speed for the Raspberry Pi console.
- Click "Connect".
You should immediately see the Linux boot messages scrolling by. Once the boot process is complete, you'll be presented with a login prompt. You can now log in with your username and password (pi and raspberry by default on older systems) and have full command-line control over your Pi.