Christoph and I exchange gadgets occasionally, and he sent me a SensorTag, which is a small little red thing with contains a bunch of sensors on it: a temperature sensor, a 9-axis motion sensor, a humidity sensor, an altimeter and pressure sensor, and an ambient light sensor. In addition to two buttons, the SensorTag also has a reed switch on it which I can activate with a magnet, and it has a buzzer (which I thought didn’t work until I held the device to my ear). Apparently it also has a serial flash on it for storage and OTA upgrades, and a battery. The teardown suggests it also has a microphone. The package is enclosed in red rubber which feels nice, and which can easily be removed to disclose a small, rectangular, plastic case with a transparent lid.
I spent an hour looking for information on the SensorTag, reading some articles about it, and generally attempting to get a feel for what it’s supposed to do, but I’m having trouble finding real use-cases for it. As a consumer for this “Thing” there is too much I don’t understand on the Texas Instruments SensorTag page. For example:
- The SimpleLink™ SensorTag allows quick and easy prototyping of IoT devices. How? What does this mean?
- IoT made easy, with a secure connection to the cloud. Maybe, but you need an app on a smart phone for that.
- The SensorTag comes in two variants. One of them is “coming soon”
- Low-power or battery-less operation. Which shall it be?
- Remove the barriers between software and hardware. How’s that? I need the hardware (SensorTag) and the software (an app).
- With the SensorTag app, you can build your own iOS app in minutes. It allows quick and easy prototyping of simple sensor applications.. There is absolutely no indication whatsoever that the iOS app “lets me build my own iOS app in munutes” or that it lets me do “easy prototyping of simple sensor applications”. Maybe what they mean is server-side, but that’s certainly not what the blurb says. Or do they mean a bit of drag and drop as shown in this video?
The getting started tab of the SensorTag page says I should download the app, remove the battery tab (so it does have a battery, eh?), and I can then “explore” my SensorTag. Yes, that works, as the following screenshot depicts, after I figure out that I have to poke one of the rubber buttons on the tag to allow it to be discovered.
I then find out by experimentation that I have to switch on the sourcing switch at the top of the app; this enables the app to push data to “the cloud”, and I can click on a link which takes me there:
The Web page updates the device data instantly. I forget where exactly, but I stumbled over the fact that the sensors’ data is also published to an IBM MQTT broker which I can subscribe to with any MQTT client, replacing the
xxx in the subscription topic by the device ID which is displayed on the above IBM Internet of Things Foundation page. The MQTT topics are documented here.
I did not format this payload; the formatted JSON string you see is what was transmitted, and it makes me shudder slightly because it makes scripting difficult. The monitoring topic doesn’t do that, but I do wonder who thought up the double quotes within the topic name:
Christoph wrote a nice little program which subscribes to that data stream and prints this out:
The program itself is quite simple:
The documentation of this device is spread all over the place and the fact that there have been two versions of it doesn’t help at all. Some documentation is an a TI Wiki. The CC2650 SensorTag User’s Guide for example, warns about a pre-production FW image, but the app through which upgrades are apparently possible doesn’t show newer firmware versions being available.
Another link from the SensorTag page takes me here where I see ‘mqtt’ linked to. There I see I need a “free Temboo account”, and I have to “register with Twilio” where I get a phone number, and then I require a “Pagerduty account” and an API key, and, then I need a “Zendesk account”, … I very quickly closed that Web browser tab and shuddered. Gals & boys, if that’s what we need for the “Internet of Things”, we’re going to have 50 billion squared problems by the year 2020!
There’s also a quick guide to making a mobile app for the SensorTag which I haven’t tried, because I don’t see the point in creating a mobile app which displays the sensor data if I have to run the TI SensorTag app anyway.
Be that as it may I went in search of how to talk to the device directly, or rather, how to have the device talk to me, and found this.
After inserting a BLE-capable Bluetooth dongle into a laptop, I could actually scan for LE devices, and I learned that there may be one connection to a BLE device only, so I close the SensorTag app before attempting the scan:
and the rest was easy in as much as a chap called Ian Harvey has done the hard work.
Minutes later, I had the device reporting via MQTT using this code and this doesn’t require a cloud service – I’d point this at my own MQTT broker of course.
After playing with this for a bit I realized that the Python implementation doesn’t appear to cater for all the SensorTag’s capabilities (i.e. sensors). I then found node-sensortag which does, and cobbled up something which publishes an MQTT payload whenever one of the sensors on the tag notifies NodeJS. This module also supports the buttons and the reed switch, and it auto-discovers the SensorTag proper, so I don’t have to configure it with the device identifier. The result, using Freeboard with the MQTT plugin gave me this:
As a BLE device, the SensorTag literally “goes away” when it’s too distant from whatever is receiving the data, be it the iOS app or the BT dongle in my laptop. I assume that the makers wanted the SensorTag to be carried in one pocket, with the cloud-connected smart phone in another. I just don’t know. The SensorTag specifications state that it can be toggled between Bluetooth Smart, 6LoWPAN and ZigBee and, as mentioned above, there is to be a WiFi version some time.
The SensorTag is small enough to be placed almost anywhere, and as it doesn’t need wiring, it would be nicely suited as an ambient light sensor to control, say, openHAB: an appropriate BLE dongle on an openHAB box in Bluetooth reach, and Bob’s your uncle. (BTW, the ambient light sensor is appears to be very good.) Christoph also suggests using it to determine whether your spouse drives more aggressively than you do, by monitoring the accelerometer. ;-)
If and when the WiFi version comes, and if it’s comparable in price to the BlueTooth version (USD 29.00), I could imagine getting two or three to use as temperature and luminescence sensors in the house.