node-poweredup
Powered Up Logo

In July 2018 Lego released the first sets containing what they call the “LEGO Powered UP!” system. These are the new 2018 train sets. Functionally they’re identical to the old Lego Power Functions train sets, but they use Bluetooth Low Energy (BLE) rather than infra-red to communicate between the remote and the train.

The basis of the system is this: there is a remote, a hub, and a motor that plugs into the hub. The remote activates the motor when a button is pressed by talking to the hub over BLE. Simple.

What Lego hasn’t told you however is that this system was actually introduced in 2014, and further expanded upon in 2017, before gaining the name "Powered UP!" in 2018. In 2014 Lego released WeDo 2.0, the education system for building interactive models. This contained a hub (The “Smart Hub”), a motor, a 3-axis tilt sensor, and a distance sensor. In 2017, Lego followed up by releasing the Boost Interactive Toolkit, containing a hub (The “Move Hub”), an interactive motor, and a color and distance sensor.

The interesting thing about all these products is that they are all secretly compatible. The motors, sensors, and hubs all speak (mostly) the same protocol, enabling them to work with each other. In fact internally, all these components have been given the name Lego Power Functions 2.0. It’s a shame then that Lego hasn’t released official tools or apps to allow this compatibility, restricting each range to its own components.

However thanks to the work of members of the Lego community, the BLE protocol was reverse engineered, enabling us to write unofficial apps and libraries.

With that in mind, I’d like to talk about the latest project of mine, node-poweredup.

node-poweredup is a Node.js module (written in TypeScript) that enables you to control your Powered Up (and WeDo 2.0 and Boost) components and hubs. It talks to your hubs over Bluetooth Low Energy and exposes a simple high level API to control your attached motors and sensors.

In addition, it enables a level of cross compatibility that Lego hasn’t achieved with their official apps - that is, you can use WeDo 2.0 sensors with a Powered Up hub, Boost motors with a WeDo 2.0 hub, etc. In short, components are compatible with most hubs, at least in a basic fashion.

You can find code samples over at the GitHub page. Hopefully this can get you started on unlocking the full functionality of the Lego Powered Up components.


Index