A Raspberry Pi HAT for the Lego Technic fan

Sneaking in programming under the guise of plastic bricks


There is good news for the intersection of Lego and Raspberry Pi fans today, as a new HAT (the delightfully named Hardware Attached on Top) will be unveiled for the diminutive computer to control Technic motors and sensors.

In the belly of the beast: Pi Build HAT next to your correspondent's Lego

In the belly of the beast: Pi Build HAT next to your correspondent's Lego (click to enlarge)

Using a Pi to process sensor readings and manage motors has been a thing since the inception of the computer, and users (including ourselves) have long made use of the General Purpose Input / Output (GPIO) pins that have been a feature of the hardware for all manner of projects.

However, not all users are entirely happy with breadboards and jumpers. Lego, familiar to many a builder thanks to lines such as its Mindstorms range, recently introduced the Education SPIKE Prime set, aimed at the classroom.

The set contains a wide variety of components, including motors and sensors, controllable via a rechargeable hub and tablet application. It is the latter elements that a Build HAT-equipped Pi can replace: simply plug those motor and sensor components into the Pi hardware instead.

Effectively, this is a HAT device that connects to Lego devices that use a LPF2 connector. An onboard RP2040 microcontroller takes care of the low-level control of the Technic devices while an external power supply is needed to provide power. At the top level, developers can make use of Python to query sensors and run motors.

Pi Build HAT in use

A Raspberry Pi Build HAT in use ... Click to enlarge

It's entertaining stuff, and we can imagine it coming in handy in a classroom setting – sensors include devices to check distance, report colour and force, while motors can both be queried with regard to their position (if supported) and spun as required. The Pi team reckon the kit will also find fans outside of the education sector.

It's also a stepping stone to bigger and more exciting things, in our opinion. After all, once a curious mind has created a bit of code to operate machinery in the real world via the rapid prototyping made possible by the kit, making the transition to more advanced applications is not such a major leap.

As for the Build HAT itself, there are only four LPF2 connectors (adding more was apparently tricky due to space constraints) as well as a power connector and a helpful slot for feeding through the ribbon from the Pi's camera (should one be fitted.) The Raspberry Pi team reckons it should work on all models of the computer that have a 40 pin GPIO header, although Pi-400 users will need an extension cable and won't be able to use the external power supply to power the Pi.

Give it a go

We tried it out with a Pi 4 Model B and found no significant issues – there was enough juice to keep the Pi running and the Python libraries are well documented with helpful examples.

Not so great was the fact that the HAT fouled the fan we'd fitted to our Pi 4 and, of course, the stock case would no longer fit. To be fair, this is pretty much par for the course when it comes to augmenting one's Pi, but worth keeping in mind. Then again, one could regard it as an opportunity to get creative with the plastic bricks.

Compared to the cost of the Lego involved – the complete SPIKE Prime set retails for a whopping £361.99 in the UK, and $339.95 in the US – to consumers so it might be worth picking and choosing the required components), the HAT is a relative snip at $25, although you will need a power supply capable of pumping out 7.5v into a 2.1mm centre-positive barrel jack. If you've not got one to hand, the Pi team expects the branded version to go for $15. Pre-orders start today, although resellers won't have it in stock until 25 October, meaning a few more days wait for end users.

If you've gone down the Technic route, with motors and sensors armed with LPF2 connectors, the Build HAT is a fun interface. We're still pondering how to make our definitely-not-official-plastic-brick NASA crawler move without sending the Saturn V and Umbilical Tower on top tumbling.

A headless Pi running things from within the heart of the beast and slowly spinning up motors a degree at a time does have a certain appeal. ®

Similar topics


