SensorTag metrics with Grafana

If you haven’t been following, I’ve done a little research into the Texas Instruments SensorTag starting with post RaspberryPi 3 and SensorTag.

Just the other day I stumbled upon the official Texas Instruments wiki for the SensorTag CC2650, the wiki does a good job outlining the formulas to calculate each sensors value.

This lead me to write a minimal Python class (see on Github) using some of the formulas found in the wiki. Beyond just the Python classes, I wrote in a periodic process; this process will save the sensor data to screen, and write to /root/sensor.json every five seconds.

pi@raspberrypi:~# cat /sensor.json
 "pressure": 987.2,
 "humidity": 58.44,
 "temperature": 75.65,
 "light": 19.43

To better visualize the gathered data I decided to store all metrics in Telegraf, all I needed was a simple execution plugin:

pi@raspberrypi:~# cat /etc/telegraf/telegraf.d/sensor_tag.conf
 command = "cat /sensor.json"
 data_format = "json"
 name_suffix = "_sensor_tag"
 interval = "5s"

Then on my workstation I installed Grafana, and connected Telegraf as a remote data source.

This is the type of data I’ve been gathering and storing from the SensorTag, seems like we could make a weather station pretty easy.



Leave a Reply