Hello IoT World: Using IBM Watson IoT Platform with TI SimpleLink SensorTag

Hello folks! Today I will introduce you into the Internet of Things world. I am walking around a while on the beginning of the IoT thing since I was a hobbyist, but only in 2010 to 2012 I could access real Ethernet ready devices. The problem was much of the Internet part must to be done by ourselves, not having a good and reliable service to get the data. In that time, I worked with Arduino, so I was very limited with how can I collect and send those data through the cloud. Today, with more powerful and small processors, much more embedded solutions arrived to the hands of hobbyists and enthusiasts. Even Arduino has boards with powerful ARM processors nowadays. Now, with small board computers like Raspberry PI and Beaglebone Black, we have an entire computer on the palm of a hand.

And with all these new toys, the IoT world started to run and go around. Small applications such using a connected and embedded device to control your home over Internet became now bigger applications such industrial monitoring as an example. Good projects are all around to get data from devices, provide organized data for analytics, and so one. These kind of projects grows every day. Not only software is being built but new simple hardware is also being built also. Simple devices, already made to connect into smartphones, or made to connect directly into cloud to transmit data are available on the market, making the IoT world even bigger.

Today I will present two of those new stuffs. One is a new hardware from Texas Instrument, the SimpleLink SensorTag. Texas Instrument is known to build processors, sensors and a plethora of electronic hardware parts for industry, but it is also known to sell great developer kits to spread their technology across the world. They support the BeagleBoard project and sold cool kits like the old Metawatch development kit, one of the first smartwatch ever made and available for programming.

IMG_20160707_102150

TI SimpleLink SensorTag with plastic cover and its silicone sleeve.

The SimpleLink SensorTag is a Bluetooth LE based small device with 10 sensors. It is based on the new CC2650 wireless MCU from TI which has a low power consumption. This little thing promises to offer years of battery lifetime with a single coin cell battery, which came included with the kit. It has the following sensors:

  • Ambient thermometer
  • Object IR thermometer
  • Accelerometer
  • Gyroscope
  • Magnetometer
  • Barometer
  • Luxometer
  • Hygrometer
  • Magnetic sensor
  • Digital Microphone
SensorTag with sleeve - back side. Note the holes for sensors

SensorTag with sleeve – back side. Note the holes for sensors

Its BLE capability enables it to be connected into all Bluetooth 4.0 enabled devices like computers, smartphones and also boards like Beaglebones or Raspbery Pi, with the necessary hardware, of course (a good, linux compatible, Bluetooth 4.0 USB Dongle). The good thing is TI has an app for iOS and Android called SimpleLink SensorTag which let you connect into the SensorTag and see what it “sees”. This is a very simple app, which is compatible with the old versions of SensorTag, so, some new stuffs not working on it, like the microphone. But, this app has a good feature, a cloud feature. It can connect to a cloud service and send sensor data to it. Now I will present the software stuff.

Screenshot_20160707-103944

SimpleLink SensorTag Android App

IBM has a neat piece of cloud solution for IoT available at Bluemix platform, the IBM Watson IoT Platform. You can read more about it here. With it, you can connect your device, get data from it, and through Bluemix, connect other services or application to play with this data. The nice thing is we don’t need an application or service to see Watson IoT in action, because we have a dashboard we can create cards with our realtime data! That’s a really nice thing to do with your SensorTag. But you may ask how to do that. You can go to Google and search for Watson IoT and TI SensorTag or look to the SensorTag app cloud feature, clicking on Advanced button. There you can see the Watson IoT service configuration. Nice! But there are many options and a lot of configurations, so let’s configure all out and get all the good stuff working on Watson!

IBM Watson IoT Platform Configuration

IBM Watson IoT Platform Configuration

 

First of all, I have the same curiosity when I get the SensorTag in hands. I bought it first for do some stuffs with the Beaglebone Black which lying around from another project. When I get it, I get the Android app and see the cloud option, and get to configure it into my Watson IoT I was configured earlier. Googling a little, I found this link, which proves not to be very productive since the SensorTag app seems to be an old version there. When I looked into my app, I saw three options there, the IBM Watson IoT Quickstart, the IBM Watson IoT Platform and a custom configuration. Ok, the quickstart works ok, just follow the link and get the url address to access the temporary link to view the data. All right, but the other option? When we select the platform mode, all fields enable for edition. Nice, lets get back to our IoT dashboard and add a device.

