IBM WATSON IoT (2): CONNECTING A RASPBERRY PI AS A REGISTERED DEVICE WITH NODE-RED
- Layout for this exercise:
* To complete this exercise it is assumed the previous existence of an account on the IBM Bluemix platform
* This exercise is based in the previous exercise flow:
1 - Creating an IBM Watson IoT Platform organization
- In this exercise, and unlike the previous one with Quickstart, the Raspberry Pi connects to the IoT platform providing credentials and registration of the device.
- Creating a private organization space that requires authentication and registration for all devices and applications to use in that organization. - Each organization is defined by a 6-character ID, as we will see in short.
- The first step consists of the login process into the IBM Bluemix account. Let's notice that IBM Watson IoT is a service provided by the IBM Bluemix cloud platform:
- Going to the Internet of Things Platform:
- Creating an IBM Watson IoT service:
- Clicking Launch:
- Entering the IBM Watson organization space:
2 - Creating a Device Type
- Devices connected to the IBM Watson IoT Platform are associated with a Device Type, what are intended to be groups of devices sharing common characteristics.
- Going to Devices:
- Browse and Create Type:
- Creating a "device type" (be careful not confusing with "gateway type"):
- Entering Name and Description:
- Defining the template is optional. In this case Manufacturer and Model are defined:
- Metadata is optional:
3 - Adding and registering a device to the the IBM Watson IoT Platform
- Choosing the Device Type:
- The Security step allows to enter an optional token, or otherwise it can be auto generated.
- In this case we choose an authentication token auto generated by the service, what will be displayed and the end of the registration process:
- Adding the device RBP_1:
- After adding the device the auto generated Device Credentials are displayed. It is important to write down all this information because in case of loss there is no possible recovery:
- Clicking the X, the Security step is ended:
4 - Generating API Keys
- Some API Keys must be generated to enable the connectivity. Going to Apps, clicking Generate API Key:
- API Keys are generated to allow the connection:
5 - Connecting the Raspberry Pi as a registered Device
- At this point a device RBP_1 has been created, added and registered to the IBM Watson IoT platform, and also some API Keys for enabling the connectivity have been generated.
- To connect the Raspberry Pi device (in this case as Registered) according to the previous exercise flow:
- The Watson IoT node must be edited as Registered:
- Clicking the Credentials icon:
- Entering the credentials (Organization ID, Device Type, Device ID, Authentication Token) obtained at point 2 of this exercise:
- Eventually the connection is achieved:
6 - Receiving data from the Raspberry Pi device at the Watson IoT platform
- Now the RBP_1 is connected:
- The Connection Log shows the sucssessfull connection:
- Events are generated every 5 seconds, displaying the last received CPU temperature from the RBP_1 device: