Product overview
The Raspberry Pi Build HAT is an expansion board for the 40-pin GPIO header of the Raspberry Pi, created in collaboration with LEGO Education. It connects motors and sensors from the LEGO Technic SPIKE Portfolio to a Raspberry Pi and makes them addressable through a Python library.
Four connectors accept LPF2 devices. These include a distance sensor, a colour sensor and a force sensor, as well as angular motors in various sizes whose integrated encoders report their current position. Alongside the SPIKE Portfolio, devices from the LEGO MINDSTORMS Robot Inventor kit and most other LEGO devices using an LPF2 connector are also supported.
Time-critical control is handled by a Raspberry Pi RP2040 on the board, which relieves the main processor of the Raspberry Pi. Unlike most expansion boards, all components sit on the underside; the top surface stays free for a breadboard or LEGO elements. Besides Python, the board can also be addressed from .NET.
Technical specifications
- Controls up to four LEGO Technic motors and sensors from the SPIKE Portfolio
- Further supported devices: LEGO MINDSTORMS Robot Inventor and most other LEGO devices with an LPF2 connector
- Connectors: four LPF2 sockets, addressed in software as ports A to D
- Microcontroller: Raspberry Pi RP2040 for low-level control
- Connection to the Raspberry Pi: 40-pin GPIO header, data transfer over the serial interface
- GPIO lines used: GPIO 0 and 1 (ID EEPROM), GPIO 4 (reset), GPIO 14 (Tx), GPIO 15 (Rx), GPIO 16 and 17 (reserved, unused)
- Power connector: DC barrel jack 5.5 x 2.1 x 11 mm (DC 5521), centre positive
- External power supply: 8 V DC ±10 per cent, up to 48 W
- Software: python3-build-hat Python library, alternatively control from .NET
- Board dimensions: 65 x 56.5 mm (HAT form factor)
- Compatibility: all Raspberry Pi computers with a 40-pin GPIO header, including Zero-series models
Notes
Use Raspberry Pi OS Bookworm instead. Before first use, the serial interface of the Raspberry Pi must be enabled and the serial console disabled.
Driving the motors, as well as the colour and distance sensors, requires an external 8 V power supply, for example the separately available Raspberry Pi Build HAT power supply. If only the motor encoders and the force sensor are to be read, the usual USB power supply of the Raspberry Pi is sufficient. With the 8 V supply connected, the Build HAT also powers the Raspberry Pi.
The board is mounted on the Raspberry Pi using 9 mm spacers and must be fitted the right way up. To keep the GPIO header accessible, a tall header can be used together with 15 mm spacers; neither is included. The LPF2 plugs fit one way round only. On the first program run after power-up, the Raspberry Pi transfers the firmware to the board, which takes a few seconds.
The board must only be connected to a Raspberry Pi via the GPIO header. Any power supply used must comply with the regulations applicable in the country of use. Operate the board in a well-ventilated environment on a stable, flat, non-conductive surface; if a case is used, it must not be covered. Connecting incompatible devices may damage the board and invalidate the warranty. The manufacturer notes that operation requires adult supervision.
Raspberry Pi, power supply and LEGO components are not included. The LEGO Education SPIKE Prime Set 45678 and SPIKE Prime Expansion Set 45681 contain a selection of supported elements and are available from LEGO Education resellers.
Applications
The Build HAT is aimed above all at teaching and training. It links LEGO Education SPIKE Prime with the Raspberry Pi and suits computing, technology and STEM courses from secondary level upwards; the Raspberry Pi Foundation provides ready-made projects for it. Beyond that, it works well for robotics competitions, clubs and maker projects, and for quick functional prototypes in which drives and sensors are built from LEGO Technic elements and combined with Raspberry Pi accessories such as a camera module.