I will suppose you have a Bluemix account here, if you don’t have one, follow this link to register and access to get your 30-days trial account. Once there, I will add a new IBM Watson IoT Platform. For that, simple click on Internet of Things link on Bluemix dashboard, and click on the icon for the IoT platform. A new form will appear to create a new service, give a nice name for your service and select the free plan.

IoT new app

Internet of Things services

IBM Watson IoT Platform

IBM Watson IoT Platform

Plans for service - just choose free and you are ok

Plans for service – just choose free and you are ok

Create the platform. You will be redirected to the platform, so click on Launch dashboard.

 

Welcome Screen

Welcome Screen

 

On dashboard, click on the second icon on sidebar, you will be redirected to the devices list. Now it is time to add a new device. Click on the button to add a device, you will get that screen.

Add a device

Add a device

As you see, there is no device type, so we will need to create one. You will just create a simple device type, but you can go through the options later. For now, give the device a simple name, since we will use this name later, and a description if you want.

New device type

New device type

Just let hit next for all default settings and create the type. Now we can create the device.

New device with a type

New device with a type

Hit next, we need to give the device a nice id to get it connected. Give it a device id and hit next.

Set device id

Set device id

There is no need to define metadata, so hit next to define the token. The process can create an auto generated token for you but for the sake of simplicity, and for your fingers since you will type this token in your smartphone, type a simple 8-character token.

Authentication token

Authentication token

Since we will create only a test device, we will let all parameters default now, so, take some time later to find what these parameters affect in device and what you can do with them.

After the token is defined, a summary screen is presented. You can hit create now. Now you can see the device screen. Just look the connection information provided:

Device Information

Device Information

Now, looking to the app, there is not this kind of information it requests us to inform. So, what we need to do now? Let’s look over requested information from the app:

  • Username
  • Password
  • Device Id
  • Broker Address
  • Broker Port
  • Publish Topic

Ok, how can we connect to it? Let’s think about the IBM Watson IoT Platform. The platform was made to be open, so every kind of device and every kind of application could connect and publish and/or request data. So, there is an API, and also, such means to connect, and with all this, a documentation explaining how this works. Fine! Let’s read the docs! The platform uses the MQTT protocol to communicate so, let’s seek to MQTT device connection into the docs. Seeking a little I find how to connect a device. The trick is to look into the MQTT connection and here comes the details of it:

  • URL to access: Every organization has a unique url to connect, in the form: <org-id>.messaging.internetofthings.ibmcloud.com
  • Port: 1883 for normal, 8883 or 443 for SSL
  • Device Id: is a composed id in the form:
    • d:<org-id>:<device-type>:<device-id>
  • Publish Topic: iot-2/evt/<event_id>/fmt/<format-type>
    • event_id is the name of the event the platform will receive, can be status or other good name.
    • format-type is the type of information to publish, our app will send in JSON, so put json and we will be ok.
  • Username: we have the auth mode set to token, so the username must be use-token-auth
  • Password: is the token provided.

Now, just put all this stuffs into the app, save it, and turn on the cloud. Wait some seconds and the screen with device data we see after device creation will start show our SensorTag sensors data.

Live sensors update

Live sensors update

Now we can do some good stuff with the dashboard, let’s go back to the dashboard, clicking on the first icon on sidebar. Now, we will create a clean board for our sensor cards. Click on Create New Board and give a name to it.

New Board

New Board

Define it to be your landing page, it will appear everytime you access your platform again. Now, click on new board and create a new card, selecting the real time type above devices. On the next screen, select our device, go next and create a new data set.

New card

New card

On the data set screen, select our event and select a sensor data. I’ve selected the ambient temperature, but you can select any sensor. You can define here the type of information (all sensor data from SensorTag is float) and unit to present. Also, you can define the min, max of range and precision if you want.

Realtime Data Set

Realtime Data Set

 

Now it is time to select the type of card. I’ve selected the gauge type since it is a temperature card, but you can select another type and choose another size.

Card Type

Card Type

Now, give the card a name and select a color to it. Create it and see it in your dashboard.

Card information

Card information

iot dashboard

Dashboard with the card

You can now create another cards to compose your dashboard and see your sensors in action. One problem I see is the Android app stops to send data after some time of inactive and even disconnect the SensorTag, so it is not reliable to let a smartphone as a gateway to this. For this situation I will configure a Beaglebone Black later to do that task. But that’s is talk for another post!

Leave a Reply

Your email address will not be published. Required fields are marked *