The Watson IoT Platform provides powerful application access to IoT devices and collects data to help you rapidly compose analytics applications, visualization dashboards, and mobile IoT apps. Journey Develop an IoT app with Node-RED and Watson illustrates these technologies for you.

In the journey, you’ll access Bluemix and start a IoT Platform runtime. This service is a package that includes Node-Red run as Node.js, Cloudant, and an IoT platform. If you already have a service instance running, make sure you use the correct service name and Bluemix space before you proceed through the journey. Or you can simply click on the deploy button in the repo to automatically create the instance with all the services for you. You can copy and paste the Node-Red workflow in the editor.

Our Node-Red application uses an UI and an emulator that represents an actual device. This emulator communicates (MQTT messaging) with the IoT service the same way as an actual device. In the journey, the IoT is a motor. From the UI, you can start and stop the motor and adjust its speed.

In an actual device, the device ID is typically the device MAC address. In the emulator, you are using motor1 as the device ID. You can use a different device ID or Type.

In Node-Red, double-click the ibmiot input node in the work area. Change the values of the form to the following:

  • Authentication : Bluemix Service
  • Input Type : Device Event
  • Device Type : All
  • Device Id : All
  • Event : eventData
  • Format : json
  • Name :

If you double-click the ibmiot output node in the work area, change the values of the form to the following:

  • Authentication : Bluemix Service
  • Output Type : Device Event
  • Device Type : simulate-iot
  • Device Id : xxx
  • Event Type : eventData
  • Format : json
  • Data : {}
  • Name :

In Node-Red our publishing topic is “iot-2/evt/eventData/fmt/json” and the subscribing topic is “iot-2/evt/+/fmt/json”. You can launch the IoT platform dashboard and monitor the motor’s behavior. You set up a card in Device-Centric Analytics to read the speed event d.speed in real-time.

As part of this journey, you’ll:
  • Build and deploy a simulated device sample.
  • Create and deploy a Watson IoT Platform organization.
  • Connect the simulated motor device to the Watson IoT Platform.
  • Monitor and visualize device data by using the Watson IoT Platform dashboards.
  • Receive the data events in JSON from a Cloudant database displayed on the web page.
 
   {
      "d":{
        "id":"motor1",
        "ts":1507477920588,
        "ay":1.424,
        "running":true,
        "rpm":1.5,
        "speed":"1",
        "timestamp":"Sun, 08 Oct 2017 15:52:00 GMT",
        "msgCount":1
      }
    }
For detailed instructions, visit our project at: README.md

Join The Discussion

Your email address will not be published. Required fields are marked *