board dev studio

Verified 2026-10

pimoroni RP2040 Build HAT

Raspberry Pi Build HAT: a 40-pin-header HAT with an onboard RP2040 that drives up to four LEGO Technic motors and sensors over LPF2 ports, fed by a 2.1 mm centre-positive barrel jack at 8 V plus or minus 10 per cent which also powers the Pi - $28.00 USD as measured at Pimoroni.

Place this board on a carrier in the editor →

Logic level3.3 V

Part & documents

Headline partRP2040
Data sheetRP2040 data sheet →
Sourceshop.pimoroni.com/products/raspberry-pi-build-hat →

Specs

MCURaspberry Pi RP2040

Pinout

40 pads, as the vendor numbers them.

#NameFunctionSignals
13V33V3
25V5V
3GPIO 2 (I2C1 SDA)GPIO 2 (I2C1 SDA)
45V5V
5GPIO 3 (I2C1 SCL)GPIO 3 (I2C1 SCL)
6GNDGND
7GPIO 4 (Reset)GPIO 4 (Reset)
8GPIO 14 (UART0 TX)GPIO 14 (UART0 TX)
9GNDGND
10GPIO 15 (UART0 RX)GPIO 15 (UART0 RX)
11GPIO 17 (CTS)GPIO 17 (CTS)
12GPIO 18 (PCM CLK)GPIO 18 (PCM CLK)
13GPIO 27GPIO 27
14GNDGND
15GPIO 22GPIO 22
16GPIO 23GPIO 23
173V33V3
18GPIO 24GPIO 24
19GPIO 10 (SPI0 MOSI)GPIO 10 (SPI0 MOSI)
20GNDGND
21GPIO 9 (SPI0 MISO)GPIO 9 (SPI0 MISO)
22GPIO 25GPIO 25
23GPIO 11 (SPI0 SCLK)GPIO 11 (SPI0 SCLK)
24GPIO 8 (SPI0 CE0)GPIO 8 (SPI0 CE0)
25GNDGND
26GPIO 7 (SPI0 CE1)GPIO 7 (SPI0 CE1)
27GPIO 0 (EEPROM SDA)GPIO 0 (EEPROM SDA)
28GPIO 1 (EEPROM SCL)GPIO 1 (EEPROM SCL)
29GPIO 5GPIO 5
30GNDGND
31GPIO 6GPIO 6
32GPIO 12 (PWM0)GPIO 12 (PWM0)
33GPIO 13 (PWM1)GPIO 13 (PWM1)
34GNDGND
35GPIO 19 (PCM FS)GPIO 19 (PCM FS)
36GPIO 16 (RTS)GPIO 16 (RTS)
37GPIO 26GPIO 26
38GPIO 20 (PCM DIN)GPIO 20 (PCM DIN)
39GNDGND
40GPIO 21 (PCM DOUT)GPIO 21 (PCM DOUT)

Buses

BusSignalsPinsVoltageNote
UART ×1TX, RX8 / GPIO 14 (UART0 TX), 10 / GPIO 15 (UART0 RX)
I2C ×1SDA, SCL3 / GPIO 2 (I2C1 SDA), 5 / GPIO 3 (I2C1 SCL)

Power

Input7.2-8.8 V DC (8 V plus or minus 10 per cent) on a 2.1 mm centre-positive barrel jack; 5 V from the Pi header when no external supply is fitted

Notes

The 40 pins are the header's own numbering, odd pads down one row and even down the other; the labels are the function names from the pinout.xyz page Pimoroni links to (pinout.xyz/pinout/build_hat), because the header prints only numbers. The four LEGO ports are numbered 0-3 by the HAT's own firmware, not by the PCB, so they are described in ai_context rather than numbered into pins[]. Raspberry Pi's Build HAT Serial Protocol document (RP-008140-DS) says the command port has no flow control, while the same pinout page marks GPIO 17 and GPIO 16 as CTS and RTS; both are recorded and neither is resolved here.

AI context

