Texas Instruments CC2541 SensorTag is a Bluetooth Low Energy (BLE) development kit with 6 sensors (IR temperature, humidity, pressure, accelerometer, gyroscope, magnetometer) mainly destined at mobile application developers for iOS, and soon, Android 4.3. I’m interested in BLE, as I expect most new phones with come with BT 4.0 BLE (aka Bluetooth SMART), and this technology may help bring the Internet of things to life, allowing us to interact with sensors, smart appliance (e.g. light switch)… Since it just costs $25 (including international shipping), I decided to buy it, and give it a try. Today, I’ll show some unboxing pictures, and how to communicate with the kit using the Linux command line.

TI SensorTag Unboxing

I ordered it at the end of May, and receive it by Fedex on the 18th of July, about 7 weeks later, in the package below.

Inside we’ve got a Quick Start Guide for iOS and Windows, a screw for the enclosure, CC2541 SensorTag board, 2 parts for the enclosure, and a CR2032 battery.

(Click to Enlarge)

There are also some documents with warning, and legalese, mainly explaining this kit is only for development. On another important info is that in Japan, you can only use this kit in a shielded room or specialized test facility, or you may get into troubles with the authorities.

(Click to Enlarge)

On one side of the board (left on pic), we’ve got the battery socket,S1 button to turn on/off the SensorTag, the humidity sensor (U6, Sensirion SHT21), and TI CC2541 Bluetooth low energy SoC. J1 connector is used to debug, and flash CC2541.

Assembly of the SensorTag

Assembling the SensorTag is pretty easy. First insert the CR2032 battery, and press S1 to check the connection is fine, as it should make D1 blink. If it does not work, you may have to remove and re-insert the battery a few times (I did not have to do this). Place the PCB in the black plastic cover, fastened the PCB with the screw, and add the transparent plastic cover.

Complete the assembly by adding the red plastic cover.

Getting Started with SensorTag / Bluetooth Low Energy in Linux

Since I don’t own an iOS device, my only option is to use a computer running Windows or Linux. In that case, we need USB dongle supporting Bluetooth 4.0 Low Energy. I bought a dongle called BD-401 for $5.25 on Ebay, but the listing is now gone, and it was also on DealExtreme, but for some reasons it seems to have almost completely disappeared from the web, and I can only find it in one Aliexpress store for $7. Here are some of the USB dongle technical details for your reference:

If you want to use SensorTag with a Windows computer, you’ll need to download and install BLE Device Monitor. TI clearly mentions you need CC2540 USB dongle ($49) to use the software, but I just thought any BT 4.0 BLE dongle might do. When I saw BLE Device Monitor looking for a COM port, I knew this was not going to work, and you indeed need TI kit, and install a specific firmware on the dongle.

Luckily this is not the case in Linux. The requirement is just to have Linux 3.5, the first kernel version with Bluetooth Low Energy support, or better Linux 3.6 which adds some improvements. Since I had a Raspberry Pi on my table running Linux 3.6.11, and somebody clever already provided instructions to use SensorTag with the board, I decided to use this platform for playing around. Instructions for the BeagleBone Black are also avauilable, but the link not currently working.

You’ll need a recent version of Bluez, an open source Bluetooth library, in order to support BLE devices such as the SensorTag, and I’ll provide three methods to build it.

The other method is to cross-compile the library. The build is not too complex and long, and this should not really be needed, unless you use a small SD card (like I do). You’ll need an ARM cross-toolchain, and since I’ve got the ARMv6 toolchain for Raspberry Pi built with Yocto, I’ll add it to my path in ~/.bahrc:

If you want to write you own program, you can probably do so by starting from gatttool source code (C language) located in attrib directory of Bluez library. Mike Saunby, who provided the instructions for the Raspberry Pi, also wrote a program in python calling gatttool to retrieve the data, as well as a NodeJS / socket.IO web app to display temperature and accelerometer values in real-time in a web browser. His code is available on github.

Jean-Luc, did you play with it further? I’m interested to know if BLE battery life lives anyhow to promise ;-). And any thoughts on working distance? My initial testing shows rather mediocre range, it loses connection at 4m distance with 1 wall inbetween brick, hardly even concrete. Still worked at 2m with the same wall. The only good news is that it’s pretty consistent with what I saw for other 0dBm 2.4GHz modules with PCB antenna, so at least can’t blame cheap Chinese modules, only 2.4GHz and physics ;-).

@Paul
SensorTag is only discoverable 180 seconds after pressing the button, so people have wanted to change that to be discoverable for longer intervals, or at specific times. For a weather station for example, it’s not that convenient to walk outside, and press the button to get the data….

Btw, with wanting to do that specific change, my guess is that people miss with understanding what BLE is and how it works. “Discoverable” means it sends advertisements at rather short intervals (TI says SensorTag does 100ms for example), which in turn means in burns battery. An accessory won’t deliver “years on single coin cell”, likely just days. The way BLE should be used is that you discover devices, connect to it, and then query it infrequently.

If people just want to burn battery, they don’t need to abuse BLE for that, classic BT is enough. For example, when hacking on HC-04 and https://github.com/pfalcon/blutunode , I couldn’t get below 2mA (no public datasheets on low-power config of BlueCore4 chips), I stopped worked on it due to that, but some people might be just happy.

Re: “weather station” example: as you remember, I initially asked for impressions on range. IMHO, “outside” scenario not going to work with BLE at all. It seems that it reliably can work only within a room, single wall is a challenge.

Vote Up0Vote Down Reply

5 years ago

Guest

Pat

you wouldn’t happen to know if you can get one of the above usb dongles working and communicating in linux 2.6/3.x android 4.3 iso in virtualbox on Win 7 ? I tried a bluegiga bled112 (thinking any would do) and I can see the device connected to the vm but in android bluetooth won’t start. It almost immediately switches off when you switch it on. any ideas or suggestions would be great as I’m planning to return the bluegiga. thx

we created our own firmware which disables the sleep mode. It works pretty well! If you are interested, have a look here – we have written a guide how it can be downloaded and installed easily:http://www.myweathercenter.net/faq/

We use the firmware for our iPhone App MyWeatherCenter, which was featured by Apple these days.

[…] WICED Sense is a direct competitor to TI SensorTag, and sells in the same price range at $19.99 via Mouser, Avnet, or other distributors. You can find […]

Vote Up0Vote Down Reply

4 years ago

Guest

Yaqz

Awesome topic, ..When trying to connect to Sensor tag, I used to have error: connection host down (112). This line of code “”cp attrib/gatttool ../bluez/bin/”” got me this new message “Attempting to connect to MacAdress”.

I can tell “”cp attrib/gatttool ../bluez/bin/”” changed the situation because I had already had the newest version of Bluez and did all the steps mentioned previously of installation.

Now I would be p-leased if you explain to me why and what does that code stands for ?