Step 1: Installation and Setup
- Arduino Uno board
- VirtualBox running Lubuntu 15.0 64bit
- Lubuntu running node js and johnny-five (install both nodejs and node-js legacy for this to work). Run the two commands below:
- sudo apt-get install nodejs nodejs-legacy
- sudo npm install johnny-five
Reason I used virtual box is because I am more comfortable with Linux and I just find it easier to setup and debug hardware issues on Linux. Technically, you should be able to run this on windows too.
After installing the node related software, its time to setup your Arduino. To do so, install the StandardFirmata sketch on your Arduino. Follow the steps below to get that done.
- (optional if you are using virtualbox) If you are running the software on a VM, then the first thing to do after you connect your arduino to your computer, is to pass the USB-Serial device to VirtualBox. Look at the picture to see that.
- Open arduino gui. If this is the first time you have installed arduino, it will ask your usename to be added to dialout group to be able to use the USB-Serial convertor without root permissions every time. Windows users should not face this problem.
- If you have not added your username to "dialout" group then please do so.
- Open "StandardFirmata" sketch (Examples->Firmata->StandardFirmata"), select your board and the port (/dev/ttyUSB0 by default).
- Upload the sketch. Then open serial monitor. Set the speed to 57600 baud. You should see the message "standardfimata.ino" on the screen. Your setup is complete.
Step 2: Voila!
Copy the bmp085.js file to a working directory. Go there and run
Node will connect to Arduino and start getting sensor data.
Type CTRL-C two times to exit the script.
Good luck! Give it a shot if you already have a board. I was amazed that johnny-five connects to so many devices. Check out their API here. http://johnny-five.io/api/
So where can we go from here. For one, the whole thing can be shrunk down to run on $5 Raspberry Pi Zero. With that, you can even skip Arduino if you want since johnny five supports RPI. Then data collected from sensors can be sent to a webserver to be plotted in realtime. This is my first step to series of steps! Add me to your favorites to see how I progress..
We have a be nice policy.
Please be positive and constructive.