All Projects → nathankellenicki → Node Poweredup

nathankellenicki / Node Poweredup

Licence: mit
A Javascript module to interface with LEGO Powered Up components.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Node Poweredup

static string
A fixed capacity dynamically sized string
Stars: ✭ 46 (-84.3%)
Mutual labels:  boost
openfluid
OpenFLUID framework and applications
Stars: ✭ 19 (-93.52%)
Mutual labels:  boost
Geometry
Boost.Geometry - Generic Geometry Library | Requires C++14 since Boost 1.75
Stars: ✭ 282 (-3.75%)
Mutual labels:  boost
eraserface
dynamic polymorphism without inheritance
Stars: ✭ 31 (-89.42%)
Mutual labels:  boost
RocketXPlugin
🔥🔥 android 端编译加速插件🚀 自动识别未改动 module 并在编译流程中替换为 aar ,只编译改动模块,加速 Android apk 的编译速度。
Stars: ✭ 408 (+39.25%)
Mutual labels:  boost
site
boostjpサイトのMarkdownソース
Stars: ✭ 34 (-88.4%)
Mutual labels:  boost
zork
Full C++-17 port of the 616-point version of Zork from MIT circa 1978-1981
Stars: ✭ 16 (-94.54%)
Mutual labels:  boost
S25client
Return To The Roots (Settlers II(R) Clone)
Stars: ✭ 288 (-1.71%)
Mutual labels:  boost
bh
R package providing Boost Header files
Stars: ✭ 73 (-75.09%)
Mutual labels:  boost
Boost guide
This is the sample code for Boost library Guide.
Stars: ✭ 268 (-8.53%)
Mutual labels:  boost
tbag
Tea-bag is Third party extension utility project
Stars: ✭ 13 (-95.56%)
Mutual labels:  boost
contract
Contract programming for C++
Stars: ✭ 28 (-90.44%)
Mutual labels:  boost
Vanilla Rtb
Real Time Bidding (RTB) - Demand Side Platform framework
Stars: ✭ 257 (-12.29%)
Mutual labels:  boost
asio-extensions
Additional functionality built on top of (Boost.)Asio
Stars: ✭ 16 (-94.54%)
Mutual labels:  boost
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+1006.14%)
Mutual labels:  boost
CDT-plusplus
Causal Dynamical Triangulations in C++ using CGAL
Stars: ✭ 49 (-83.28%)
Mutual labels:  boost
eigenpy
Bindings between Numpy and Eigen using Boost.Python
Stars: ✭ 88 (-69.97%)
Mutual labels:  boost
Quantum
Powerful multi-threaded coroutine dispatcher and parallel execution engine
Stars: ✭ 291 (-0.68%)
Mutual labels:  boost
Kernels
This is a set of simple programs that can be used to explore the features of a parallel platform.
Stars: ✭ 287 (-2.05%)
Mutual labels:  boost
Spirit
Boost.org spirit module
Stars: ✭ 256 (-12.63%)
Mutual labels:  boost

Drone NPM Version

node-poweredup - A Javascript module to interface with LEGO Powered Up components.

Announcements

  • v6.8.0 adds support for LEGO Super Mario.

Introduction

LEGO Powered Up is the successor to Power Functions, the system for adding electronics to LEGO models. Powered Up is a collection of ranges, all of which are compatible with each other:

  • LEGO Education WeDo 2.0
  • LEGO Boost
  • LEGO Powered Up
  • LEGO Technic CONTROL+
  • LEGO Education SPIKE Prime
  • LEGO Mindstorms Robot Inventor

Other products that speak the Powered Up protocol include the Duplo App-Controlled trains and LEGO Super Mario, both of which are compatible with this library.

This library allows communication and control of Powered Up devices and peripherals via Javascript, both from Node.js and from the browser using Web Bluetooth.

Node.js Installation

Node.js v8.0+ required.

npm install node-poweredup --save

node-poweredup 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-poweredup has been tested on macOS 11.0 and Debian/Raspbian on the Raspberry Pi 3 Model B.

Compatibility

While most Powered Up components and Hubs are compatible with each other, there are exceptions. For example, 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.

