March 2, 2015 | Written by: Jeff Sloyer
Categorized: Community | How-tos
Share this post:
Part 3: Bluemix app to control the Raspberry Pi
This is a continuation of the series on Controlling home devices with Bluemix Internet Of Things If you haven’t read Part 1, Part 2, please do that first…
In Part 1 we got the electrical work out of the way. We wired up the relay’s and connected the circuit’s.
In Part 2 we installed some libraries on our Raspberry Pi to control the lights.
In this part of the 3 part series we close the loop and allow our users to interact with the Christmas Lights.
So without delay let’s jump into the next part.
Install the IoT library on your Pi
We will be using the IoT (Internet of Things) service in Bluemix to do this.
First thing we need to install some pre-req’s on our Raspberry Pi.
<span>#Download the installer from GitHub</span><br />cd /tmp/<br />curl -LO https://github.com/ibm-messaging/iot-raspberrypi/releases/download/1.0.2/iot_1.0-1_armhf.deb<br /><br />#<span>Install the package with</span><br /><span>sudo dpkg -i iot_1.0-1_armhf.deb</span><br /><br />
Ok so the Raspberry Pi is basically done, there is one more step but we will come back to that in a bit. Let’s focus on the Bluemix App.
Walkthrough of the app
The app consists of a Node.js backend using Twilio (for texing/sms interactions) and the IoT service in Bluemix for communicating with the Raspberry Pi. The front-end of the app is built using JQuery, Bootstrap, Angular.JS, and websockets (Socket.IO) for real-time communication with the backend for voting.
The app needs Node.js to run. Let’s go ahead and install Node.
sudo dpkg -i node_latest_armhf.deb
Get source code and install dependencies
git clone blah