Raspberry Pi Build HAT
By Raspberry Pi
·
The Build HAT is Raspberry Pi's add-on board for LEGO Technic motors and sensors, designed with LEGO Education. It has four ports for motors and sensors from the LEGO Education SPIKE Portfolio and the LEGO MINDSTORMS ...
Get notified when back in stock
1300 240 817
Mon–Fri, 10am–4pm Sydney time
The Build HAT is Raspberry Pi's add-on board for LEGO Technic motors and sensors, designed with LEGO Education. It has four ports for motors and sensors from the LEGO Education SPIKE Portfolio and the LEGO MINDSTORMS Robot Inventor kit, plus most other LEGO devices with an LPF2 connector, and you control them in Python alongside a camera or anything else on your Raspberry Pi.
An onboard RP2040 microcontroller, the chip in Raspberry Pi Pico, handles the low-level motor and sensor work. All the components sit on the underside of the board, so the top stays flat for LEGO elements or a small breadboard. Motors need an external 8V supply plugged into the HAT, which then powers the Raspberry Pi as well.
Why choose it
- Real LEGO motors with position feedback. The SPIKE angular motors have built-in encoders, so your code can read exactly where each motor is and turn it to a set position.
- Sensors as well as motors. The SPIKE distance, colour and force sensors plug into the same four ports.
- Simple Python. The official
buildhatlibrary runs a motor for a set time or speed in a couple of lines, and works in Thonny. - One power supply for everything. With an 8V supply on the HAT's barrel jack, you don't need a separate USB supply for the Raspberry Pi (Raspberry Pi 400, 500 and 500+ excepted).
- In production until at least January 2028, according to Raspberry Pi.
Powering the Build HAT
LEGO Technic motors are powerful, so driving them needs an external supply on the HAT's barrel jack:
- Recommended: the Raspberry Pi Build HAT Power Supply (48W), sold separately, which powers the HAT, the Raspberry Pi and all connected LEGO devices.
- Alternatives: any reliable 8V ±10% DC supply capable of 48W with a 5.5 × 2.1mm centre-positive barrel plug, or a 7.5V battery pack.
- Sensors only? The force sensor and reading motor encoders work with the Raspberry Pi on its normal USB power supply. The colour and distance sensors, like the motors, need the external supply.
Specifications
| Ports | 4 × LPF2 for LEGO Technic motors and sensors |
|---|---|
| Controller | Raspberry Pi RP2040 microcontroller |
| Connection to Raspberry Pi | 40-pin GPIO header; serial on GPIO14 and GPIO15, reset on GPIO4, ID EEPROM on GPIO0 and GPIO1 |
| Power input | 2.1mm barrel jack, centre positive, 7.2V to 8.5V DC |
| Board size | 65 × 56.5mm (standard HAT footprint) |
| Software | buildhat Python library |
| Production lifetime | Until at least January 2028 |
Compatibility
- Any Raspberry Pi with a 40-pin GPIO header, including Raspberry Pi 4 and the Zero series. It sits on 9mm spacers.
- Raspberry Pi 400, 500 and 500+ (keyboard models): connect through a ribbon cable or other GPIO extension, and power the computer from its own USB-C supply. The Build HAT cannot power them through the GPIO header.
- Need the GPIO pins as well? Fit an optional tall header and use 15mm spacers. Leave GPIO0, 1, 4, 14 and 15 free for the HAT.
- LEGO parts: the LEGO Education SPIKE Prime set 45678 and SPIKE Prime Expansion set 45681 contain motors and sensors the Build HAT supports. They are sold separately by LEGO Education resellers.
Good to know
- Use Raspberry Pi OS Bookworm for now. Raspberry Pi's documentation says the Build HAT is not yet supported on Raspberry Pi OS Trixie.
- Enable the serial port before first use: in Raspberry Pi Configuration, or in
raspi-configunder Interface Options, turn off the serial console and turn on the serial port hardware, then reboot. - The first program you run after each boot pauses for a few seconds while firmware is copied to the HAT. The red LED goes out and the green LED comes on when it's ready.
- LPF2 plugs only fit one way up. If one doesn't slide in easily, turn it over.
- Raspberry Pi, LEGO motors and sensors, and the power supply are all sold separately. The getting started guide, Python library guide and serial protocol are in the documents below.
Documents and downloads
6 documents for the Raspberry Pi Build HAT. Open a PDF's pages here, or download it.
Product briefs
-
Raspberry Pi Build HAT Product Brief Product Brief · PDF · 1.9 MB Preview pages Hide pages
Select a page to read it full size.
Download
Guides
Compliance
Other documents
-
Build HAT Serial Protocol Document · PDF · 381.4 KB Preview pages Hide pages
Select a page to read it full size.
Download