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.
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.
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.
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.
Your SensorTag is now successfully connected to the IBM Watson IoT Platform Quickstart Service!
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 :-
Device Type <myDeviceType>
Device ID <myDeviceId>
Authentication Method token
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.
if [[ $# -eq 0 ]] ; then
echo 'USAGE : ./cfgWatsonReg.sh <ip_of_sensortag> <organisation> <type> <id> <token>'
# 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
# Configure Registered Organisation
wget --post-data="__SL_P_UID=$2" http://$1
# Configure Registered Device Type
wget --post-data="__SL_P_UIE=$3" http://$1
# Configure Registered Device Id
wget --post-data="__SL_P_UIF=$4" http://$1
# Configure Registered Device Token
wget --post-data="__SL_P_UIG=$5" http://$1
# Sys Commands to save
wget --post-data="__SL_P_UM0=save" http://$1
# ./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!