Overview

Skill Level: Any Skill Level

This recipe is suitable for all and is a great foundation for IoT projects.

Connect the WiFi SensorTag directly to the Watson IoT Platform and send sensor data to the cloud. Default settings push data to the Quickstart service for easy web browser display and prototyping, or configure to push to the Registered service. LetsGo !

Ingredients

In this tutorial, you will be connecting a Texas Instruments WiFi SensorTag to the IBM Watson IoT Platform.  The SensorTag is packed with low power sensors and wireless connectivity to allow wireless, battery powered applications with years of battery life.  To learn more about the SensorTag and order your own go to www.ti.com/sensortag.  

Wi-Fi SensorTag main landing page is here http://www.ti.com/tool/cc3200stk-wifimk.

sensorTag-teardown-wifi-01-crop

An add-on Watch 'DevPack' http://www.ti.com/tool/DEVPACK-WATCH, is also useful for displaying status but not essential.

med_devpack-watch_lcd_devpack_on_arm-crop

In this tutorial, you will also need a Wi-Fi connected iOS or Android device for interacting with the SensorTag - this is primarily for initial configuration and setup.  The SensorTag has dedicated iOS/Android Apps which should be installed and are available from here.

sensorTag-img-apps-icon-android sensorTag-img-apps-icon-app

In order to configure the SensorTag for use with a registered IBM account, a console with 'wget' (or similar application capable of submitting HTTP POST requests) will be required.

 