Other stories you might like

  • Zuckerberg sued for alleged role in Cambridge Analytica data-slurp scandal
    I can prove CEO was 'personally involved in Facebook’s failure to protect privacy', DC AG insists

    Cambridge Analytica is back to haunt Mark Zuckerberg: Washington DC's Attorney General filed a lawsuit today directly accusing the Meta CEO of personal involvement in the abuses that led to the data-slurping scandal. 

    DC AG Karl Racine filed [PDF] the civil suit on Monday morning, saying his office's investigations found ample evidence Zuck could be held responsible for that 2018 cluster-fsck. For those who've put it out of mind, UK-based Cambridge Analytica harvested tens of millions of people's info via a third-party Facebook app, revealing a – at best – somewhat slipshod handling of netizens' privacy by the US tech giant.

    That year, Racine sued Facebook, claiming the social network was well aware of the analytics firm's antics yet failed to do anything meaningful until the data harvesting was covered by mainstream media. Facebook repeatedly stymied document production attempts, Racine claimed, and the paperwork it eventually handed over painted a trail he said led directly to Zuck. 

    Continue reading
  • Florida's content-moderation law kept on ice, likely unconstitutional, court says
    So cool you're into free speech because that includes taking down misinformation

    While the US Supreme Court considers an emergency petition to reinstate a preliminary injunction against Texas' social media law HB 20, the US Eleventh Circuit Court of Appeals on Monday partially upheld a similar injunction against Florida's social media law, SB 7072.

    Both Florida and Texas last year passed laws that impose content moderation restrictions, editorial disclosure obligations, and user-data access requirements on large online social networks. The Republican governors of both states justified the laws by claiming that social media sites have been trying to censor conservative voices, an allegation that has not been supported by evidence.

    Multiple studies addressing this issue say right-wing folk aren't being censored. They have found that social media sites try to take down or block misinformation, which researchers say is more common from right-leaning sources.

    Continue reading
  • US-APAC trade deal leaves out Taiwan, military defense not ruled out
    All fun and games until the chip factories are in the crosshairs

    US President Joe Biden has heralded an Indo-Pacific trade deal signed by several nations that do not include Taiwan. At the same time, Biden warned China that America would help defend Taiwan from attack; it is home to a critical slice of the global chip industry, after all. 

    The agreement, known as the Indo-Pacific Economic Framework (IPEF), is still in its infancy, with today's announcement enabling the United States and the other 12 participating countries to begin negotiating "rules of the road that ensure [US businesses] can compete in the Indo-Pacific," the White House said. 

    Along with America, other IPEF signatories are Australia, Brunei, India, Indonesia, Japan, South Korea, Malaysia, New Zealand, the Philippines, Singapore, Thailand and Vietnam. Combined, the White House said, the 13 countries participating in the IPEF make up 40 percent of the global economy. 

    Continue reading
  • 381,000-plus Kubernetes API servers 'exposed to internet'
    Firewall isn't a made-up word from the Hackers movie, people

    A large number of servers running the Kubernetes API have been left exposed to the internet, which is not great: they're potentially vulnerable to abuse.

    Nonprofit security organization The Shadowserver Foundation recently scanned 454,729 systems hosting the popular open-source platform for managing and orchestrating containers, finding that more than 381,645 – or about 84 percent – are accessible via the internet to varying degrees thus providing a cracked door into a corporate network.

    "While this does not mean that these instances are fully open or vulnerable to an attack, it is likely that this level of access was not intended and these instances are an unnecessarily exposed attack surface," Shadowserver's team stressed in a write-up. "They also allow for information leakage on version and build."

    Continue reading
  • A peek into Gigabyte's GPU Arm for AI, HPC shops
    High-performance platform choices are going beyond the ubiquitous x86 standard

    Arm-based servers continue to gain momentum with Gigabyte Technology introducing a system based on Ampere's Altra processors paired with Nvidia A100 GPUs, aimed at demanding workloads such as AI training and high-performance compute (HPC) applications.

    The G492-PD0 runs either an Ampere Altra or Altra Max processor, the latter delivering 128 64-bit cores that are compatible with the Armv8.2 architecture.

    It supports 16 DDR4 DIMM slots, which would be enough space for up to 4TB of memory if all slots were filled with 256GB memory modules. The chassis also has space for no fewer than eight Nvidia A100 GPUs, which would make for a costly but very powerful system for those workloads that benefit from GPU acceleration.

    Continue reading
  • GitLab version 15 goes big on visibility and observability
    GitOps fans can take a spin on the free tier for pull-based deployment

    One-stop DevOps shop GitLab has announced version 15 of its platform, hot on the heels of pull-based GitOps turning up on the platform's free tier.

    Version 15.0 marks the arrival of GitLab's next major iteration and attention this time around has turned to visibility and observability – hardly surprising considering the acquisition of OpsTrace as 2021 drew to a close, as well as workflow automation, security and compliance.

    GitLab puts out monthly releases –  hitting 15.1 on June 22 –  and we spoke to the company's senior director of Product, Kenny Johnston, at the recent Kubecon EU event, about what will be added to version 15 as time goes by. During a chat with the company's senior director of Product, Kenny Johnston, at the recent Kubecon EU event, The Register was told that this was more where dollars were being invested into the product.

    Continue reading

Biting the hand that feeds IT © 1998–2022