LEGO Gets an Upgrade with Raspberry Pi Build HAT!

LEGO and Raspberry Pi combine to bring you massive versatility for your next project!
Odin Odin (182)

Everyone knows that it’s possible to build just about anything out of LEGO blocks, one of the most imaginative toys ever invented, but now the ability to go high-tech with your LEGO collection just went to a whole new level with a new integration for the Raspberry Pi computer: the world’s smallest full computer and one of the most versatile pieces of hardware around.

The new device is called the “Build HAT” (“HAT” stands for Hardware Attached on Top) an is designed to connect with LEGO® Technic™ motors and sensors. The HAT fits any Raspberry Pi with a 40-pin GPIO header and lets you control up to four LEGO® Technic™ motors and sensors from the LEGO® Education SPIKE™ Portfolio. The whole purpose of LEGO’s advanced building platform is to excite interest in STEAM (Science, Technology, Engineering, Arts, and Math) in a young audience, but the incredible power afforded by this array of products means that any LEGO enthusiast can create a whole plethora of robotic wonders. With the addition of the Raspberry Pi Build HAT, the ease of programming (through the HATs accompanying Python library), as well as the extended range of parts and sensors that connecting the Pi allows as builder to use, makes this extremely exciting for those who want to take their LEGO engineering project to hitherto unheard of dimensions.

Raspberry Pi Build HatRaspberry Pi Build Hat ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.


One of the great things about the Build HAT is that it comes with its own Python programming library. LEGO’s SPIKE kit has its own hub that also runs Python programs, but the Raspberry Pi Build HAT offers both an extensive Python library ready for integration with LEGO SPIKE sensors, motors, and other gear, but it offers this in a much more easily-configured package.

With the SPIKE hub, programming needs to take place on a separate device, to be then transferred to the hub for testing. With the Build HAT, you already have your fully-functional Raspberry Pi computer in front of you! Being able to plug in a mouse, keyboard, and monitor directly means that you can program directly instead of mucking about with transferring your code.

Greater Control and Non-LEGO Devices!
Greater Control and Non-LEGO Devices!

The Raspberry Pi Build HAT offers something else for LEGO enthusiasts: the ability to connect a much wider range of exciting gear. Instead of LEGO’s own LPF2 ports, with the Build HAT you can now use devices that feature General-purpose input/output (GPIO) pins. With these, the range of external sensors and other devices you can attach to your LEGO creation becomes massive, opening a vast store of options for even the most eclectic and imaginative LEGO inventors.

It’s this wide field of 3rd-party connectivity that really sets the Build HAT head and shoulders above the native LEGO hubs, dramatically increasing the versatility of the possible builds.

Thanks to the onboard RP2040 microcontroller, the Build HAT also allows for low-level control of LEGO Technic devices. This means that increased sensitivity can be applied in the control of attached devices like motors and sensors, allowing your creations to do more and do more better.

Accessories and Vast Functionality
Accessories and Vast Functionality

With initial pricing of just $25, the Build HAT board is fully comparable with all 40-pin GPIO Raspberry Pi boards, including Raspberry Pi 4 and our very favorite, the Raspberry Pi Zero. With an extension device, like a ribbon cable, it’s even possible to connect this to the Raspberry Pi 400.

The design of the Build HAT takes the needs of LEGO enthusiasts into careful consideration beyond the hardware and software side of things as well: by being built with all the components on the bottom, the Build HAT leaves room on the top for a mini breadboard that you can use for more complex projects (or you can simply use the free space as a platform for your LEGO Minifigure collection).

More Power!

Raspberry Pi isn’t stopping there, either.

All this cool gear requires a lot of juice to run. The LEGO Technic line, especially, features extremely powerful motors that simply eat electricity. For the basic stuff, you can feed power in through the Raspberry Pi’s own USB power socket, but once you start adding on things like distance sensors, color sensors, or motors, an external supply becomes a must, and it’s pretty awesome of the Raspberry Pi folks for thinking of this and creating a powerful and robust little charger that can handle running this all at once.

Connect the dots!

Connecting your Raspberry Pi Build HAT to your LEGO creation is a wide-open fields of possibility. How you connect it into your invention really is up to you. But the Raspberry Pi Build HAT also works perfectly with a special LEGO piece found in the SPIKE Prime Expansion set. This features, for the first time ever, a LEGO piece intended to connect to non-LEGO things! Called the Maker Plate, this little piece makes slotting on your Build HAT a total breeze.

The real fun is that, however you decide to connect the Build HAT into your project, you’ll now have a fully-functional, and fully networkable computer as the heart and brain of your invention. This means that you can easily access online data sources, alter or add programming, and connect a huge array of components through the Pi’s GPIO pins.

Finally, Raspberry Pi is brining together a huge array of educational projects for those who are just getting started. You can follow these step-by-step tutorials to make seriously awesome creations, like a DIY game controller that will light up any retro gamer’s life, a robot buggy that can drive around via actual Bluetooth remote control, or even get into deeper projects involving machine learning with an expressive robot face!

Combine the Power of Pi with the Magic of LEGO
Combine the Power of Pi with the Magic of LEGO

Seeing Raspberry Pi come out with the Build HAT is really exciting for those of us interested in the vast educational potential of the awesome LEGO ecosystem, and is certain to just be hugely fun as well. Some might consider this a bit of a niche product, but it’s also a great starting place for kids or newbie engineering enthusiasts who want to get started working on a scalable project that offers loads of potential. For those already immersed in the world of LEGO engineering, the massive power and versatility provided by the Raspberry Pi Build HAT will be a treat, and for those just starting out it’s a really fun way to explore both LEGO’s awesome array of educational kits, and the awesomeness that is the Raspberry Pi!

Keep your Pi hot and ready.
Zach Zach (248)
15 minutes

In this guide, I'll teach you how to build your own Raspberry Pi UPS using some simple hardware and the PiJuice HAT (featured in our recent list of the top HATs for the Raspberry Pi).