Connecting Raspberry Pi to Skynet to control LEDs #IoT

Step-by-step guide to quickly configuring RPi with Node.JS, WiFi, and Auto login/start & SKYNET.im


To date, I have been experimenting with connecting Arduinos to SkyNet using Node.JS and Johnny-Five (J5) for controlling my Internet of Things. Arduinos are simple and awesome but require a Node.JS-powered microprocessor to use J5 for controlling it.

After doing a little research on GitHub, I found several NodeJS NPM modules for controlling LEDs and sensors directly from the Raspberry Pi’s GPIO pins. For this example, I decided to use Fivdi’s onoff NPM module.

Here’s a video: http://youtu.be/4w2gnt_5A4g

Here’s a quick step-by-step guide to getting your Raspberry Pi up and running with Node.JS, WiFi connectivity, and connected to SkyNet!

  1. Download and install Google Coder for RPi
    http://googlecreativelab.github.io/coder/

username: pi and password: raspberry

2. Enabling the Wi-Fi Dongle via the Terminal (http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/)
sudo nano /etc/network/interfaces
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
sudo reboot

If you have an internet connection, your Raspberry Pi should now say, “My IP address is 10.0.1.x”. Now you can SSH into the Pi using your own terminal via ssh pi@10.0.1.x

3. Installing Node.JS (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=34&t=24130)
wget http://nodejs.org/dist/v0.10.21/node-v0.10.21-linux-arm-pi.tar.gz
tar xvfz node-v0.10.21-linux-arm-pi.tar.gz
cd node-v0.10.21-linux-arm-pi
sudo cp -R * /usr/local/

node -v
=> v0.10.21

4. Download, configure, and run Skynet demo
wget https://raw.github.com/skynetim/examples/master/piled.js
npm install skynet
npm install onoff

sudo node piled.js
=> Connected to Skynet

5. Auto Login (http://elinux.org/RPi_Debian_Auto_Login)
sudo nano /etc/inittab
#1:2345:respawn:/sbin/getty 115200 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

6. Auto start skynet app (http://elinux.org/RPi_Debian_Auto_Login)
sudo nano /etc/rc.local
su -l pi -c “sudo node /home/pi/piled.js”

Email me when Chris Matthieu publishes or recommends stories