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

IBM Cloud Containers Service - Core Dev Lead

More stories

How to deliver great performance for global apps on IBM Cloud

A large telecommunications service provider in Europe wants to serve customers in Brazil from their Frankfurt, Germany location. One challenge with such large geographical distances is achieving consistently low latency in order to provide a good user experience. Another challenge is scaling the infrastructure to handle a large number of user requests during peak traffic conditions.

Continue reading

Securing your Python app with OpenID Connect (OIDC)

Some weeks back I introduced to a tutorial on how to analyse GitHub traffic. The tutorial combines serverless technology and Cloud Foundry to automatically retrieve statistics and store them in Db2. The data can then be accessed and analyzed using a Python Flask app. Today, I am going to show you how the web site is protected using OpenID Connect and IBM Cloud App ID.

Continue reading

Pod security policies in IBM Cloud Kubernetes Service

You can now use Kubernetes pod security policies in your IBM Cloud Kubernetes Service clusters. These policies enable the cluster administrator to configure who is authorized to create and update pods. For many cluster administrators, this is an important security feature to leverage.

Continue reading