A small LEGO Mindstorms EV3 Node.js library

I love LEGO Mindstorms since I knew of their existence in the early 2000s. I got all three of them: the RCX with a custom firmware to code it with C, NXT with a micro-JVM, and now the new EV3 with a Micro-SD card pending to be installed with a custom ARM Linux with Mono (for C#).

As I'm trying to push harder for Javascript in general as a cross-platform language, I decided instead to go for something different and harder, like coding the robot from Javascript. I came across Andrew Nesbitt's EV3 node library and decided to give it a try.

I had to switch the Bluetooth module as the original one didn't compiled under Windows * and most code looks as directly reverse engineered or captured from bluetooth communication, so I got into checking the EV3 operating system source code and decided to build my library almost from scratch to learn how the messages are send and received by the brick.

After pausing the idea with my recent job switch, I rushed this past days to be able to show something at the Freakend event last weekend, and now I have a quite small codebase for the library but at least organized and with most "obscure" code commented. The library only allows to connect, disconnect, play a tone or move the motors, but it is a good starting point.

I plan to at least implement support for the basic sensors that come with the EV3 and reading the state of the motors. I will not implement the whole OS library as I don't have so much spare time, but I do want to only code my brick with Javascript so eventually all basic functionality will be present.

Most interesting stuff of the official sources can be found at the c_com library; at least is what I'm using as guide for learning and building this lib.

You can find the library, along with a sample program that allows to move all four motors and play random beep tones with the keybord at my GitHub.

* That's why I had my fight with Windows installing Node.js.


Posted by Kartones on 2014-02-14