Node-RED on Raspberry Pi

Assembling instructions from here and here, this is how I installed Node-RED on my Raspberry Pi to support my electric meter reading experiments:

wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
wget https://github.com/node-red/node-red/archive/0.9.1.zip
unzip 0.9.1.zip
mv node-red-0.9.1 node-red
cd node-red/
npm install --production

That last step takes a while – be patients and it should finish in 5 to 10 minutes, and it may look like nothing is happening.

Now install the serialport and Sqlite nodes for Node-RED:

npm install serialport
npm install node-red-node-sqlite

To disable login-by-serial-port, which appears to interfere with the ability of Node-RED to read serial devices, edit the /etc/inittab file and comment out the line:

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

When this is complete, Node-RED should be installed. To have it start on Raspberry Pi bootup automatically:

wget https://gist.github.com/Belphemur/cf91100f81f2b37b3e94/download -O node-red-init.tar.gz
tar -xzvf node-red-init.tar.gz
sudo mv gistcf91100f81f2b37b3e94-f6cd047768778b48b25dd66c68fdcbb68ec15465/node-red /etc/init.d/node-red
sudo chmod +x /etc/init.d/node-red
sudo update-rc.d node-red defaults

To start Node-RED right now:

sudo service node-red start

You should now be able to see Node-RED from a browser at http://hostname-or-ip-address:1880/

Another useful step, cleaned from here, is to disable wireless drop-outs:

sudo nano /etc/modprobe.d/8192cu.conf

and paste in:

# Disable power saving 
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

This should make wifi much more stable.