3.3 KiB
node-lpf2 - A Node.js module to interface with LEGO Power Functions 2.0 components.
Installation
Node.js v8.0+ required.
npm install node-lpf2 --save
node-lpf2 uses the Noble BLE library by Sandeep Mistry. On macOS everything should function out of the box. On Linux and Windows there are certain dependencies which may need installed first.
Note: node-lpf2 has been tested on macOS 10.13 and Debian/Raspbian on the Raspberry Pi 3 Model B.
Compatibility
While most LPF2 components and Hubs are compatible with each other, there are exceptions. There is limited backwards compatibility between newer components and the WeDo 2.0 Smart Hub. However WeDo 2.0 components are fully forwards compatible with newer Hubs.
Name | Type | WeDo 2.0 Smart Hub | Boost Move Hub | Powered Up Hub | Availability |
---|---|---|---|---|---|
WeDo 2.0 Tilt Sensor | Sensor | Yes | Yes | Yes | 45300 |
WeDo 2.0 Motion Sensor | Sensor | Yes | Yes | Yes | 45300 |
WeDo 2.0 Medium Motor | Motor | Yes | Yes | Yes | 45300 76112 |
Boost Color and Distance Sensor | Sensor | Partial | Yes | Yes | 17101 |
Boost Interactive Motor | Motor/Sensor | Partial | Yes | Partial | 17101 |
Powered Up Train Motor | Motor | Yes | Yes | Yes | 60197 60198 |
Powered Up LED Lights | Light | Unknown | Unknown | Unknown | 88005 |
Known Issues and Limitations
-
The Boost Color and Distance sensor only works in color mode with the WeDo 2.0 Smart Hub.
-
When used with the WeDo 2.0 Smart Hub, the Boost Interactive Motor does not support rotating the motor by angle.
-
When used with the Powered Up Hub, the Boost Interactive Motor does not support rotating the motor by angle. It also does not support rotation detection.
-
Plugging two Boost Interactive Motors into the Powered Up Hub will crash the Hub (This requires a firmware update from LEGO to fix).
Usage
const LPF2 = require("node-lpf2").LPF2;
const lpf2 = new LPF2();
Examples are available in the "examples" directory.
Credits
Thanks go to Jorge Pereira (@JorgePe), Sebastian Raff (@hobbyquaker), Valentin Heun (@vheun), and Johan Korten (@jakorten) for their various works and assistance on figuring out the LEGO Boost, WeDo 2.0, and Powered Up protocols.