Introduction: Connect Raspberry Pi As a Device to IBM Watson IoT

Connect the Raspberry Pi device to the IBM Watson IoT Platform, making use of the easy wiring approach of Node-RED.

Step 1: Overview

This Instructable describes steps on how one can register the Raspberry Pi device on to the Watson IoT Platform and then make use of the Node-RED editor, to capture the Temperature of the device and publish it on to the Watson IoT Platform Dashboard. Once the device data is available on the WIoTP Dashboard, it opens up to a variety of possibilities, be it analytics, device management, gateway management, firmware maintenance, etc.

Step 2: H/w & S/w Requirements

Software:

  • Bluemix Account
  • Raspbian Jessie ( or higher version )

Hardware:

  • Raspberry Pi Model B/ Model B+/ 2
  • Minimim 8GB SD card

Step 3: Prepare the Environment

Set up the latest Raspbian Jessie on the Raspberry Pi device.

Upgrade the setup and have the Node-RED installed on it, as follows:

sudo apt-get update

sudo apt-get install nodered

Start the Node-RED service, using

node-red-start

Step 4: Register the Device to Watson IoT Platform

Carry out the steps present in this IBM Watson IoT Recipe (Tutorial) to register your device(s) in IBM Watson Internet of Things Platform.

Step 5: Sending Device Events to Watson IoT Platform [Quick Start]

In the Node-RED editor, which you have opened in the browser (either on Raspberry Pi or on the host system), click on

Menu – > Import -> Clipboard

Copy the JSON from this link, paste it in the clip board and click on Ok button to place the flow in the work place.

Update the WIoTP Node with the Device credentials and click on deploy button to deploy the flow.


The CPU temperature from the Raspberry Pi is sent to the Watson IoT Platform once every 5 seconds. The messages on the Debug console can also be verified.

Step 6: Receiving Device Commands From Watson IoT Platform

In the Node-RED editor, which you have opened in the browser (either on Raspberry Pi or on the host system), click on

Menu-> Import – >Clipboard.

Copy the JSON from this link and paste it in that clip board. Click on Ok button then place the flow in the work place. Double click on WIoTP IN (cmd receiver) node and update it with the Device credentials.

Click on Deploy button, to deploy the flow.

Make use of an custom built external application that can be used to send commands to this Raspberry Pi Device.

Step 7: Conclusion

The complete Watson IoT Recipe ( Tutorial ) " Connecting Raspberry Pi as a Device to Watson IoT using Node-RED " is made available on the Watson IoT Recipes site, with details on step by step process along with snap shots ( screen shots ) to help assist the developer and technical enthusiasts, to quickly connect the Raspberry Pi device to IBM Watson IoT Platform. Having the device data on the IBM Cloud opens up numerous options and possibilities to play around.