RoadTest: Raspberry Pi and EnOcean Internet of Things Pack
Author: gregoryfenton
Creation date:
Evaluation Type: Independent Products
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: Homebrew unit
What were the biggest problems encountered?: null
Detailed Review:
The EnOcean Pi kit I am reviewing was originally envisaged to monitor the temperature of my freezer to prevent the accidental defrosting of all my foodstuffs when my children got a lollipop out of said freezer and left the door open.
Unfortunately the temperature sensor module only covers an extremely limited temperature range of 0-40 degrees centigrade which excluded that from the test. I decided to use it as a generic room temperature sensor instead.
Considerations:
* Transmitter range
* Position
* Sensor range
Hardware:
Raspberry Pi Model B
Internet connection
Enocean Pi board
STM 320 energy harvesting magnet contact transmitter module
Software:
Raspbian OS for the Raspberry Pi
FHEM Home of FHEM
T Twitter library https://github.com/sferik/t
The first thing I noticed about the kit was that the sensors were bare boards and highly likely to either become lost or sustain damage, especially to the antennae which look like major weak points.
I got around this by creating and 3D printing cases for the sensors which gave them protection from damage and (as the cases were bright orange) some protection from losing them.
I chose to use the magnetic sensor and physically mount it to the door of the freezer so it triggered whenever the door was opened and closed. A script on the Pi keeps track of the current state and tweets a message to me whenever the door has been open for more than a set period of 3 minutes to allow time to find the item you are looking for without false alerts.
The magnet is rather powerful and will trigger the sensor from 2 centimetres away. I had to ensure that I accounted for this in my positioning of the sensor and magnet, as well as the fact that freezers are metal and the magnet will stick to it.
One of the concerns I had was the freezer door magnet interfering with the sensor. I solved this by mounting the sensor 5 centimetres from the edge of the door magnet and using the included magnet on a plastic mount. I also mounted the magnet and sensor towards the hinge side of the door so the magnet swings in an arc towards and away from the sensor without being in the way when you need to remove items from the freezer.
Another concern is that the sensor harvests its power from light using a solar cell. Wherever the sensor is mounted it must be able to gather enough light to power itself. The best way I could find to ensure that the sensor receives the most light was to mount it with the solar cell facing towards the front of the freezer and the magnet swinging towards the solar cell from the front.
Receiving data from the sensor is quite straightforward once the software is set up. My Element14 blog page at EnOcean Sensor Kit (ongoing) has a setup guide.
When the sensor triggers it sends a pulse indicating the current status (open or closed) which is then sent to twitter. I watch for the open pulse and start a countdown. If I do not receive a following closed pulse within the set time I tweet an alert as well.
My method of parsing the data was to tail the logfile for the sensor (generated by fhem) in a bash script:
#!/bin/bash
tailfile="/opt/fhem/log/EnO_contact_*.log"
s=180
echo log file: $tailfile touch open
tail -f -n1 $tailfile | while read line; do
a=`echo $line | awk '{ print $1}'`
b=`echo $line | awk '{ print $3 }'`
echo $a $b if [ "$b" == "closed" ]; then
c="Freezer door closed at $a"
echo $c
t update "$c"
rm open -f
else if [ "$b" == "open" ]; then
c="Freezer door opened at $a"
echo $c
t update "$c"
r=$(($RANDOM * $RANDOM))
echo $r > open
sleep $s && if [ -f open ]; then e=`cat open`; if [ "$e" == "$r" ]; then c="Check the freezer door, it has been open for $s seconds."; echo $c; t update "$c"; fi; fi &
else
c="debug: $b at $a"
echo $c
t update "$c"
fi
fi
done
The Internet of Things is a brilliant idea and is peaking at the moment. Combining remote sensors with the Raspberry Pi is a great idea rather than dedicating a PC to the task.
I am running my Raspberry Pi plugged directly into my router's USB port and connected via RJ45 cable which saves a socket and is a guaranteed always on connection.
Data could easily be transmitted to sites such as xively.com (formerly cosm and pachube) to show historical records. I created an instructable to do something similar to this a while back and there are plenty of guides available online.
Should anyone request a guide for these devices I will happily do a new instructional post showing how to use xively.
A valid concern is security of the devices - they transmit in the clear and can be read by any Enocean receiver board. Whether this is an issue depends entirely on your own usage.
Note that each device has a key that is transmitted with the data to the receiver and will be unique to that single device. Parsing for that device instead of any valid device is easy.
I am watching intently what is next for IoT technology, there is so much potential for these little devices, especially devices like these which are truly set and forget as they harvest energy from the environment.