Revision history for SensorPuck


Revision [22483]

Last edited on 2015-11-17 03:10:39 by ToBo
Additions:
{{image url="images/SensorPuck.jpg" alt=""}}
Deletions:
{{image url="images/SensorPuck" alt=""}}


Revision [22466]

Edited on 2015-11-15 04:20:06 by ToBo
Additions:
# Version 1.4
# XML-RPC to provide the sensor data for other processes
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
#bgcolor = '#A0A0F8';
#fgcolor = '#302040'
#fgcolorerr = '#801020'
temp = 0.0
amblight = -1.0
def getTemperature():
return temp
def getAmbLight():
return amblight
global temp
global amblight
tTimeOutObserver = time.time() + 42

if humidity > 58.0:
txtExtra += 'Ventilate the room.\n'
txtExtra += 'It\'s incredible hot in here!\n'
txtExtra += 'It\'s hot in here.\n'
txtExtra += 'It\'s cold in here!\n'
laSensData['text'] = u'Pulse Sensor Mode \n Sensor state: %s \n Pulse rate: %d bpm' %(hrmStateStr[hrmState], pulseRate)
global temp
temp = 0;

def threadSensorDataServer():
# Restrict to a particular path.
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/RPC2',)
# Create server
server = SimpleXMLRPCServer(("localhost", 8201), requestHandler=RequestHandler)
server.register_function(getTemperature, 'getTemperature')
server.register_function(getAmbLight, 'getAmbLight')
server.serve_forever() # Run the server's main loop

tTimeOutObserver = time.time() + 12
thread.start_new_thread( threadSensorDataServer, () )
Deletions:
tTimeOutObserver = time.time() + 5
if humidity > 55.0:
txtExtra += 'Ventilate the room!\n'
txtExtra += 'It''s incredible hot in here!\n'
txtExtra += 'It''s hot in here.\n'
txtExtra += 'It''s cold in here!\n'
laSensData['text'] = u'Pulse Sensor Mode \n Sensor sate: %s \n Pulse rate: %d bpm' %(hrmStateStr[hrmState], pulseRate)
tTimeOutObserver = time.time() + 5


Revision [22282]

Edited on 2015-10-23 04:31:48 by ToBo
Additions:
Average current reduction from ~225 µA to ~70 µA @ 3 V in environmental mode.
Deletions:
Average current reduction from ~210 µA to ~70 µA @ 3 V in environmental mode.


Revision [22281]

Edited on 2015-10-23 04:31:25 by ToBo
Additions:
Average current reduction from ~210 µA to ~70 µA @ 3 V in environmental mode.
Deletions:
Average current of 70 µA @ 3 V in environmental mode.


Revision [22280]

Edited on 2015-10-23 04:26:38 by ToBo
Additions:
==a==Sensor Puck Firmware Modifications==a==
Deletions:
==a==Sensor Puck Firmwar Modifications==a==


Revision [22279]

Edited on 2015-10-23 04:25:51 by ToBo
Additions:
Average current of 70 µA @ 3 V in environmental mode.


Revision [22278]

Edited on 2015-10-23 04:13:20 by ToBo

No Differences

Revision [22277]

Edited on 2015-10-23 04:13:05 by ToBo
Additions:
==a==Sensor Puck Firmwar Modifications==a==
Change advertising period from 500 ms
%%(c;;ble.c)
BLE_SetAdvertisingParameters(800, 0, 800, 0);
to 10 seconds advertising periods (only in envirometal mode).
%%(c;;ble.c)
BLE_SetAdvertisingParameters(16000, 0, 16000, 0);
Change sensor data update function from 1 second
%%(c;;sensor_puck.h)
#define PERIODIC_UPDATE_MS 1000
to 10 seconds.
%%(c;;ble.c)
#define PERIODIC_UPDATE_MS 10000


Revision [22190]

