LEGO Technic meets Raspberry Pi with the Build HAT

A new official Raspberry Pi expansion board is introduced today. The Built HAT provides four connectors for LEGO Technic motors and sensors from the SPIKE Portfolio, as well as an 8V DC jack to power both the Raspberry Pi and LEGO motors, sensors, LED matrix, and more.

Designed in collaboration with LEGO Education, the Build HAT features the Raspberry Pi RP2040 dual-core ARM Cortex M0+ MCU for I/O control, and will enable more complex models benefiting from more powerful Broadcom BCM2xxx processors, as well as a Python library for easy programming.

Build HAT key features and specifications:

  • MCU – Raspberry Pi RP2040 microcontroller for low-level control of LEGO Technic devices
  • 4x LPF2 connectors for LEGO Technic motors and sensors included in the SPIKE Portfolio
  • 40-pin GPIO header for connection to Raspberry Pi 4 Model B, 3B+, 3B, 3A+, or Pi Zero family (Raspberry Pi 400 not supported)
  • Misc – 2x Status LED
  • Power Supply  – 7.2V to 8.5V DC via power barrel to power both the Build HAT and Raspberry Pi
  • Dimensions – Raspberry Pi HAT compatible, space for breadboard, opening for camera flat cable
Build HAT connected to Raspberry Pi board with tall headers, two LEGO Technic motors, and fitted with a breadboard

To get started with the Build HAT, you’ll need one of the supported Raspberry Pi boards, a microSD card with Raspberry Pi OS, a 48W (8V/6A) power supply, and compatible LEGO parts, for instance, the LEGO Education SPIKE Prime Set (PN: 45678) and SPIKE Prime Expansion Set v2 (PN: 45681). You could also use your own existing LEGO parts that are compatible with the LPF2 (LEGO Power
Functions version 2) connector.

You can obtain the Build Hat Python Library by upgrading your Raspberry Pi OS to the latest version or installing it from Github. You’ll also need to enable serial in rpi-config for the communication between the Raspberry Pi board and the Build Hat.

Programming looks quite straightforward with a “Hello Motor” sample in Python looking like:


The Raspberry Pi Foundation also provides five detailed guided project tutorials to help educators with teaching materials:

  • LEGO game controller
  • LEGO remote-controlled car
  • LEGO data plotter with pen and paper
  • LEGO data dashboard displaying pollution data on physical dials and sliders
  • LEGO robot face that reacts to what it can see
LEGO Technic Angular Motor

The Raspberry Pi Build HAT can be purchased for $25 and up on the usual resellers such as Sparkfun (US),  Cytron (South East Asia), PiHut (UK), and others, while the 48W power supply is sold separately for $15. Additional information may also be found on the official product page.

Share this:

Support CNX Software! Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples

3 Replies to “LEGO Technic meets Raspberry Pi with the Build HAT”

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertisement
Advertisement