Raspberry Pi and sensors

Inspired by the Nest® learning thermostat I want to improve the HomeAutomation capabilities of the Raspberry Pi by adding some sensors to enhance the functionality.

Temperature and humidity sensor
To measure the rooms temperature and humidity and to control the electrical valve accordingly. The reason to choose the sensor DHT22 over the DHT11, is the much higher precision. For example for temperature measures: ±0.5°C accuracy (DHT22) vs. ±2°C accuracy (DHT11). To my believe ±2°C is not acceptable for steering the temperature in a room.
Temp/Hum Sensor
Temp/Hum Sensor (on the right hand side) already hooked up to the T-Cobbler on a breadboard

The Pi should be able to notice whether someone is in the room and regulate the temperature accordingly. Over time the server should be able to build a schedule and maintain this schedule. I’ll use this sensor from adafruit.com
PIR Sensor

IR distance / proximity
With this sensor the server should be able to detect a human being close to itself and enable interaction by making the user inteface available. For the time being I will work with the Sharp GP2Y0A21YK0F and may move to a DIY version later on.
IR Distance Sensor

Adafruit T-Cobbler

One great feature of the Raspberry Pi is the extendability via the GPIO pins. I’m using a case around the Pi, while this is a good solution to avoid issues with shortcut circuits on the other hand the access to the GPIO is more complicated and involves in almost all cases disassembling the enclosure. Luckily I found the solution for me on the adafruit.com website, the Adafruit Pi T-Cobbler Breakout Kit for Raspberry Pi.

As the title says the T-Cobbler comes as a kit.
Adafruit T-Cobbler Kit

The kit includes a 26 pin ribbon cable, a custom PCB, ribbon cable socket and header pins.
Adafruit T-Cobbler Kit unpacked

A closer look at the PCB shows how nicely the cobbler transfers the GPIOs to the breadboard. For me this better overview is the major advantage of the T-Cobbler over the standard cobbler from Adafruit. Please also note that the changes between the Raspberry Generation 1 and Generation 2 are reflected properly [PIN #21 (v1) vs PIN #27 (v2)].
T-Cobbler PCB

I started the soldering with the ribbon cable socket and used some sticky tape to keep it in the correct position.
T-Cobbler soldering

Then I connected the Header Pins to the breadboard and soldered the PCB to them.
T-Cobbler soldering 2

Finally I took apart the enclosure (hopefully for the last time) and connected the GPIOs of the Raspberry with the ribbon cable to the cobbler and than to the breadboard.
Raspberry Pi Breadboard

Raspberry Pi as HomeAutomation server

Finally my Raspberry Pi has arrived and I want to use it as the server for the perl based HomeAutomation server fhem http://fhem.de/fhem.html.

Therefore my Pi has been upgraded with a micro USB WLAN stick and a CUL device from Busware http://busware.de/tiki-index.php?page=CUL running culfw http://culfw.de/culfw.html

Raspberry Pi overview

For the fhem set-up I followed the installation instruction as described under http://www.fhemwiki.de/wiki/Raspberry_Pi and this worked like a charm

The installation of the culfw firmware was a bit more tricky, but with the following steps I was able to flash the CUL to the latest version.

Download the firmware
sudo wget http://culfw.de/culfw-1.46.tar.gz
and unpack it
sudo tar -zxvf culfw-1.46.tar.gz

Change into your device directory (e.g. Devices/CUL)
cd /home/pi/CUL_VER_146/culfw/Devices/CUL
Install the package dfu-programmer
sudo apt-get install dfu-programmer
Insert the device into the USB slot while pressing the micro-switch
Finally execute
sudo make usbprogram_v3 V3 to be used for CUL V3.
After flashing the CUL, a new USB device should appear: “03eb:204b Atmel Corp.”. If not re-insert the device without pressing the micro-switch.

The server is now up and running since several days.  For the time being the server is just listening to the FS20 traffic in the air and logs it.


I’m using the S300TH temperature/humidity sensor in the working room for test purposes and got myself a FHT80TF-2 door/window sensor and a FHT8v electric valve controller as test devices.

Breadboard and test devices

I want to control the FHT8v directly from this server without the need to use the FHT80b device which is originally intended to steer the valve controller. Normally this should be straight forward but a first test was not successful. I will publish the results once I have it running.

Enclosure for the Raspberry Pi

Now with the arrival of my Raspberry Pi scheduled for Monday November 26th 2012, it was a perfect timing for the delivery of the casing.

Raspberry Pi casing parts

Raspberry Pi casing

The tolerances of the parts seem to be a bit too low, I was reading on Amazon that quite a few people managed to break off some of the clips while putting the parts together. I will try to modify the parts slightly to make them fit better, before finally assembling it.

With this delivery everything is in place for the Raspberry Pi. The SD Card is loaded with the latest Raspbian image and all wires are ready to be hooked up to the Pi.