Edited on 2015-10-19 00:00:56 by ToBo
Additions:
- Epson 24 MHz [[http://www.epsondevice.com/docs/qd/en/DownloadServlet?id=ID000658 FA-238 ]]


Revision [22173]

Edited on 2015-10-18 18:16:56 by ToBo
Additions:
- Bluetooth Smart Chip [[BCM20732i]], ARM Cortex-M3


Revision [22172]

Edited on 2015-10-18 18:14:40 by ToBo
Additions:
The sensor puck demonstrates Silicon Laboratories optical sensor [[Si1147M01 Si1147-M01]], humidity and temperature sensor [[Si7021]] and Microcontroller ([[EFM32G210]] Gecko). The data is broadcast using a Bluetooth Low Energy (BLE) module.
Data and can be displayed on a mobile device (Apple iOS or Android) that supports the BLE protocol.
Product page:
http://www.silabs.com/products/sensors/Pages/environmental-biometric-sensor-puck.aspx
==a==Components==a==
- Microcontroller [[EFM32G210]], ARM Cortex-M3
- Switched voltage regulator [[TS3310]]
- Optical sensor [[Si1147M01 Si1147-M01]] (UV index, ambient light, pulse rate)
- Humidity and temperature sensor [[Si7021]]
==a==Receive data on Raspberry Pi==a==
There is an App for iOS and Android, but I would like to see the Sensor Puck data on my living room screen ([[http://homienaut.com/22-zoll-touchscreen-am-homienaut/ Homienaut]]).
I wrote two applications: a command line application and a GUI application in python.
Deletions:
The sensor puck demonstrates Silicon Laboratories optical sensor ([[Si1147M01 Si1147-M01]]) RH and temperature sensor [[Si7021]] and low power MCU ([[EFM32G210]] Gecko). The data is broadcast using a Bluetooth Low Energy (BLE)
module and can be displayed on a mobile device (Apple iOS or Android) that supports the BLE protocol.
By using broadcast mode, a connection does not have to be established, making it possible to display the data
from several modules at the same time."
Text source: http://www.silabs.com/products/sensors/Pages/environmental-biometric-sensor-puck.aspx
Microcontroller [[EFM32G210]], ARM Cortex-M3
There is an App for iOS and Android, but I wanted to see the Sensor Puck data on my living room screen ([[http://homienaut.com/22-zoll-touchscreen-am-homienaut/ Homienaut]]).


Revision [22150]

Edited on 2015-10-17 20:01:32 by ToBo
Additions:
{{image url="images/SensorPuck6.jpg" alt=""}}
Deletions:
{{image url="images/SensorPuck3.jpg" alt=""}}
{{image url="images/SensorPuck5.jpg" alt=""}}


Revision [22148]

Edited on 2015-10-17 19:19:49 by ToBo
Additions:
I wrote this code based on the implementation from http://amperture.com/?p=23
The Sensor Puck has two modes. Usually Sensor Puck is in enviromental mode. If you put a finger on the optical sensor, the puck switches into biometric.
My script delivers the following parameters.
Additionally, I wrote a python script with GUI based using [[Tkinter]] to visualize the data.


Revision [22147]

Edited on 2015-10-17 19:14:48 by ToBo
Additions:
Put your finger on the optical sensor of the Sensor Puck to measure the pulse rate.


Revision [22146]

Edited on 2015-10-17 19:12:03 by ToBo
Additions:
{{image url="images/SensorPuck1.jpg" alt=""}}
{{image url="images/SensorPuck2.jpg" alt=""}}
{{image url="images/SensorPuck3.jpg" alt=""}}
{{image url="images/SensorPuck4.jpg" alt=""}}
{{image url="images/SensorPuck5.jpg" alt=""}}


Revision [22145]

Edited on 2015-10-17 19:04:23 by ToBo
Additions:
==a==Waht is the Sensor Puck?==a==
The sensor puck demonstrates Silicon Laboratories optical sensor ([[Si1147M01 Si1147-M01]]) RH and temperature sensor [[Si7021]] and low power MCU ([[EFM32G210]] Gecko). The data is broadcast using a Bluetooth Low Energy (BLE)
Microcontroller [[EFM32G210]], ARM Cortex-M3
Deletions:
"The sensor puck demonstrates Silicon Laboratories optical sensor ([[Si1147M01 Si1147-M01]]) RH and temperature sensor
[[Si7021]] and low power MCU ([[EFM32G210]] Gecko). The data is broadcast using a Bluetooth Low Energy (BLE)
Microcontroller [[EFM32G210]]


Revision [22144]

Edited on 2015-10-17 19:02:20 by ToBo
Additions:
{{image url="images/SensorPuck" alt=""}}
Deletions:
{{image url="http://www.silabs.com/SiteCollectionImages/board-images/sensor-puck.png" alt=""}}


Revision [22143]

Edited on 2015-10-17 18:33:04 by ToBo
Additions:
Sensor puck sends the data in as advertising packet. This means in terms of Bluetooth Smart there is no connection required. The Sensor Puck is the broadcaster and the [[http://homienaut.com/22-zoll-touchscreen-am-homienaut/ Homienaut]] is the observer.
Deletions:
Sensor puck sends the data in as advertising packet. This means in terms of Bluetooth Smart there is no connection required. The Sensor Puck is the broadcaster and the [[http://homienaut.com Homienaut]] is the observer.


Revision [22142]

Edited on 2015-10-17 18:32:06 by ToBo
Additions:
There is an App for iOS and Android, but I wanted to see the Sensor Puck data on my living room screen ([[http://homienaut.com/22-zoll-touchscreen-am-homienaut/ Homienaut]]).
Deletions:
There is an App for iOS and Android, but I wanted to see the Sensor Puck data on my living room screen ([[http://homienaut.com Homienaut]]).


Revision [22141]

Edited on 2015-10-17 18:31:14 by ToBo
Additions:
Just in case you ask yourself the question, why I didn't used the escape char ""%%"" in my formated string constructions. Well, ""%%"" is the escape char for end of code in my Wiki. So I use + '%' + instead to be able to post this code here. But both solution deliver an equal result.
Deletions:
Just in case you ask yourself the question, why I didn't used the escape char ""%%"" in my formated string constructions. Well, %% is the escape char for end of code in my Wiki. So I use + '%' + instead to be able to post this code here. But both solution deliver an equal result.


Revision [22140]

Edited on 2015-10-17 18:30:57 by ToBo
Additions:
Just in case you ask yourself the question, why I didn't used the escape char ""%%"" in my formated string constructions. Well, %% is the escape char for end of code in my Wiki. So I use + '%' + instead to be able to post this code here. But both solution deliver an equal result.
Deletions:
Just in case you ask yourself the question, why I didn't used the escape char %% in my formated string constructions. Well, %% is the escape char for end of code in my Wiki. So I use + '%' + instead to be able to post this code here. But both solution deliver an equal result.


Revision [22139]

Edited on 2015-10-17 18:30:25 by ToBo
Additions:
Just in case you ask yourself the question, why I didn't used the escape char %% in my formated string constructions. Well, %% is the escape char for end of code in my Wiki. So I use + '%' + instead to be able to post this code here. But both solution deliver an equal result.
Deletions:
#laSensData['text'] = u'Temperature: %.1f \xb0C \n Humidity: %.1f \x25 \n Ambient light: %.1f Lux \n UV index: %d \n Battery voltage: %.1f V' %(temp, humidity, amblight, uvidx, vbat)


Revision [22138]

Edited on 2015-10-17 18:26:41 by ToBo
Additions:
Text source: http://www.silabs.com/products/sensors/Pages/environmental-biometric-sensor-puck.aspx
There is an App for iOS and Android, but I wanted to see the Sensor Puck data on my living room screen ([[http://homienaut.com Homienaut]]).
This python script helped me a lot to start receiving and converting the data from sensor puck: http://amperture.com/?p=23
Sensor puck sends the data in as advertising packet. This means in terms of Bluetooth Smart there is no connection required. The Sensor Puck is the broadcaster and the [[http://homienaut.com Homienaut]] is the observer.
I found this broadcast format specification very useful to determinate additional parameters of the sensor (ambient light, UV index, battery voltage and pulse rate).
Deletions:
http://www.silabs.com/products/sensors/Pages/environmental-biometric-sensor-puck.aspx
Broadcast Format Specification


Revision [22137]

Edited on 2015-10-17 18:16:03 by ToBo
Additions:
==a==Terminal Application==a==
print u"Humidity: %.1f " %humidity + '%'
print u"Temperature: %.1f \xb0C" %temp
print "Ambient light: %.1f Lux" %amblight
==a==GUI Application==a==
#!/usr/bin/python
# Thos is a GUI version of the Sensor Puck Script at http://tnotes.de/SensorPuck
# Andreas Tobola, October 2015
from Tkinter import *
import time
import thread
bgcolor = 'black';
fgcolor = 'light blue'
fgcolorerr = 'Orange Red'
def threadSensorDecoder():
global tTimeOutObserver
while 1:
line = proc.stdout.readline()
if ">" not in line:
hexarray = line.split()
N = len(hexarray)
tTimeOutObserver = time.time() + 5
if N==14:
# Humidity uint16 deciprecent
humidity = (int(hexarray[6], 16) << 8) + int(hexarray[5], 16)
humidity = float(humidity)/10
# Temperature int16 decidegrees (can be negative -> twos complement)
temp = (int(hexarray[8], 16) << 8) + int(hexarray[7], 16)
temp = float(temp)/10
# Ambient Light uint16 lux/2
amblight = (int(hexarray[10], 16) << 8) + int(hexarray[9], 16)
amblight = float(amblight)/2
# UV Index uint8 index
uvidx = int(hexarray[11], 16)
# Battery Voltage uint8 decivolts
vbat = int(hexarray[12], 16)
vbat = float(vbat)/10

#laSensData['text'] = u'Temperature: %.1f \xb0C \n Humidity: %.1f \x25 \n Ambient light: %.1f Lux \n UV index: %d \n Battery voltage: %.1f V' %(temp, humidity, amblight, uvidx, vbat)
laSensData['text'] = u'Temperature: %.1f \xb0C \n Humidity: %.1f ' %(temp, humidity) + '%' + ' \n Ambient light: %.1f Lux \n UV index: %d \n Battery voltage: %.1f V' %(amblight, uvidx, vbat)

txtExtra = '';
if humidity > 55.0:
txtExtra += 'Ventilate the room!\n'
if temp > 25.0:
txtExtra += 'It''s incredible hot in here!\n'
elif temp > 22.5:
txtExtra += 'It''s hot in here.\n'
elif temp < 18.0:
txtExtra += 'It''s cold in here!\n'
if vbat < 2.7:
txtExtra += 'Low sensor battery.\n'

laExtra['text'] = txtExtra;

elif N==18:
# HRM State uint8 none
hrmState = int(hexarray[5], 16)
# HRM Rate uint8 bpm
pulseRate = int(hexarray[6], 16)
# HRM Sample Array uint16[5] none
# maybe one day...

laSensData['text'] = u'Pulse Sensor Mode \n Sensor sate: %s \n Pulse rate: %d bpm' %(hrmStateStr[hrmState], pulseRate)

txtExtra = '';
if hrmState == 3:
if pulseRate > 120:
txtExtra += 'Your pulse rate is high.\n'
if pulseRate < 50:
txtExtra += 'Your pulse rate is low.\n'
laExtra['text'] = txtExtra;


def threadSensorObserver():


while 1:
time.sleep(2)
if time.time() > tTimeOutObserver:
laSensData['text'] = '';
laExtra['text'] = 'Sensor out of range.';

tTimeOutObserver = time.time() + 5
master = Tk()
master.configure(background=bgcolor)
fontSensData = ("Helvetica",30,"bold");
w = Label(master, text="Sensor Puck", font = ("Helvetica",50,"bold"), bg=bgcolor, fg=fgcolor )
w.pack()
laSensData = Label(master, text="...", font = fontSensData, bg=bgcolor, fg=fgcolor )
laSensData.pack()
laExtra = Label(master, text="", font = fontSensData, bg=bgcolor, fg=fgcolorerr )
laExtra.pack()
proc = subprocess.Popen(['sudo hcidump --raw'], stdout=subprocess.PIPE, shell=True)
try:
thread.start_new_thread( threadSensorObserver, () )
thread.start_new_thread( threadSensorDecoder, () )
except:
print "Error: unable to start thread"

mainloop()
Deletions:
print "Humidity: %.1f " %humidity
print "Temperature: %.1f C" %temp
print "Ambient light: %.1f Lux" %amblight


Revision [22126]

Edited on 2015-10-17 03:21:25 by ToBo

No Differences

Revision [22125]

Edited on 2015-10-17 02:57:27 by ToBo
Additions:
Broadcast Format Specification
http://community.silabs.com/mgrfq63796/attachments/mgrfq63796/6/10653/1/Silicon%20Labs%20Sensor%20Puck%20App.pdf


Revision [22121]

Edited on 2015-10-17 02:52:19 by ToBo
Additions:
The Sensor Puck has two modes Enviromental and Biometric Mode.
If the finger is on the optical sensor, the sensor switches into Biometric Mode.
Depending on the mode the sensor broadcasts different data.
== Enviromental Mode ==
Humidity: 51.4 %
Temperature: 20.5 C
Ambient light: 1.5 Lux
UV index: 0.0
Battery voltage: 3.0 V
== Biometric Mode ==
HRM state: Active
Pulse rate: 72 bpm


Revision [22120]

Edited on 2015-10-17 02:48:35 by ToBo
Additions:
print "Humidity: %.1f " %humidity
Deletions:
print "Humidity: %.1f % %" %humidity


Revision [22119]

Edited on 2015-10-17 02:48:02 by ToBo
Additions:
print "Humidity: %.1f % %" %humidity
Deletions:
print "Humidity: %.1f %%" %humidity


Revision [22118]

Edited on 2015-10-17 02:45:39 by ToBo
Additions:
%%(python)
# Code based on the implementation from http://amperture.com/?p=23
# With additions by Andreas Tobola, October 2015, http://tnotes.de/SensorPuck
import subprocess
import os
proc = subprocess.Popen(['hcidump --raw'], stdout=subprocess.PIPE, shell=True)
hrmStateStr = ['Idle', 'No Signal', 'Acquiring', 'Active', 'Invalid', 'Error']
while True:
line = proc.stdout.readline()
if ">" not in line:
hexarray = line.split()
N = len(hexarray)

os.system('clear')

if N==14:
print "== Enviromental Mode ==\n"

# Humidity uint16 deciprecent
humidity = (int(hexarray[6], 16) << 8) + int(hexarray[5], 16)
humidity = float(humidity)/10

# Temperature int16 decidegrees (can be negative -> twos complement)
temp = (int(hexarray[8], 16) << 8) + int(hexarray[7], 16)
temp = float(temp)/10
# Ambient Light uint16 lux/2
amblight = (int(hexarray[10], 16) << 8) + int(hexarray[9], 16)
amblight = float(amblight)/2

# UV Index uint8 index
uvidx = int(hexarray[11], 16)

# Battery Voltage uint8 decivolts
vbat = int(hexarray[12], 16)
vbat = float(vbat)/10

print "Humidity: %.1f %%" %humidity
print "Temperature: %.1f C" %temp
print "Ambient light: %.1f Lux" %amblight
print "UV index: %.1f" %uvidx
print "Battery voltage: %.1f V" %vbat
elif N==18:
print "== Biometric Mode ==\n"

# HRM State uint8 none
hrmState = int(hexarray[5], 16)
print "HRM state: " + hrmStateStr[hrmState]

# HRM Rate uint8 bpm
pulseRate = int(hexarray[6], 16)
print "Pulse rate: " + str(pulseRate) + " bpm"

# HRM Sample Array uint16[5] none
# ...
print " "
%%


Revision [22089]

Edited on 2015-10-14 19:48:30 by ToBo
Additions:
Microcontroller [[EFM32G210]]
http://www.silabs.com/products/sensors/Pages/environmental-biometric-sensor-puck.aspx
Deletions:
[[EFM32G210]]


Revision [22079]

Edited on 2015-10-14 18:48:06 by ToBo
Additions:
"The sensor puck demonstrates Silicon Laboratories optical sensor ([[Si1147M01 Si1147-M01]]) RH and temperature sensor
[[Si7021]] and low power MCU ([[EFM32G210]] Gecko). The data is broadcast using a Bluetooth Low Energy (BLE)
module and can be displayed on a mobile device (Apple iOS or Android) that supports the BLE protocol.
By using broadcast mode, a connection does not have to be established, making it possible to display the data
from several modules at the same time."


Revision [22078]

Edited on 2015-10-14 18:13:43 by ToBo
Additions:
=====Sensor Puck=====
{{image url="http://www.silabs.com/SiteCollectionImages/board-images/sensor-puck.png" alt=""}}
[[EFM32G210]]
Deletions:
=====T=====


Revision [22073]

The oldest known version of this page was created on 2015-10-14 18:09:26 by ToBo
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki