AIM: To develop a smart home automation using Raspberry-Pi and IBM Watson
- IBM Bluemix Account
- RASPBERRY-PI (3B)(WITH ETHERNET CABLE OR WIFI CONNECTED)
- USB MOUSE
- USB KEYBOARD
- VGA TO HDMI CABLE
- A MONITOR
Step-1: Creating Internet of Things Platform Starter service in IBM Watson:
- Firstly, login into your IBM-Bluemix account with your e-mail ID and Password.
- Click on catalog on your dashboard screen .Under Boiler Plates Click on Internet of Things Platform Service.
- Give a name for your service and it will created with minutes. Then go to dashboard under service you will have your IOT Platform service created along with Cloudant NOSQL DB also created.
Step-2: Create a device in IBM Watson:
- After getting into your service click on Launch
- Then you get into IBM Watson Platform .Then click on Devices
- When you get into Devices you find a button called +Add Device click on it.
- Then you get a window where you should click on Create Device Type.
- Then you will get an another window asking whether to create a device type or gateway type. Click on “Create a Device Type”
- Then give a name and Description for your device (any name and description can be given) and then click on Next
- Then another Window appears just click on Next
- Click on Next for the above window
- Click on Next for the above window
- Click on Create at the bottom when the above window appears.
- Then click on Next when the above window appears.
- Give your Raspberry-Pi’s IP Address as Device ID for unique identification
- Click next when the above window appears.
- Again click on Next when the above window appears.
- Then click on Add when the above window appears.
- Then you get your device Credentials which you can use later. Copy them and paste them in a notepad for future uses.
STEP-3: INSTALLING NECESSARY PACKAGES ON YOUR PI:
- Now we are going to install necessary packages on your pi.
- Open your terminal in your pi and type the following commands
- curl -LO https://github.com/ibm-messaging/iot-raspberrypi/releases/download/188.8.131.52/iot_1.0-2_armhf.deb
- sudo dpkg -i iot_1.0-2_armhf.deb
- service iot status
- Following are the images as to what appears on your pi’s terminal when u type these commands:
- Then open your terminal and type pip install ibmiotf
STEP-4: Creating a Node RED FLOW for your smart home Automation Application:
- Go to Dashboard on your IBM Bluemix page and under app you will find your node red application double click on it and click on Launch.
- You will get the node red page on your give username and password (mostly same as your IBM Bluemix’s login Id and Password).
- Then you will get a new node red flow window.
- Firstly we will be needing some UI (some kind of Buttons ) to control your appliances.
- So, firstly click on the dropdown beside Deploy you will get the following options among them click on Manage Palette.
- Then for getting all the button nodes for UI type node-red-dashboard on your install tab as shown below and click on install
- After the installation is complete if scroll down you can find your installed nodes in the dashboard section as shown below:
- Click on button and drag out 6 such buttons with the following for each button
- Then take out the mqtt node and configure it as follows and write a topic name according to the topic that you have specified in your code to subscribe to.
- Then bring out an IBM IOT Output node, Device Id and Device type should be same as the one obtained after creation of device.
- To get to know the output coming out of Mosquitto Broker even include a debug node at the end with following configuration.
- Your Final Node red Flow will look as shown below:
- TO have a look at the UI with your buttons copy the url till mybluemix.net and then /UI .
- You can see your UI as shown below:
- Then run your respective code on your Pi with your credentials you obtained at the beginning and then by clicking on the buttons in UI you can control the respective pin assigned to each button in your code.
Conclusion: Hence, we were able to make Smart Home Application using RPI and IBM Watson