Device Name Product Code Type WeDo 2.0 Smart Hub Boost Move Hub Powered Up Hub Control+ Hub Availability
WeDo 2.0 Tilt Sensor 45305 Sensor Yes Yes Yes Yes 45300
WeDo 2.0 Motion Sensor 45304 Sensor Yes Yes Yes Yes 45300
WeDo 2.0 Medium Motor 45303 Motor Yes Yes Yes Yes 45300
76112
Boost Color and Distance Sensor 88007 Sensor Partial Yes Yes Yes 17101
Boost Tacho Motor 88008 Motor/Sensor Partial Yes Yes Yes 17101
Powered Up Train Motor 88011 Motor Yes Yes Yes Yes 60197
60198
Powered Up LED Lights 88005 Light Yes Yes Yes Yes 88005
Control+ Large Motor 22169 Motor/Sensor Partial No Yes Yes 42099
42100
Control+ XLarge Motor 22172 Motor/Sensor Partial No Yes Yes 42099
42100
SPIKE Prime Medium Motor 45678 Motor/Sensor Partial No Yes Yes 45678
SPIKE Prime Large Motor 45678 Motor/Sensor Partial No Yes Yes 45678
SPIKE Prime Color Sensor 45678 Sensor No No Yes Yes 45678
SPIKE Prime Distance Sensor 45678 Sensor No No Yes Yes 45678
SPIKE Prime Force Sensor 45678 Sensor Partial Yes Yes Yes 45678

In addition, the Hubs themselves have certain built-in features which this library exposes.

Hub Name Product Code Built-In Features Availability
WeDo 2.0 Smart hub 45301 RGB LED
Piezo Buzzer
Button
45300
Boost Move Hub 88006 RGB LED
Tilt Sensor
2x Tacho Motors
Button
17101
Powered Up Hub 88009 RGB LED
Button
60197
60198
76112
Powered Up Remote 88010 RGB LED
Left and Right Control Buttons
Button
60197
60198
Duplo Train Base 28743 RGB LED/Headlights
Speaker
Speedometer
Motor
Color and Distance Sensor
Button
10874
10875
Control+ Hub 22127 RGB LED
Button
Tilt Sensor
Accelerometer
42099
42100
Super Mario 71360 Pants Sensor
Barcode and Color Sensor
71360

Known Issues and Limitations

  • The WeDo 2.0 Smart Hub uses an older firmware which is no longer being updated. As a result, only certain motors and sensors work with it. See the table above.

  • When used with the Boost Move Hub, the Control+ Motors and SPIKE Prime Motors/Sensors do not currently accept commands (This is a known bug which requires a firmware update from Lego to fix)

  • The SPIKE Prime Hub does not use Bluetooth Low Energy, so is not supported via this library. It is recommended you use MicroPython to develop for this Hub using the officially provided tools and software.

  • On most Unix systems, you need root permissions to access Bluetooth devices. You may want to grant the node executable access to the Bluetooth adapter

Documentation

Full documentation is available here.

Node.js Sample Usage

const PoweredUP = require("node-poweredup");
const poweredUP = new PoweredUP.PoweredUP();

poweredUP.on("discover", async (hub) => { // Wait to discover a Hub
    console.log(`Discovered ${hub.name}!`);
    await hub.connect(); // Connect to the Hub
    const motorA = await hub.waitForDeviceAtPort("A"); // Make sure a motor is plugged into port A
    const motorB = await hub.waitForDeviceAtPort("B"); // Make sure a motor is plugged into port B
    console.log("Connected");

    while (true) { // Repeat indefinitely
        console.log("Running motor B at speed 50");
        motorB.setPower(50); // Start a motor attached to port B to run a 3/4 speed (75) indefinitely
        console.log("Running motor A at speed 100 for 2 seconds");
        motorA.setPower(100); // Run a motor attached to port A for 2 seconds at maximum speed (100) then stop
        await hub.sleep(2000);
        motorA.brake();
        await hub.sleep(1000); // Do nothing for 1 second
        console.log("Running motor A at speed -30 for 1 second");
        motorA.setPower(-30); // Run a motor attached to port A for 2 seconds at 1/2 speed in reverse (-50) then stop
        await hub.sleep(2000);
        motorA.brake();
        await hub.sleep(1000); // Do nothing for 1 second
    }
});

poweredUP.scan(); // Start scanning for Hubs
console.log("Scanning for Hubs...");

More examples are available in the "examples" directory.

Credits

Thanks go to Jorge Pereira (@JorgePe), Sebastian Raff (@hobbyquaker), Valentin Heun (@vheun), Johan Korten (@jakorten), and Andrey Pokhilko (@undera) for their various works, contributions, and assistance on figuring out the LEGO Boost, WeDo 2.0, and Powered Up protocols.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].