This Raspberry Pi add-on lets you control Lego robots
Raspberry Pi is releasing an add-on that will let you use many of its tiny, inexpensive computers to control certain Lego robot motors and sensors. The add-on is called the Build HAT (HAT stands for Hardware Attached on Top), and slotting it onto a Raspberry Pi’s GPIO pins will give you four ports that you can use to control Lego Education’s SPIKE components, which the HAT and its software are specially designed for. It’ll also connect to most other parts that use an LPF2 connector, including the components from the Lego Mindstorms robot inventor kit.
There’s also a Python library (basically a set of commands you can use to control the robot) available to go alongside the HAT, which will let you write software to control the robot parts you’ve got hooked up.
Programing Lego’s SPIKE components with Python isn’t a unique selling feature from Raspberry Pi — the SPIKE kit comes with a hub that supports connecting six devices (compared to the Build HAT’s four) that can also store and run Python programs.
However, you’re going to get more flexibility with a Raspberry Pi. You have to program Lego’s hub using a separate computer or iPad, whereas the Build HAT will be attached to its own computer that you can likely plug a keyboard, mouse, and monitor into, depending on which Raspberry Pi you’re using. The SPIKE Hub also only has LPF2 ports (though it has six, compared to the Build HAT’s four), whereas the Pi has GPIO pins that you can use to connect other devices, electronics, and sensors.
That gives you a ton of flexibility in what you can add to your robots. The Build HAT also will let you control your motors and sensors at a lower level if that sort of thing is your jam.
Raspberry Pi says that hooking the Build HAT up to an 8V power supply with a barrel plug will let it provide juice to both the Lego accessories connected to it and the Raspberry Pi itself. The company will sell a specific 48W power supply to go along with it if you don’t have one that’s capable.
This is obviously a pretty niche product, but I’m glad it exists.
If your kid or students are playing around with Lego’s SPIKE robots but want to go deeper into programming and electronics modding, the Build HAT could be a good way to help them do that with the motors and sensors you already have.
Plus, Raspberry Pi and Lego seem to be a perfect match for each other — both brands have a sort of DIY spirit and could make some interesting projects if they end up doing more work together.