The JavaScript blog.


node modules arduino robots nodecopter

Getting Started with Nodebots

Posted on .

Hey, laser lips, your mama was a snow blower The johnny-five module, with art by Mike Sgier.

I've been collecting lots of resources relating to Arduino, Node, and robots, and there seems to be a lot of interest in the Node community around Arduino and quadcopters. The jewel in the crown of electronics-related Node modules is johnny-five (GitHub: rwldrn / johnny-five, License: MIT, npm: johnny-five. This Arduino programming framework from Bocoup provides an event-based interface into Arduino boards. The readme includes links to a wealth of examples written using JavaScript, embedded in Markdown with documentation and images. For example, Nodebot is a simple robot with motors and wheels that starts a REPL that allows you to move the robot around with commands like n.left.

Arduino works by accepting code over USB -- it comes with an IDE derived from Processing which does all of that for you. In johnny-five projects, the serialport module by Chris Williams (voodootikigod) makes getting code onto your electronic creations possible. Chris has been involved with the world of Node and Arduino since 2010. The serialport module requires native compilation -- the readme has instructions for Windows, OS X, and Linux.

Imagine a world where you can write JavaScript to control blenders, lights, security systems, or even robots. Yes, I said robots. That world is here and now with node-serialport. It provides a very simple interface to the low level serial port code necessary to program Arduino chipsets, X10 wireless communications, or even the rising Z-Wave and Zigbee standards. The physical world is your oyster with this goodie.

The API is event-based, so if you're familiar with Node's asynchronous core modules then you should be able to learn it pretty quickly. There are alternatives to johnny-five as well: duino by Cam Pedersen seems fairly mature.


The nodecopter-remote module can be used to script flying drones. It's built with johnny-five, and is popular with attendees of the NodeCopter.js events:

NodeCopter.js is a full day event where 15 - 60 developers team up in groups of 3.

Each team receives one Parrot AR Drone 2.0 and spends the day programming and playing with it. At the end of the day, each team gets to present their work to the other attendees.

I was introduced to NodeCopter.js by Andrew Nesbitt, who has spoken about Node and quadcopters at events in the UK, and organised Nodecopter London back in March.

There are a lot of other related modules on npm categorised under nodecopter -- one particularly fascinating one is voxel-drone which is an AR Drone simulator in voxeljs.com.

Getting Hardware

There are a lot of cheap Arduino kits around now. The johnny-five documentation mentions the SparkFun Inventor's Kit which is no longer available, but can be found in certain stores (I got one from Amazon a few months ago). The page for the kit has a list of the included parts, so you could order the ones you want separately.

All you really need is an Arduino board, but the important thing is the microcontroller -- you can use other boards with the same or compatible microcontrollers. Even better: Arduino is open, so you can build your own boards.

If you're not sure about Arduino but have access to a Raspberry Pi or BeagleBone, then you could try bonescript:

Bonescript is a node.js library for physical computing on embedded Linux, starting with support for BeagleBone.

The Raspberry Pi is more like a full-blown PC, but it has a simple hardware interface that does digital and analogue I/O -- meaning you can connect it to sensors and motors. I managed to wire mine up to an IR sensor from a defunct laptop to make Raspbmc work with my TV remote.

If you're hooking up hardware with Node, let me know in the comments and I'll check out your projects!


google events node markdown robots

RobotsConf, DownDoc, opensemanticapi

Posted on .



RobotsConf will take place on December 6th in Florida, and is a hardware-focused event aimed at developers who use high-level languages like JavaScript. Organised by Chris Williams (aka @voodootikigod), RobotsConf is a practical event to get you started in the Maker Movement:

If you are a Ruby, Python, JS or any other high level language developer that is interested in the Maker Movement, but unsure where to start -- this event is designed for you. We will have experts in each high level language in attendance and available as well as many of the incredible makers who are already changing the world. With hands-on sessions covering drones, 3D Printing, microcontrollers, and the Internet of Things, this is the only two day event that will take you from a software developer to a Maker.

It's organised by the JSConf team, so you know you'll be in safe hands! Tickets start at $550 for early birds, and then $750 for a regular ticket.


If you followed my Backbone.js Google Tasks tutorials then you'll know all about the wonders of gapi. DownDoc (GitHub: marksteve / downdoc, License: MIT) by Mark Steve Samson uses another Google API to store Markdown documents in Google Drive. If you're tired of working with Word-like documents, then why not give it a try? It's entirely browser-based, and the original source is pretty much a single CoffeeScript file.


opensemanticapi (GitHub: monbro / opensemanticapi, License: MIT) by Michael Klein is a "semantic wording database" made with Node and Redis. After leaving it running for a few hours it will have downloaded enough data to produce interesting results. Michael has some examples in the project's readme, for example:

// http://localhost:8080/relations/ship

["midshipmen", "aboard", "ships", "rating", "master", "served", "seaman", "sea", "officers", "santa", "sailing", "cadets", "able", "sail", "navigation", "lieutenant", "hms", "expected", "yahoo", "storm", "rated", "promotion", "marĂ­a", "lewis", "false", "era", "boys", "wind", "voyage", "volunteer", "servants", "required", "passing", "palos"]

One thing that interests me about this is as a brainstorming tool for authors, as an alternative to a thesaurus.