Dense context for pasting into a model prompt — addresses, pinout, voltages, tolerances and the vendor's reference circuit.

BOARD: the Raspberry Pi Build HAT is an add-on board that fits any Raspberry Pi with a 40-pin GPIO header and drives up to four LEGO Technic motors and sensors from the LEGO Education SPIKE Portfolio, along with devices from the MINDSTORMS Robot Inventor kit and most other LEGO parts that use an LPF2 connector. An onboard RP2040 runs the firmware that handles the hard real-time LPF2 work, so the Pi never touches the device timing itself.
BUS: the HAT-to-Pi link is called the 'command port', a 115200 baud serial interface, 8 bits, no parity, one stop bit (8N1), with no flow control. The protocol is entirely plain text, so a terminal emulator on the Pi can drive the HAT by hand. The firmware numbers the four physical ports 0 to 3, and a 'port' command sets which one later commands address.
POWER: DC input is a 2.1 mm barrel jack, centre positive, 8 V plus or minus 10 per cent (7.2 to 8.8 V), fed by the Build HAT power supply or a 7.5 V battery pack. With that supply connected the HAT powers the Raspberry Pi itself (every model except Pi 400) as well as all connected devices. With no external supply the board still runs, but only for sensors - there is no motor power.
LPF2 DEVICE POWER: every port carries a +3.3 V logic supply that is always present, and a separate driver IC per port supplies about +7.2 V for motors and other high-power devices. Drawing too much from the 3.3 V rail raises a 'Port power fault' message for as long as the fault lasts; a fault on the motor rail raises 'Motor power fault' repeatedly, is latched in hardware and must be cleared explicitly (clear_faults) once the cause is removed. The drivers can output PWM of either polarity, so one setpoint carries both speed and direction.
CONTROL: each port has its own controller, in 'direct PWM' mode by default, where the setpoint is a number from -1 to +1 that maps straight to output power, or in 'PID' mode, where it reads a speed or angle value back from the device and adjusts power to track a setpoint. Some devices have to be powered very soon after they connect and in reverse, which is a setpoint of -1.
PINOUT: the 40-pin header, numbered as the Raspberry Pi numbers it - odd pads down one row, even pads down the other - as published on the pinout the vendor links: 1 3V3, 2 5V, 3 GPIO 2 (I2C1 SDA), 4 5V, 5 GPIO 3 (I2C1 SCL), 6 GND, 7 GPIO 4 (Reset), 8 GPIO 14 (UART0 TX), 9 GND, 10 GPIO 15 (UART0 RX), 11 GPIO 17 (CTS), 12 GPIO 18 (PCM CLK), 13 GPIO 27, 14 GND, 15 GPIO 22, 16 GPIO 23, 17 3V3, 18 GPIO 24, 19 GPIO 10 (SPI0 MOSI), 20 GND, 21 GPIO 9 (SPI0 MISO), 22 GPIO 25, 23 GPIO 11 (SPI0 SCLK), 24 GPIO 8 (SPI0 CE0), 25 GND, 26 GPIO 7 (SPI0 CE1), 27 GPIO 0 (EEPROM SDA), 28 GPIO 1 (EEPROM SCL), 29 GPIO 5, 30 GND, 31 GPIO 6, 32 GPIO 12 (PWM0), 33 GPIO 13 (PWM1), 34 GND, 35 GPIO 19 (PCM FS), 36 GPIO 16 (RTS), 37 GPIO 26, 38 GPIO 20 (PCM DIN), 39 GND, 40 GPIO 21 (PCM DOUT).
TRAPS: only four LPF2 ports exist, so a fifth motor means a second HAT. The Pi 400 needs a ribbon cable or extension because the HAT cannot sit on it. Motor power is gated on the barrel jack, so a project that 'works on USB' will not turn a motor. Motor-rail faults latch in hardware - power-cycling the motor does not clear them, clear_faults does.

Provenance

Every figure on this page was read from the 5 sources below and last checked on Oct 30, 2026.