Picture of Javascript robotics and browser-based Arduino control
Use your JavaScript and web development knowledge to control Arduino projects and even robots (node + robots = nodebots)!

This is made easy with node.js, Firmata and Johnny-Five. Let's get started!

Johnny-Five logo by Mike Sgier. Arduino photo CC-BY Raeky.

Step 1: Install node.js

Picture of Install node.js
Node.js is a javascript runtime based on Chrome's V8 engine. If you haven't used it before, node lets you run Javascript code on the server-side, it's designed around non-blocking I/O and asynchronous events. Node includes modules for accessing the filesystem, a web server, sockets and other basic tasks.

Download and install the node for your platform. Source and binaries are available for Windows, OS X and Linux.


If you're using Ubuntu/Debian, you can use apt-get install nodejs (not node). If you're using a distro's package manager, make sure your node version is recent!

node --version

hthl852 months ago

excellent!!! :)

GregS154 months ago

This may be obvious to some, but where does the JavaScript code execute? Is it on the computer or the Arduino?

Thank you! I hooked up a simple force sensor to an Arduino and managed to browse Google Maps with it!

danasf (author)  carolinebuttet5 months ago

Well done, very cool :D

snoop9116 months ago

Instead of an arduino, could an launchpad msp430 be used?

I have the latest firmata running correctly (or so I think) on the launchpad, but I don't have any way of seeing if it speaks firmata to the pc. I'm new to node.js but I believe it installed correctly.. same with Johnny5.

Is there a sample script that will query the launchpad for the firmata version string?

Also, the instruction:

If you'd like to create a web interface you'll need socket.io too:

How do you run node.js scripts without the use of the web interface? I thought you execute a node.js script by opening a browser with the url : http://localhost:3000 . Is there another way to run node.js?

rrider26 months ago

thanks! https://www.youtube.com/watch?v=ps-6U2mv5JY

exelent port :D

i was trying to acces localhost from other computer on my network and i can look the page but dont allow me to make change, what can i do ?

jelimoore1 year ago

I cannot get it to work when I specify a board like so:

board = new five.Board({ port: "/dev/tty.usbmodem1431”});

My Terminal says:


board = new five.Board({ port: "/dev/tty.usbmodem1431”});


SyntaxError: Unexpected token ILLEGAL

at Module._compile (module.js:439:25)

at Object.Module._extensions..js (module.js:474:10)

at Module.load (module.js:356:32)

at Function.Module._load (module.js:312:12)

at Function.Module.runMain (module.js:497:10)

at startup (node.js:119:16)

at node.js:906:3

danasf (author)  jelimoore1 year ago

Hello, check your trailing quotation mark, it's curly, I think that may be tripping things up!

board = new five.Board({ port: "/dev/tty.usbmodem1431"});