Controlling lights and sensors with Arduino Yún, Node js server and firmata
Arduino user DavidMJBos sent us a project using Node js server on the Arduino Yún to control the lights, heating and some other sensors in the office of Appsaloon, the company where he’s doing an internship.
They already use Node.js for a lot of things and some of them are pretty cool with it.
That’s how they did it:
First of all you need to expand your flash, because there is not enough flash (16 MB) on the Arduino Yún. Sounds reasonable right? Not when you got the Yún for the first time in your hands. Luckily someone wrote this tutorial.
To start with you need to be on the same network to reach the Arduino :-).
Open your terminalssh firstname.lastname@example.org
It will ask for a password, which will by default be: ‘arduino’:
Now you can install Node.js on the Yún type :opkg update opkg install node
When the install is finished verify it by :node -v
It should give you something like this v0.10.28 (it may vary in the future)
Next you have to install the node-serialport package. This is necessary because the Atheros AR9331 needs to communicate with the ATmega32u4.opkg update opkg install node-serialport
After this you will need firmata for Node.js. This will control the inputs and outputs of the ATmega32u4.
Normally you would install firmata like this:npm install firmata
But because the Arduino Yún does not have enough RAM this is ‘not possible’.