This tutorial demonstrates how to connect a simulated device to the Watson IoT platform, vizualise its live data, store its data into a database and leverage Node-RED tool for wiring together hardware devices, APIs and online services.
- You will collect sensor data from a Watson IOT service.
- You will simulate a temperature sensor.
- You will discover how to leverage Node-RED to connect IoT.
- You will store the collected data into a NoSQL database.
- You will use Watson to translate messages.
- An IBM Cloud account
- Start the Simulated device
- View the live sensor data
- Connect your device to the Watson IOT Platform
- Use Node-RED to read the sensor data
- Store the device data into a No SQL database
- Translate messages with Watson
We will use a simulator of a temperature sensor. This sensor also simulates Humidity and Object Temperature.
This way, we don't require an actual hardware device to test our application.
-
In a new browser window or on a smartphone, browse to IOT Sensor.
Alternatively, enter this short URL: http://ibm.biz/iotsensor -
Note the Device Id (displayed in the top right corner).
-
In a new browser window, browse to Watson IOT Platform quickstart.
Alternatively, enter this short URL: http://ibm.biz/iotquickstart -
Enter the device id.
-
Vizualise the live sensor data.
You've seen my data, what next? Now you will use your device in an application created with IBM Cloud.
-
Create an app using Internet of Things Platform Starter from the category Starter Kits in the Catalog.
-
Provide the application name, modify the host name, if required, and click Create.
Note: Wait for a few minutes for your app to start running. -
When your app is running, select the app URL or type it into the browser to open the Node-RED flow editor
https://<appname>.mybluemix.net
-
You see a ready-made flow that can process temperature readings from a simulated device.
-
In the Node-RED workspace, double-click the IBM IoT App In node to open the configuration dialog.
-
In the Authentication type field, select Quickstart from the pull-down list. Enter the Device ID field and click OK.
Make sure that the device id is entered in lowercase, and that there are no leading or trailing space characters. -
Look for the Deploy button in the upper right hand corner of your Node-RED workspace. The deploy button is now red; click it to deploy your flow.
-
Open the debug pane on the right. You will see that the flow is generating Temperature Status messages.
-
Increase the temperature value on the simulator to see the messages change in the debug pane.
Note that a different message appears if the temperature exceeds 40 degrees.
-
In Node-RED flow editor, add a Cloudant out node
-
In the Service type field, select the name of Cloudant service bound to Node.js runtime from the pull-down list.
Enter a dabatase name in lowercase. Keep the default operation insert and finally give a name to the node.
- Deploy the flow. Return to the IBM Cloud Console, go to the Cloudant console and navigate into the records.
The warning messages generated in Node-RED uses English by default. You may want to translate those messages into your oww language.
-
In IBM Cloud Console, create a new service Language Translator to your app.
-
From the Dashboard, open your app using Internet of Things Platform Starter and connect this new service Language Translator to your app.
-
In Node-RED flow editor, insert a new Language Translator node into the existing flow.
-
Modify the flow accordingly to translate those messages.
-
Deploy the updated flow.
-
Observe the translated output based on the selected language.
For additional resources pay close attention to the following: