Posts: 29
Registered: ‎09-19-2012

IoT demo using Thunderboard

[ Edited ]



First of all I would like to Thank you Silicon Labs for the Thunderboard Sense Kit ! Tiny but Swiss Knife of Sensors. 


Trust me it is !




I have decided to go with IoT demo using this kit which sends Temperature, Humidity and Battery Level to Cloud.


I choose RaspberryPi 3 Model B to collect the data from Sense Kit and then upload it to portal.


Thingspeak is very easy to create and use platform. I have created my channel there with three fields. It gives you unique API Key using which you can push data to cloud and on Thingspeak you can view the graph of your logged data. There is limit on it so you can push data once at every 15 seconds only.



Thingspeak Dashboard !



Thingspeak Graph !


Project posted by @Namo_Aton helped me to to start things and find characteristics I want to read out and push data to cloud.


As I want to read Battery Level, Temperature and Humidity I have find out those three characteristics first and then read it. It will read parameters at every 1 second but push to cloud at 15 second interval.


Here is the python script to connect with Sense Kit, Read data and push to Cloud.

from __future__ import division
import sys
from bluepy.btle import *
import struct
import thread
from time import sleep
import urllib2


#Base URL of Thingspeak
baseURL = ''

def vReadSENSE():
	scanner = Scanner(0)
	devices = scanner.scan(3)
	for dev in devices:
		print "Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi)

		for (adtype, desc, value) in dev.getScanData():
			print "  %s = %s" % (desc, value)
	num_ble = len(devices)
	print num_ble
	if num_ble==0:
		return None
	ble_service = []
	char_sensor = 0
	non_sensor = 0
	bat_char = Characteristic
	temperature_char = Characteristic
	humidity_char = Characteristic
	count = 15
	for i in range(num_ble):
			char_sensor = char_sensor + 1
			print "Connected %s device with addr %s " % (char_sensor, devices[i].addr)
			non_sensor = non_sensor + 1
		for i in range(char_sensor):
			services = ble_service[i].getServices()
			characteristics = ble_service[i].getCharacteristics()
			for k in characteristics:
				print k
				if k.uuid=="2a19":
					print "Battery Level"
					bat_char = k
				if k.uuid == "2a6e":
					print "Temperature"
					temperature_char = k
				if k.uuid == "2a6f":
					print "Humidity"
					humidity_char = k
		return None
	while True:
		bat_data =
		bat_data_value = ord(bat_data[0])
		temperature_data =
		temperature_data_value =(ord(temperature_data[1])<<8)+ord(temperature_data[0])
		float_temperature_data_value = (temperature_data_value / 100)
		humidity_data =
		humidity_data_value =(ord(humidity_data[1])<<8)+ord(humidity_data[0])

		print "Battery: ", bat_data_value
		print "Temperature: ", float_temperature_data_value
		print "Humidity: ", humidity_data_value
		if count > 14:
			f = urllib2.urlopen(baseURL + PRIVATE_KEY +"&field1=%s&field2=%s&field3=%s" % (bat_data_value, float_temperature_data_value, humidity_data_value))
			count = 0
		count = count + 1 

while True:


Here is the video for the same.



Cheers !


Posts: 4
Registered: ‎08-04-2014

Re: IoT demo using Thunderboard

Superb Harshadbhai! Smiley Happy

Posts: 29
Registered: ‎09-19-2012

Re: IoT demo using Thunderboard

Setup for this demo !



Posts: 2
Registered: ‎01-09-2017

Re: IoT demo using Thunderboard

Great job.

Is the sensors starting the advertise without any setup needed ?

Had you to modify the factory set firmware ?

Thanks, nice day


Posts: 10
Registered: ‎07-20-2015

Re: IoT demo using Thunderboard


This works like a charm, and is a great help in getting me started with my project..


Simon M

Posts: 20
Registered: ‎02-27-2017

Re: IoT demo using Thunderboard

HallMark - great project and thanks for sharing all the detail. If you don't mind I have a couple of questions (am a Sense newbie); 


1. Do you know if there is anyway to get access to sensor data without going through BLE? Ideally would like to pick it up through I2C bus and handle the upload to the cloud from there (using another dev board). 


2.  Did you have to modify any of the code on the Sense board itself? Does it have good standalone performance (i.e. running for 24 hours, reporting every 15 seconds)?


Ideally I'd like to make a standalone sensor board, which updates every now and then, to the cloud, and stores necessary data. I understand the Thunderboard Sense doesn't have Wifi, so trying to work out how to do this without my phone / PC being around all the time.  


Thanks and look forward to hearing from you.