Overview

Skill Level: Beginner

IBM IoT Connection Service allows to bundle preselected services to form public, multitenant SaaS solution. The first part of the article is available at https://developer.ibm.com/recipes/tutorials/ibm-iot-connection-service-watson-iot-platform-part-1/

Ingredients

IBM IoT Connection Service SaaS Instance

Step-by-step

  1. Navigate to Sample Application

    • Leave the IoTP open in a separate tab and navigate back to the tab with the IoTCS dashboard.
    • Open the sample application by clicking on the route URL.

    Navigate_to_Sample_App-1

  2. Create a Dishwasher Device

    • You can use the sample application to create simulated washer devices.
    • Scroll to the bottom of the page and click the “+” button to create a new simulated washer.
    • The new washer will appear in your list of washers.
    • The sample app will also use the IoTP APIs to register the device with the platform.

     

    Create_a_dishwasher_device-1

  3. Run a Simulation

    From the simulated washer view, click the Start button on the washer to begin a cycle.

    Run_a_simulator-1

  4. Using Node-RED with the Sample App

    • The sample application also allows you to use Node-RED and comes with some handy examples.
    • Open a new tab in your browser and use the following URL to access Node-RED: https://<your sample app>/red
    • For example: https://csna3-starter.mybluemix.net/red

    Node_red_sample_app-1

  5. Rules

    • In order to invoke the flow on the “Trigger notifications” tab, we need to create a rule in IoTP that fires off the flow when certain
    conditions are met.
    • The IoTCS creates an example rule for us to use.
    • Back in the IoTP, navigate to the “Rules” tab and click on the “IoT for Electronics notification rule” to open it up.
    • After examining the conditions of the rule, click on the Trigger IoT4E Notification action to open it up.

    Rules-1

  6. Actions

    • Click on the pencil icon to edit the action and then click the Next button.
    • In the Edit Action “Configure” tab you need to make a slight modification to the URL in order to match the URL of your Node-RED
    flow. The URL should be the following format: https://<sample app route>/rti-alert
    • For example: https://csna3-starter.mybluemix.net/rti-alert
    • Click Finish button when complete.

    Actions-1

  7. Trigger Node-RED flow

    • Now when completing a cycle or injecting a fault using the sample app, you should see information in the debug output tab.
    • **Note** : At the time of creation of these materials, the flow created automatically by IoTCS does not completely work due to
    incorrect settings of Registration service credentials.

    Trigger_Node_Red_Flow-1

  8. Cloudant NoSQL db - Navigation

    • Back in the IoTCS dashboard, click on the “View Details” link of the Cloudant NoSQL DB service.
    • Copy the password and then click the “Launch” button to open the Cloudant web UI in a separate tab.
    • When prompted for the password, paste in the password copied from the view details dialog.
    • Lastly, click the “Sign in” button.

    Navigating_to_Cloudant-1

  9. Cloudant WebUI

    • You should now see the Cloudant web UI.
    • Click on the database tab to see all the databases created thus far.

    Cloudant_web_ui-1

  10. Using the Example Cloudant Node-RED Flow

    • If you want to test out querying the Cloudant DB for data, check out the “Display historical data” flow in your Node-RED sample
    application.
    • Follow the instructions in the notes for each step.

    Example_Cloudant_Node_Red_Flow-1

  11. DB2 Warehouse on Cloud - Navigation

    • Back in the IoTCS dashboard, click on the “View Details” link of the DB2 Warehouse on Cloud service.
    • Copy the Username and then click the “Launch” button to open the DB2 web UI in a separate tab.
    • When prompted for the username, paste in the username copied from the view details dialog. Then do the same for the password.
    • Lastly, click the “Sign in” button.

    DB2_ware_house_on_cloud-1

  12. DB2 Web UI

    • You should now see the DB2 web UI.
    • Click on the “Explore” tab to see the schema and database tables created thus far.

    db2_web_ui-1

  13. Browsing Cloud Object Storage

    • Unlike Cloudant and DB2 there is no web UI to launch for the Cloud Object Storage service.
    • The details for the service give you everything you need to connect using APIs from your code.
    • However, if we want to be able to browse the storage like a file explorer, we need a tool that can view S3.
    • There are a number of free options available to download. This exercise will use Cyberduck.
    • Go to the following URL to download and then install Cyberduck: https://cyberduck.io/

    Cyberduck_cloud_object_storage-1

  14. Create Cyberduck Connection

    • Once Cyberduck is installed, launch it and create a new connection using the information supplied in the “View Details” of the
    Cloud Object Storage service.

    Create_cyberduck_connection-1

  15. Browse and download buckets

    • You should now be able to view all of the buckets in the S3 storage.
    • The IoTCS automatically creates a bucket for each day’s worth of device data and stores up to a year’s worth of device data by
    default.
    • This data can be mined by data scientist using tools such as Watson Data Science Experience (DSX) or SPSS Modeler.

    browse_buckets-1

  16. IoT Registration Service

    • Use the IoT Registration Service to add device consumers and pair the consumers with registered devices. For example, you can
    pair a washing machine with a manufacturer and an end user.
    • Click the “View Details” of the service to get the credentials needed to use the API.
    • Documentation for the API can be found here: https://broker-ussiot4e.
    electronics.internetofthings.ibmcloud.com/public/iot4eregistrationapi.html
    • Use the “Registration” tab in the IoTP service to view any existing pairings.

    IOT_Registration_Service-1

  17. Message Hub Service

    • Message Hub is a scalable, high-throughput message bus that allows you to wire micro-services together by using open protocols.
    • Connect stream data to analytics to realize powerful insights. Feed event data to multiple applications to react in real time. Bridge
    to your on-premise messaging infrastructure to create a hybrid cloud messaging solution.
    • Click the “View Details” of the service to get the credentials needed to use the API.
    • Documentation for the APIs can be found here: https://console.bluemix.net/docs/services/MessageHub/index.html#messagehub

    Message_Hub_Service-1

     

  18. Secure Gateway Service

    • Secure Gateway is a secure way to access your on-premises or cloud data from your IBM Cloud application by using a secure
    passage.
    • Customers need to contact the IoTCS support team in order to configure the service.
    • Documentation about the service can be found here:
    https://console.bluemix.net/docs/services/SecureGateway/secure_gateway.html

    Secure_Gateway_Service-1

     

  19. Single Sign On

    Single Sign On is a policy-based authentication service that you can use to embed the single sign-on capability for your Node.js or Liberty for Java applications.
    • You will not find the Single Sign On service in the IoTCS dashboard.
    • Customers need to contact the IoTCS support team in order to configure the service.
    • Documentation about the service can be found here: https://console.bluemix.net/docs/services/SingleSignOn/index.html

  20. Co-author of this recipe

    Surbhi Agarwal (surbhi_agarwal@in.ibm.com) is IoT Solution Architect and co-author of this recipe.

Join The Discussion