All News | Boards | Chips | Devices | Software | Archive | About | Contact | Subscribe
Follow LinuxGizmos:
Twitter Facebook Pinterest RSS feed
*   get email updates   *

Raspberry Pi LEGO HAT taps RP2040

Oct 19, 2021 — by Eric Brown 899 views

Raspberry Pi has launched a $25 “LEGO Build HAT” for STEAM education based on its RP2040 MCU. The HAT can control up to 4x LEGO Technic motors and sensors and comes with Python library and an optional $15 power supply.

When Raspberry Pi launched its dual Cortex-M0+ based RP2040 MCU and RP2040-based Raspberry Pi Pico module, we speculated that one or both might show up in a Raspberry Pi HAT. Today, Raspberry Pi and Lego Education announced an official LEGO Build HAT based on the RP2040 designed for any 40-pin Raspberry Pi. The $25 HAT is designed for STEAM education and hobbyist hacking for anyone who owns the LEGO Education SPIKE Prime or SPIKE Prime Expansion sets, or other LEGO devices such as the LEGO Mindstorms Robot Inventor kit.

LEGO Build HAT alone (left) and with Raspberry Pi
(click images to enlarge)

The LEGO Build HAT can connect to 4x LEGO Technic motors and sensors from the SPIKE kits via 4x LPF2 connectors. The RP2040 and other components such as dual LEDs are bottom mounted, leaving the top open to add a breadboard. LEGO offers a Maker Plate option for mounting the Raspberry Pi.

The HAT provides a DC jack that can power both the HAT and the Pi via an external 7.5V battery pack or the optional $15, 8V power supply. The HAT can work with the standard, USB-based Raspberry Pi power for projects limited to reading from motor encoders and the SPIKE force sensor. For most applications, however, including reading SPIKE color and distance sensors, you will need an external supply.


The LEGO Build HAT is available with a Build HAT Python library along with 5x project guides. Examples include a game controller, a robot buggy, and a data plotter.

LEGO Build HAT with Pi and LEGO parts (left) and with mounted LEGO breadboard
(click images to enlarge)

LEGO interfaces have appeared on a variety of robotics education kits. Examples include the Leguino educational hacker kit, which uses the Raspberry Pi Zero W or Arduino. Back in 2013 LEGO introduced a LEGO Mindstorms EV3 kit that runs Linux on an ARM9-based brick. Even some higher end robots like Elephant Robotics’ recent MyCobot Pi manipulation robot include LEGO connectors.

The popular, mostly open-spec RP2040 chip is equipped with 2x 133MHz Cortex-M0+ cores. This is faster than many Arduino processors, but slower than higher end models such as those that use the ESP32.

The 7×7mm MCU provides 264KB SRAM, 2MB flash, and a USB 1.1 host/device controller and PHY. There are 30 GPIO pins for 2x UART, 2x SPI, 2x I2C, and 16x PWM plus 8x RPi Programmable I/O (PIO) state machines and interpolator and integer divider peripherals. The 51 x 21mm Raspberry Pi Pico module extends the RP2040 with 2MB of flash, a micro-USB port, a serial debug interface, and castellated edge GPIO pads, among other features.

Further information

The LEGO Build HAT is available for $25 from the usual Pi resellers, including SparkFun in the US. The optional $15 power supply is available here. More information may be found in the announcement on the new website, as well as the product page, which links to resellers.

(advertise here)

Print Friendly, PDF & Email

Please comment here...