Overview

Skill Level: Any Skill Level

This application uses the Watson IoT Device Simulator nodes in Node-RED to simulate some of the data that is possible from a TI Sensor Tag device.

Ingredients

Note that since this Recipe was created, IBM Watson IoT Platform has updated it's default security for incoming connections, making them to be via TLS. Thus ensuring that only secure connections shall be allowed to the platform from the incoming requests from any Devices/Gateways and Applications.

Before using this recipe, review the documentation mentioned in the Watson IoT Platform Blog

Step-by-step

  1. Deploy the Application

    Click the button to deploy the sample application:

    Bluemix button

  2. Examine and Modify the Flows

    The flows have been built in a very simple, easy to understand way that should allow for easy extension.

    There are two flows – SimulatedSensorTag and SensorTag.

    Simulated Sensor Tag

    This flow is a simple example that demonstrates how to use the Watson IoT Device Simulator nodes to:

    • Create Device Types and Devices on Watson IoT Platform
    • Create Simulated Device Instances, change their data values and have them send events with those values into the platform

    The Device Type created is “SimulatedSensorTag” and the flow allows the creation of two simulated devices ‘Room1’ and ‘Room2’

    Everything is done manually using inject nodes on the flow. Press the inject buttons to create device types and devices in the platform – and then create a simulated device and have it send an event into the platform.

    Sensor Tag

    This flow simulates a real Sensor Tag – the Device Type created is “SensorTag” and a UI is provided to allow the creation of a Simulated Sensor tag. In this sample only the objectTemp and light values are simulated – but the flow could easily be extended to simulate other sensor values. The actual values sent into the IoT Platform can be randomly generated or manually set using the UI. With the exception of creating the Sensor Tag device type which is done on the flow, everything is done on the UI.

    Note that the flow allows for the data to be sent using the Watson IoT node – which acts as a Device and will therefore need to be configured with the Platform credentials – or using the ibmiot node which represents an application sending the data on behalf of a device and therefore does not require credentials.

    Edit the Configuration Nodes (Menu > Configuration nodes)

    Edit the Device ST1 configuration node:

    Node-RED___iot-bb-simulator-al0505_mybluemix_net_-_Mozilla_Firefox__IBM_Edition

    In the Organization field, type the organization id of your Watson IoT Platform (see below if you do not know how to find this)

    In the Auth Token field, type 12345678

    Tip: If you want to use a different token you can but you must modify the Add Devce ID nodes for ‘Create Device’ and ‘Delete Device’ as these currently use 12345678

    Tutorials_Archive_-_developerWorks_Recipes_-_Mozilla_Firefox__IBM_Edition

    TIP: You can find the organization id by opening your Watson IoT Platform service dashboard:

    OrgID

     

    Click Update

    Click Deploy

    Click Create Sensor Tag Type:

    Create-Device-Type

     Create-Device-Instance

  3. Examine and use the UI

    The UI is available at yourAppURI/ui

    Node-RED_Dashboard_-_Mozilla_Firefox__IBM_Edition

    In the Device Management section, type ST1 into the Device Name field (you can use any name you like but the device name in Watson IoT node must be the same – on deployment that node is set to ‘ST1’).

    Click Create Device

    Create-Device-in-UI

    Click Create Device Instance

    Click Random Values

    Click Send to Cloud

    Create-Device-Instance

    View data coming into Watson IoT Platform:

    Connected-Device

    IoT-Data

Join The Discussion