For the heating system, I have used:
- A Raspberry Pi model B: Raspberry Pi model B.
- DI.O devices produced by Chacon that permit the radio transmission at 433MHz: Kit 3 prises.
- Aurel RF transmitter: Aurel RF. But there is a less expensive solution on Ebay that works as well: 433 MHz Transmitter.
- A DS18B20 temperature sensor: DS18B20 sensor.
- Some wires :).
- Optional: for an elegant solution, and if you plan to use Raspberry for other projects, I have used the Adafruit Prototyping Pi Plate Kit for Raspberry Pi: Pi Plate.
- Optional: a half-size breadboard: Mini breadboard.
- The best tutorials (in my opinion) on how to setup Raspberry Pi and other basics, here: Adafruit tutorials Raspberry Pi. I am using Debian operating system on the Raspberry device.
- The Adafruit’s tutorial on how to connect the DS18B20 sensor to Raspberry Pi: DS18B20 sensor to Raspberry Pi.
- A tutorial of how to connect the RF transmitter with Raspberry Pi: RF module to Raspberry Pi.
For storing the data provided by the temperature sensor I am using
the w1 interface of the sensor, like in the tutorial proposed by
Adafruit. These values are saved in a file *.rrd (hometemp.rrd), since I
will use RRDTool for the design of my graphics. To install RRDTool,
type in the command line: sudo
apt-get
install
rrdtool
I also used Pearl scripting language for grabbing the outside temperature. To install it: sudo
apt-get
install
libwww-perl
The Pearl code for reading the temperature data in Celsius from the sensor (get_temp.pl): get_temp.pl
To find a metar station nearest you, use this list of stations http://weather.rap.ucar.edu/surface/stations.txt and replace the ICAO code KMSN with the ICAO code of the station you would like to use at end of the $metar_url vairable.
Since now we can collect all the temperature information in the hometemp.rrd
file. Next, we will use RRDTool to create beautiful graphs and to
visualize them. After creating the graphs we will use them in the
Android interface via Openremote platform (Openremote). The first thing to do is to download the Openremote Controller 2.1.0 (!!! The oldest ones may not work): Openremote-Controller-2.1.0.
After you unzip it, you need to transfer it to Rasperry Pi. The most
simplest solution for doing this is FilleZilla, of course :): FileZilla
. Then, you just need to specify the IP address of Rasperry Pi, its
login username password and the port (22 for ssh) and to transfer the
unzipped folder to a folder of Rasperry Pi (for me is in home folder).
Once you have the Operemote-Controller folder on RaspberryPi (mine is in /home/pi/), we will create the graphs that will be used in the interface. My solution is here (create_graphs.sh): create_graphs.sh
Don’t forget to make everything as executable (chmod +x filename.sh)
and to test it before :)
Let’s design the Android interface! First, Sign up in the Openremote online Composer: Openremote-composer
After this you will see the blank-page Modeler.jsp. Click on UI Designer, then New Panel. Define the Panel Type (Android or Iphone) and choose the dimensions. Then New Screen. Design the buttons as you want.
For the moment, we don’t link the buttons with the RF transmitter module. We will just get the created graphs from Raspberry. To do this, you just need to specify in the URL section the location of your images. The code I provided put the images in home/pi/OpenRemote-Controller-2.1.0_SNAPSHOT-2013-06-17/webapps/controller. I recommend to let it like this. So, the location will be: IP_address_of_RasperryPi/controller/temp_daily.png for the graphics that show the daily change in temperature. You can do this for other graphics (temp_monthly.png, temp_daily.png, temp_yearly.png).
- You need to download OpenRemote on your mobile device. It can be found on Play Store. After installation, you need to give the address of the controller IP_address_of_RasperryPi/controller.
- Also, to synchronize the OpenRemote Designer with the OpenRemote Controller, you need to open the webpage of the controller: IP_address_of_RasperryPi/controller, to login and to press Sync with Online Designer.
Here is the C++ code to control the DI.O devices: C++ code for DI.O control. You need to compile it. Or you can simply use my compiled version: DI.O control after compilation. After compilation, you need to:
- Create a script like this: lampe_on.sh
- 0 12325261 – the ID: you can let it like this or change it, 2 – is the second DI.O that I have chose to control the lamp.
- make your lampe_on.sh executable, connect the DI.O device to power supply and just after (at approximatively 2 seconds) sun the executable. Like this, the code will be transmitted to the DI.O device.
- Create a lampe_off.sh script.
- Now you can control everything in your house by just executing some shell scripts.
- To be able to control then via OpenRemote interface you need to login again to OpenRemote Designer, then you chose Building Modeler->New->New Command and you choose Shell execution protocol as protocol.
- To link your created command with the interface you go to UI Designer of OpenRemode Designer and after creating a button, you precise the desired command.
- You need to do this with every device you want to control in your home :)
- Do not forget to synchronize the design with the Openremote Controller !!! Otherwise nothing changes.
- You can also have multiple screens.