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
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!
Step 2: Install johnny-five
Create a folder for your project and use Node's package manager, npm, to install johnny-five.
At the command line use npm install as follows:
npm install johnny-five
If you'd like to create a web interface you'll need socket.io too:
npm install socket.io
Step 3: Upload Firmata to your Arduino
- Download and open the Arduino IDE
- Go to File -> Examples -> Firmata -> StandardFirmata
- Upload Firmata to your Arduino board