Enable the bus
sudo raspi-config
# 3 Interface Options → I4 SPI | I5 I2C | I7 1-Wire | I6 Serial Port
Or use Preferences > Control Centre > Interfaces on the desktop. Settings end up in /boot/firmware/config.txt, which the firmware reads before Linux starts; changes need a reboot. Check active values with vcgencmd get_config <name>.
Quick checks after reboot:
ls /dev/i2c-* /dev/spidev* # buses present?
sudo apt install i2c-tools && i2cdetect -y 1 # scan I2C bus 1 for sensor addresses
ls -l /dev/serial0 /dev/serial1 # primary / secondary UART links
UART: two switches, not one
The serial option has two separate settings:
- Serial port hardware: enables the TX/RX pins.
- Serial console: kernel messages and a login shell over that UART.
To talk to a GPS module, microcontroller or RS-485 adapter, enable the hardware and disable the console. In raspi-config answer No to "login shell over serial", then Yes to "serial port hardware". Otherwise the Pi's boot messages and getty collide with your device's data.
UARTs are 3.3 V only. Use a level shifter or a USB-to-3.3 V adapter for 5 V devices.
Which UART is where
- On most models the primary UART (
/dev/serial0) is on GPIO 14 (TX, pin 8) and GPIO 15 (RX, pin 10). - On Raspberry Pi 5 the primary UART is the three-pin debug header labelled UART (
/dev/ttyAMA10). The UARTs on the 40-pin header are PL011s that are disabled by default and have to be enabled explicitly (see the interfaces documentation for the overlays). - On models with built-in wireless, the secondary UART is wired internally to Bluetooth.
Need the good UART on Pi 3/4/Zero W? Move or disable Bluetooth
On these models the full PL011 UART serves Bluetooth and the GPIO header gets the mini UART, which loses characters more easily at high baud rates and depends on the core clock. Two documented options in /boot/firmware/config.txt:
# A) No Bluetooth, PL011 on GPIO 14/15
dtoverlay=disable-bt
# then: sudo systemctl disable hciuart
# B) Keep Bluetooth on the mini UART (fix the core clock first)
core_freq=250
dtoverlay=miniuart-bt
Option B can reduce the usable Bluetooth baud rate. If the Pi also reads BLE sensors, prefer option B or use a USB serial adapter for the device instead.