Ever since I laid my hands on a TI SensorTag, I was quite fascinated. Such a small elegant package, packed full of sensors (ambient and IR temperature, humidity, barometer, gyroscope, accelerometer, compass in the version I first got – current versions sport additional sensors), and all powered by a coin cell battery that can last a year or more!
I saw that someone had used the SensorTag to collect data from an amateur rocket launch (http://makezine.com/projects/iphone-flies-on-a-rocket-collect-and-analyze-data/). You had to either fly an iPhone with the rocket, or limit the data collection to at best 300 feet of flight data (the best case range for Bluetooth LE).
There are so many different scenarios under which a SensorTag can be used to collect data
- rocket launch data of course, but also
- Weather data like temperature, humidity and pressure changes in your garden, in your birdhouse
- Track your G forces in flight, if you are a pilot
- Track data for your RC plane or copter
- And so much more!
In all of these cases, it would be great to untether the SensorTag from your smart phone – and let it collect data even when you are not there. Thus was born the Arduino Bluetooth LE Logger for TI Sensor Tag! It connects over Bluetooth LE (BLE) in master mode to the TI Sensor Tag, and turns on notifications for the characteristics you have selected (via push buttons), and starts logging the data to a microSD card, along with the timestamp, in a Comma-separated value (CSV) format, for easy importing into spreadsheets for additional processing and graphing.
Of course, the choice of hardware (Arduino) was dictated by the fact that I started hacking with an Arduino, and wanted to see what I could achieve with it (an 8 bit microcontroller with 32k sketch size (more like 30k since the bootloader takes up 2k) and 2k ram – fitting all of the functionality of the Logger into this proved to be quite a challenge).
The Arduino Bluetooth LE Logger for TI SensorTag (and others) is a compact unit (slightly bigger than the SensorTag) that is chock full of features, for logging not only SensorTag data, but also any other Bluetooth LE device, such as a Heartrate monitor, Health Thermometer, Blood Pressure, and so on, by modifying the Arduino sketch suitably.
Ok, let’s look at the various features of the Logger!
      Â
Microcontroller – Arduino Pro Mini 3.3v (I chose this because the form factor is very small, and the fact that it is 3.3v meant that I did not need another additional voltage regulator to handle 5v to 3.3v conversions. This also enabled me to power it via a 1 cell Lipo Battery, which provides 3.7v.
Bluetooth LE – For this, I chose Bluegiga’s BLE112. The BLE112 can be used in both master and slave modes. I needed a module that would support master mode, if I was to connect to a slave (e.g. the SensorTag) and log its data. BLE112 also supports bglib, which is ported to run on Arduino (https://github.com/jrowberg/bglib/ – Thanks Jeff Rowberg!), so I can have a full featured master MCU that can connect, discover resources, turn on notifications and process data. BLE112 also provides BGScript, a custom scripting language for on-module applications – i.e. you can run your own custom logic in the BLE112, without the need for C programming or an expensive IAR compiler license).
Real Time Clock – A data logger is incomplete without a real time clock to log the time the data was collected. For this, I chose the DS1339, because it is a) tolerant of a wide range of voltages (so I could use it with the Arduino Pro Mini 3.3v), b) battery backup to maintain the date and time, c) The presence of an alarm (2 to be precise!) (so it is possible to get timed interrupts and potentially use this for low power operation of the Arduino) d) as a bonus, it also has a trickle charger (I’m not using the alarm and trickle charge functionalities, but you could!). The Logger has a coin cell battery holder for the RTC.
MicroSD card slot – The data from the SensorTag (along with timestamp from the RTC) is logged to a microSD card. I used a push-push socket so it is easy to insert and remove. The SD card slot is also oriented such that if the Logger is placed vertically in a rocket, the high G-forces from the launch will not dislodge the SD card (since it would be oriented horizontally). Similarly, the coin-cell battery holder is also oriented horizontally. The LED13 of the Arduino Pro Mini also shows SD card activity.
I have provided 3 buttons (the image above shows 4, but Rev 5 only has 3 buttons – I’ve left Digital 3 connected to the host-wakeup pin of the BLE112 module, if you want really fancy power management, and Digital 0 and 1 for uploading sketches and serial output, so I’m out of digital ports. (I could use the A6 and A7 (analog read only) pins of the Arduino Pro Mini for some additional buttons if needed) and 8 leds that you can repurpose as you wish! Currently, the 3 buttons are used to select the data to log (temperature, humidity, barometer, accelerometer, gyroscope, compass) – each button toggles a set of two features. LED 7 is used to indicate Bluetooth LE connection status, and LED 8 is used to indicate BLE module communications.
Finally, in the rear of the board, I have a JST connector for a 3.7v LiPo battery, as well as a power switch. And to make the system fully configurable and hackable, I’ve added a CC debugger connector, so you can upload different BLE112 firmware (including your own application logic written with BGScript!).
The version of the board show in the picture has a jumper wire, but Rev 5 of the board has this problem fixed and the jumper wire is no longer necessary.
Changing the Arduino sketch to connect to any other BLE device and log data would be quite trivial, and you can hack it into something else altogether, because of the all the configurability built in.
Of course, if you don’t want to hack anything, you can use it without much ado to log your SensorTag data!
-Sridhar Rajagopal