Skill Level: Beginner


In this recipe, the IBM Watson™ IoT Platform cloud analytics, in the Bluemix, is used to demonstrate the analysis of mobile data that is being sent to the IBM Watson IoT Platform Connect.


  • IBM Bluemix account with IBM Watson IoT Platform
  • Smart phone connected to the Internet


  1. Deploy IoT-Phone application to Bluemix

    The IoT Recipe makes use of the Create Toolchain button to help deploy the necessary services on to Bluemix. You can take a look at the source code, made available under the Github Repository over here, to get to know on what is happening in the backend.

    Click on the Create Toolchain button provided below, provide a Custom Name to your application and choose to click on Create button, to quickly deploy the Watson IoT Platform, Node-RED application and Cloudant NoSQL DB, as part of the Bluemix starter app.


    Note: If you are a User using the United Kingdom Region in your Bluemix environment, then please make use of the steps mentioned in the IoT Recipe Deploy Internet of Things Platform Starter service on Bluemix to deploy the setup. Alternatively, you can also try using the Deploy to Bluemix button, to deploy the setup under your United Kingdom Region, provided your Jazzhub account is validated. Users of US South Region can ignore this step.


    Post successful deployment, you shall have all three of the above mentioned services, up & running in your Bluemix environment.

    Open the Bluemix Dashboard and click on the Application service that you have currently deployed. You should see the Watson IoT Platform listed under the Connections. Click on the WIoTP service and choose the click on Launch button to launch the WIoTP Dashboard.

  2. Connect smartphone to Watson IoT Platform

    • Open the Bluemix dashboard in a browser.
    • Locate the IoT-Phone application under applications.app-name01
    • Go to your smartphone and enter the URL shown on the Routes in the application. Start the location service in your smart phone. Ensure that the mobile device does not get locked or goes in a disconnected state. This completes the activity to be done on the mobile.
    • In the smartphone you would be prompted to enter a device Id. Enter any unique 8 alphanumeric characters for the device Id. Select Connect on your smartphone and your phone is now an IoT Device.51
    • In case the smart phone asks for location to be shared, select yes.
    • Open the Bluemix dashboard in your system browser and find the Internet of Things service (which could be named as iot-phone-iotf-service.iotf-service
    • On Watson IoT Platform Dashboard, select Devices to see the IoT devices connected. The connected device has an image of 3 rectangle bars of increasing height (similar to the signal strength seen in some mobile handsets) as shown below. You should see your smartphone connected and sending data.snap_1
    • You can view the device events by hovering the mouse over the connected device and clicking on it.
  3. Create Schema

    To use Watson™ IoT Platform features such as rules and actions, you must create a schema to map device properties to user-friendly properties names, set the data units for the properties, and specify a message type to use with the schema. Refer here for more information on creating device type schemas: https://console.ng.bluemix.net/docs/services/IoT/im_schemas.html

    • Click on Manage Schemas tab and then click on Create a Schema as shown below.snap-2
    • This will open up Add Schema page. Select Device Type and click Next as shown below.snap-3
    • Click on Add Property. This opens up the add property page. Here selection is done from Connected tab and all properties are selected as shown below.


    • Click OK and click Finish to complete creation of adding properties.
  4. Create an Action

    With Watson™ IoT Platform cloud analytics, you can specify rule conditions that are based on real-time device data and that trigger alerts and optional actions when met. Rules are condition-based decision points that match real-time device data with predefined threshold values or other property data to trigger an alert if a condition is met.

    In addition to the alert that is displayed in the Watson™ IoT Platform dashboard, you can add one or more actions, such as sending emails and posting webhooks when a rule is triggered. Refer here for more information on creating the actions: https://console.ng.bluemix.net/docs/services/IoT/cloud_analytics.html#shared

    One can create actions directly in the rule editor or create the actions in the Actions tab and then select the actions when you create your rules. In this step, we will show how to create an action that can be associated to the rule later.

    • Click on the Rules and select Actions on the dashboard.snap-8
    • Click on the Create An Action button on the right corner of the screen.
    • This will open up the Create New Action page as shown below.snap-9
    • Fill the actions page and Configure the action as per the requirement and click Finish.
    • You will see new Action created under Rule Actions.

    For creating various actions refer this recipe: https://developer.ibm.com/recipes/tutorials/perform-actions-in-ibm-watson-iot-platform-cloud-analytics/

  5. Create Rules

    In this step we will create a simple condition based rule and associate it the email action that we created earlier.

    • Click on the Rules and select Browse on the dashboard.rule
    • Click on the Create Cloud Rule on the right corner of the page.
    • Fill the details for the Cloud Rule and Click Next.snap-11
    • Define the rule.
    • This rule is defined as :- if the ob is equal or more than 100, then send an e-mail to the supplied address.
    • After adding the rule it needs to be activated. Click on the Activate button.snap-13
    • Similarly created the rule for Alpha field, the example has the threshold value of 100.


    • Above rules are created in such a way that alert will be triggered every time a condition is met.
  6. Create Conditional rule triggers

    Depending on the message frequency and the rule conditions, a rule might trigger a large number of times after a trigger condition is met. To control the number of alerts that are triggered for a rule over a time period, you can configure conditional trigger requirements for your rule. For more information on the conditional rule triggers: https://console.ng.bluemix.net/docs/services/IoT/cloud_analytics.html#conditional

    • To configure conditional rule triggers, click on the rules dashboard and click on Trigger every time condition is met as shown below.


    • Configure the set frequency requirement for the rule. In this case action will be triggered if the threshold reaches 5 times in every 30 mins.


  7. Results

    Now, when the devices begin sending events, the rules will analyze the data in real time and take action when a threshold is broken.

    • Dashboards for analytics can be viewed in Boards as shown below.d1
    • Alerts for a particular device can be viewed under Rule Alerts For That Device in Device-Centric Analytics.re


1 comment on"Real Time Data Analysis Using IBM Watson™ IoT Platform Analytics"

  1. Bill Wentworth September 02, 2016

    If a Cloudant database already exists in your environment and you receive a 404 error or deprecation warnings, see this post on Stack Overflow to see if it resolves your issue: http://stackoverflow.com/questions/39276629/iot-phone-recipe-connects-but-not-sending-data

Join The Discussion