DeveloperIoT

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway

In one of my first post I connected my Texas Instrument SensorTag to Watson IoT platform. I was able to catch the environment temperature, the environment light and the air pressure and display data on a web dashboard.

Currently the Sensor Tag doesn’t have Wi-Fi (coming soon) and it needs an IoT gateway. Texas Instruments has published on Google Play store (and Apple store) the official app to manage the Sensor Tag and publish data on IBM Watson IoT platform:

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway
Sensor Tag Android gateway

I’ve used the app for Android for 4 months and I am not 100% satisfied. It still has a severity-one bug: the authentication method based on token doesn’t work, to connect the Sensor Tag to IoT platform you can use only the quickstart authentication.

Moreover the using my smartphone as IoT gateway kills my battery 🙂 since few weeks I’m using my MacBook as IoT gateway !

My Bluemix‘ s colleagues have developed a Node.js app that allow to use my MacBook as IoT gateway, retrieve data from its sensors, and publish that data to the IoT platform.
In theory you can the application an anything that supports the Node.js runtime and Bluetooth LE.

So to connect Sensor Tag to Watson IoT platform using a MacBook as gateway, I installed the free app LightBlue to connect a Bluetooth Low Energy (Bluetooth LE) device to my MacBook, then I got the code just cloning the repository:

$ git clone [email protected]:IBM-Bluemix/iot-sensor-tag.git

Here is the the LightBlue app:

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway
OS X light blue

I launched the IoT dashboard to register a device. In the dashboard in Bluemix, select the IoT service you just created and click Launch to launch the IoT dashboard and Add Device:

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway
Sensor Tag – IBM Watson IoT Platform

It’s very important that in Device ID field to enter the MAC address (without the colons) for the adapter publishing the data.
After registration you will be brought to a page containing some properties for the device you registered. Copy the properties into a file iot-sensor-tag app conf.properties file:

auth-token=xtr0fcULrySnvbbj*x
id=f45c899cf951
type=TISensorTag
org=opgida
auth-method=token

and finally run the app on node.js

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway
nodejs sensor-tag

As usual my NodeRed flow, you can view my previous post at this link

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway
Sensor Tag as registrated device on nodered

The flow uses the dweet.io node to send to data to a freeboard:

Connect Sensor Tag to Watson IoT platform using a MacBook as gateway
nodejs sensor-tag

Enjoy with Sensor Tag and MacBook, bye bye Smartphone 🙂

 

Related Articles

Back to top button