Raspberry Pi Build HAT - LEGO Robotics Add-On For Raspberry Pi

Product ID: 5287
Max per customer: 1


The Raspberry Pi Build HAT (Hardware Attached on Top) is a new add-on board for your Raspberry Pi. It connects to the 40-pin GPIO header and can be used to control up to four LEGO Technic motors and sensors from the LEGO Education SPIKE Portfolio.

The cool design of the Build HAT means that all the components are on the bottom, leaving room on the top of the board for LEGO Minifigures to hitch a ride, or for a mini breadboard. You can connect the HAT directly to your Raspberry Pi with the attached header, using 9mm spacers to ensure a stable fit, or you can add an extra-tall header to keep the unused GPIO pins accessible. Whichever method you choose, make sure you position the Build HAT the right way round when installing it on your Raspberry Pi!

It provides four connectors for LEGO Technic motors and sensors from the LEGO Education SPIKE Portfolio. The available (sold separately) sensors include a distance sensor, a color sensor, and a force sensor. The angular motors come in a range of sizes and include integrated encoders that can be queried to find their position.

The Build HAT fits all Raspberry Pi computers with a 40-pin GPIO header, including including Raspberry Pi 4 and Raspberry Pi Zero. With the addition of a ribbon cable or other extension device, you can also use it with Raspberry Pi 400.

Connected LEGO Technic devices can easily be controlled in Python, alongside standard Raspberry Pi accessories such as a camera module. The Raspberry Pi Build HAT power supply, available separately, is designed to power both the Build HAT and Raspberry Pi computer along with all connected LEGO Technic devices.



Technical Details


  • GitHub
  • Supports motors and sensors included in the LEGO® Education SPIKE Portfolio, along with those from the LEGO® MINDSTORMS® Robot Inventor kit and most other LEGO devices that use an LPF2 connector
  • Fits any Raspberry Pi computer with a 40-pin GPIO header (including, with the addition of a ribbon cable or other extension device, Raspberry Pi 400)
  • Developed Python library supports students and makers to create and learn
  • DC power connector: 2.1mm barrel jack, center positive
  • Powers your Raspberry Pi computer (except Raspberry Pi 400) and connected LEGO Technic devices when used with an external 8V ±10% DC power source, such as the Raspberry Pi Build HAT Power Supply or a 7.5V battery pack
  • Onboard Raspberry Pi RP2040 microcontroller manages low-level control of LEGO Technic devices
RoHS 2 2011 65 EU Compliant
RoHS 2 2015 863 EU Compliant

See our Distributors page for a complete list of distributors.