Step-by-step

  1. Powering Up, Upgrading Firmware and Connecting to the Internet via Local Wi-Fi Connection

    The first phase of this tutorial is to ensure the Wi-Fi SensorTag is powered up and running the latest available device firmware.  These instructions are detailed on the Getting Started page for the SensorTag, located here, http://www.ti.com/ww/en/wireless_connectivity/sensortag/gettingStarted.html.

    It is also recommended to review the ‘teardown’ page for a full description of the hardware and capabilities of¬†the SensorTag, showing all the available sensors and controls, http://www.ti.com/ww/en/wireless_connectivity/sensortag/tearDown.html.

    sensorTag-teardown-wifi-03

    sensorTag-teardown-wifi-04

    Using the smartphone/tablet app for the phone, ensure that the SensorTag is running the latest firmware (v1.002 or greater) as shown in the ‘Device Information’ page of the the iOS/Android App device menu. ¬†If not, please follow the instructions in the Getting Started guide (above) to perform an ‘OTA (Over-The-Air) Upgrade’ of the SensorTag.

    sensorTag-Menu-crop

    If not already done, the SensorTag should then be ‘provisioned’ onto the local Wi-Fi network using the ‘Wi-Fi Setup’ page from the iOS/Android App device menu. ¬†

    At this point, the SensorTag should be running the latest firmware and connnected as a Wi-Fi Station on the local Wi-Fi network.  For power-saving reasons, the default configuration of the SensorTag is to stay connected for 2 minutes after power-up.  When the SensorTag goes into hibernate mode (after 2 mins) there will be a short beep from the on-board buzzer to indicate it switching off.  This state change will also be shown on the LCD of the DevPack-WATCH if used.  The SensorTag can be powered on again by pushing the power button on the side.

     

  2. Connect to the Watson IoT Platform Quickstart Service

    The SensorTag firmware comes with built-in configuration to communicate sensor data to the Watson Iot Platform Quickstart Service.  This data can be viewed at the following location.  https://quickstart.internetofthings.ibmcloud.com/#/

    The default DeviceType’ is set to ‘iotsample-ti-cc3200’ and the default ‘DeviceId’ is set to the MAC address of the Wi-Fi SensorTag. ¬†If the MAC address is already known, this can be entered directly at the web-page above, where data from all the sensors should be visible.

    If the MAC address is not already known, then this can be obtained from inside the iOS/Android App, in the ‘Device Information’ menu, or via the ‘Sensor View’ -> ‘Cloud URL’. ¬†This also provides a direct link from the app, that can be emailed or copied as required.

    sensorTag-SensorView-crop

     

    Your SensorTag is now successfully connected to the IBM Watson IoT Platform Quickstart Service!

     

  3. Connect to the Watson IoT Platform Registered Service

    Once the system and network connectivity has been verified using the Quickstart configuration it is quick to connect the SensorTag to the IBM Watson IoT Platform Registered Service, offering many additional features and benefits.

     

    [ IMPORTANT : Newly created IBM Watson Organisations provide increased IoT Security, by enabling TLS security by default (as discussed here : https://developer.ibm.com/iotplatform/2017/04/06/notification-changes-increased-default-security-via-tls-ibm-watson-iot-platform/¬†). ¬† The current SensorTag v.1.003 example firmware was created before this change and does not have TLS enabled, so this needs to be disabled and set to ‘TLS Optional’ in the Organisation Security Settings for the WiFi ST firmware to connect to the registered service. ]

     

    First, login to your Watson IoT Dashboard (https://internetofthings.ibmcloud.com/) ¬†and register your device with a DeviceId and DeviceType. ¬†[ Note, often the MAC address, or similar unique identifier is used as the DeviceId’ ]. ¬†The registration process will result in creation (or possibly selection) of an authentication token for the device.

    For example, you will receive some configuration information such as :-

    Organization ID <myOrganisation>

    Device Type <myDeviceType>

    Device ID <myDeviceId>

    Authentication Method token

    Authentication Token <myDeviceToken>

    These credentials, next need to be configured into the SensorTag, so that they are used when the SensorTag connects to the IBM Watson IoT Platform.  In order to transfer these settings to the SensorTag, they need to be posted, via some custom HTTP POST commands.  The easiest way to do this is to use wget (or curl) to issue the post commands.

    The following bash script can be used to transfer these settings from a PC on the same network as the SensorTag, and demonstrates the use of the custom POST commands. ¬†You will need to know the IP address of the SensorTag which will be printed on the LCD (in the case of DevPack-WATCH), or alternatively found using the iOS/Android App in the ‘URL’ field of the ‘Device Information’ page.

     

    #!/bin/bash

    if [[ $# -eq 0 ]] ; then
    echo 'USAGE : ./cfgWatsonReg.sh <ip_of_sensortag> <organisation> <type> <id> <token>'
    exit 1
    fi

    # Sys Commands to disconnect
    wget --post-data="__SL_P_UM0=disconnect" http://$1

    # Configure QuickStart(0) or Registered(1)
    wget --post-data="__SL_P_UI1=1" http://$1
    sleep 1

    # Configure Registered Organisation
    wget --post-data="__SL_P_UID=$2" http://$1
    sleep 1

    # Configure Registered Device Type
    wget --post-data="__SL_P_UIE=$3" http://$1
    sleep 1

    # Configure Registered Device Id
    wget --post-data="__SL_P_UIF=$4" http://$1
    sleep 1

    # Configure Registered Device Token
    wget --post-data="__SL_P_UIG=$5" http://$1
    sleep 1

    # Sys Commands to save
    wget --post-data="__SL_P_UM0=save" http://$1
    sleep 3

    For example, 

    # ./cfgWatsonReg.sh 192.168.1.10 myorg iotsample-ti-cc3200 mysensortag-1234 mysensortag-1234token

    The SensorTag will then be configured¬†to connect using¬†it’s new¬†cloud connection settings. ¬†Note, that these settings will only be used when the SensorTag is next restarted, after which, data should be visible in the Watson IoT Platform Device Dashboard.

    [ Note : Future versions of the iOS/Android Apps will have these configurations available via the App Cloud Configuration pages. ]

     

    The SensorTag is now connected to the IBM Watson IoT Platform Registered Service!

2 comments on"Texas Instruments CC3200 SimpleLink‚ĄĘ Wi-Fi¬ģ SensorTag"

  1. Hi,
    If there is no data being received on the QuickStart service, are there any suggestions on how to troubleshoot?

    Thanks,
    frank.

  2. 1HK2_Pedro_Correia February 04, 2018

    Hi
    Can you give step by step instructions on the bash script?
    All instructions at once? What about the example?
    I understand that my problem is with the wget and curl !
    Thanks
    Pedro

Join The Discussion