GPIO and pin reference
Which GPIO pins (BCM) the MuPiHAT, power button, fan, LEDs, buttons and rotary encoder use, which are free and how they affect each other.
Many MuPiBox features depend on the Raspberry Pi's 40-pin GPIO header. This page lists which pins are used and what to watch out for when you connect your own buttons.
BCM number or pin number?
The admin interface always expects BCM numbers (the chip's GPIO number, e.g. "GPIO 17"), not the physical pin number on the header. GPIO 17, for example, is on physical pin 11. The table below gives both.
Used pins
| BCM | Pin | Used by | Note |
|---|---|---|---|
| 2 (SDA) | 3 | I²C – MuPiHAT charger chip | bus 1, address 0x6B, 50 kHz |
| 3 (SCL) | 5 | I²C – MuPiHAT charger chip | do not use for buttons when the MuPiHAT is active |
| 4 | 7 | MuPiHAT power cut (gpio-poweroff) | cuts the power after shutdown |
| 17 | 11 | MuPiHAT power button (gpio-shutdown) | kernel key KEY_POWER, see standby |
| 12 | 32 | Fan (default) | hardware PWM possible (PWM0) |
| 13 | 33 | Power LED (MuPiHAT+ J15, default) | hardware PWM possible (PWM1) |
| 16 | 36 | MuPiHAT amplifier MAX98357A SD_MODE | only with MuPiHAT audio |
| 18 | 12 | I²S BCLK (MuPiHAT audio) | only with MuPiHAT audio |
| 19 | 35 | I²S LRCLK (MuPiHAT audio) | only with MuPiHAT audio |
| 21 | 40 | I²S DATA (MuPiHAT audio) | only with MuPiHAT audio |
Without a MuPiHAT only the pins you enter yourself for fan, LED, buttons or rotary encoder are used.
Good free pins
For buttons and a rotary encoder with a MuPiHAT, BCM 5, 6, 22, 23, 24, 25, 26 and 27 work well (physical pins 29, 31, 15, 16, 18, 22, 37, 13). Avoid BCM 7–11 if you use SPI devices and BCM 14/15 if the serial console is active.
Displays, RFID and Bluetooth
- DSI displays carry picture over the DSI ribbon cable. Many do not require extra GPIO wiring. Exception: the Waveshare 8inch DSI LCD (C) (SKU 23448) additionally requires 5 V on pin 4, GND on pin 6, and SDA/SCL via BCM 2/3 (physical pins 3/5). The MuPiHAT uses the same I²C bus: check bus addresses and wiring before sharing it.
- HDMI displays with USB touch use no GPIOs either. Displays plugged onto the GPIO header (SPI displays) are not supported.
- RFID readers connect via USB or directly via PN532 UART (GPIO14/15) or PN532/RC522 SPI (GPIO7–11); see RFID and PN532 GPIO.
- Bluetooth and Wi-Fi are built in or connected via USB.
RFID: USB, UART, SPI and I²C
RFID readers can also use the GPIO header. As of 14 November 2026, a user successfully connected a PN532 using both FTDI USB-to-UART and direct GPIO UART, including successful card reads and correct pin-usage display. PN532 SPI and RC522 SPI are implemented but have not yet been verified with this hardware; PN532 I²C is not currently implemented as an NG reader transport.
| Reader / connection | BCM GPIO and physical pins | Status / note |
|---|---|---|
| USB HID or PN532 via FTDI USB-UART | No GPIO pins; USB port | PN532/FTDI verified in practice |
| PN532 via GPIO UART (HSU) | GPIO14 / pin 8 (Pi TX) → reader RX; GPIO15 / pin 10 (Pi RX) ← reader TX | Card reads verified; 115200 baud, disable the serial console on this port |
| PN532 via SPI0, CE0 | GPIO10/pin 19 MOSI, GPIO9/pin 21 MISO, GPIO11/pin 23 SCLK, GPIO8/pin 24 CE0 | Driver implemented; hardware test pending; CE1 alternative: GPIO7 / pin 26 |
| RC522 via SPI0 | Same SPI0 signals; separate chip select if using more than one SPI device | Driver implemented; hardware test pending |
| PN532 via I²C (wiring reference only) | GPIO2 / pin 3 SDA, GPIO3 / pin 5 SCL | Not supported as an RFID transport in NG; sharing the MuPiHAT I²C bus is theoretically possible but requires address, voltage and timing checks |
Power: use 3.3 V signal levels for the PN532/RC522 and Raspberry Pi GPIO (e.g. 3.3 V on pin 1, ground on pin 6). Disconnect power before rewiring. See Connecting a PN532 and RFID for wiring and Pi 4 / Pi 5 details.
The interactive pin map below is a planning aid, not live hardware detection. Multiple SPI devices require distinct chip-select lines. I²C sharing is possible with distinct addresses, but does not imply NG supports PN532 I²C.
config.txt and overlays
Hardware such as the MuPiHAT, the power button or the display is enabled at boot through entries in /boot/firmware/config.txt (older systems: /boot/config.txt). MuPiBox only writes inside its own marked block and never changes lines outside it. The MuPiHAT installer, for example, puts its lines below #--------MuPiHAT--------; they stay untouched.
The MuPiHAT base configuration is:
dtparam=i2c_arm=on
dtparam=i2c1=on
dtparam=i2c_arm_baudrate=50000
dtparam=gpio=on
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
MuPiHAT audio adds dtoverlay=max98357a,sdmode-pin=16 and dtoverlay=i2s-mmap. The admin interface detects contradicting entries and reports them as a conflict instead of overwriting them (MuPiHAT).
Power button without a MuPiHAT
Standby needs a button that the kernel reports as KEY_POWER. Without a MuPiHAT you set it up yourself in config.txt, for example on BCM 3:
dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
BCM 3 has one advantage: a press also wakes the Pi from the halted state (as long as it has power). But BCM 3 is also the I²C clock line. With a MuPiHAT never use BCM 3 for the button – the MuPiHAT brings its own button on BCM 17 anyway.
Pimoroni OnOff SHIM: Hardware → OnOff SHIM has the switch "Enable OnOff SHIM". It writes the two matching lines into a marked block of its own in config.txt (button on BCM 17, power cut on BCM 4). After a restart a press shuts the box down cleanly, then the SHIM cuts the power. Button sound, shutdown sound and standby are set as with a MuPiHAT under Box → Audio and Box → Display & power. With a MuPiHAT enabled the switch is locked – the MuPiHAT brings both itself.
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up
The Display & power page shows under "Power button diagnostics" which button the running kernel has actually loaded.
Interactions at a glance
| If … | then … |
|---|---|
| the MuPiHAT is active | BCM 2, 3, 4, 17 (and with audio 16, 18, 19, 21) are taken. |
| standby is enabled | MuPiBox reads the power button itself; the kernel no longer shuts down on a press. |
a power cut (gpio-poweroff) is loaded | the hardware switches off on a long press; MuPiBox's 3-second function is not offered. |
| fan and LED should use hardware PWM | dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4 is needed; otherwise MuPiBox switches them in software. |
| buttons sit on MuPiHAT pins | neither the buttons nor the MuPiHAT work reliably. |