Community

Control home devices with Bluemix Internet of Things (Part 3)

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.

Install Pre-req’s

The app needs Node.js to run. Let’s go ahead and install Node.

wget http://node-arm.herokuapp.com/node_latest_armhf.deb 
sudo dpkg -i node_latest_armhf.deb

Get source code and install dependencies

git clone blah
cd blah
npm install
node lib/client.js

Add Comment
No Comments

Leave a Reply

Your email address will not be published.Required fields are marked *

More How-tos Stories

Ransomware’s Protection Winner, Zerto, on IBM Cloud for VMware Solutions

Zerto, IBM Cloud for VMware Solutions’ Disaster Recovery solution, has won the prestigious award of being the Ransomware Protection Company of Year at the 2017 Storage Awards!

Continue reading

IBM Container Service Makes Docker Production-Ready

Recent offerings in the container space sparked a lot of buzz about Docker, Kubernetes, and ISTIO. Where does IBM stand in all of this? Let’s take a closer look… IBM Bluemix Container Service builds on open source technology to provide production-ready security, life-long node management, and accelerated innovation for multi-container apps. You can move enterprise-grade […]

Continue reading

Expose Auth0-enabled OpenWhisk actions with API Connect

Serverless computing platforms give developers a rapid way to build APIs without servers. OpenWhisk supports automatic generation of REST API for actions exposed by API Gateway. When the capabilities provided by the API Gateway do not cover all usecases you have for an API - such as publishing it in a developer portal or performing advanced mapping, transformation, validation, you can migrate to the API Connect service.

Continue reading