Stelios's Place

A place for thoughts and ideas

Home Monitor

[ Click to see live data! ]
   The main purpose of this project (the whole idea) is to be able to monitor varius aspects of my home while I am away. The project is a form of Web-Enabled Temperature Monitor. This project' is not security oriented, it just displays data on an image.

   The projects is based around the PicAxe microcontroller and the Dallas DS18B20 temperature sensor. It's also using PHP for image creation and Perl/Python for data retrieval from the RS-232 serial port.

   The central mechanism is a PicAxe 08M micro controller (uC) probing the thermometers and then pushing the data through a serial connection with a PC. A Python script running on the PC reads the data and it's pushing it to a backend PHP script on the Web Server (postdata.php). The PHP script stores the data in a text file (temp.txt), so the next time  someone refreshes the page the image is created based on the data in that text file.

   In the final version the PC will be replaced by a modified wifi router (like the Linksys WRT54G) that is running OpenWRT and has a TTL serial connection onboard. This router will act as the Internet gateway for the PicAxe chip. I could have used Lantronics Xport to do the same trick but thew wifi router cost me less money. The wifi router I'm using is a Buffalo WBR2-54G. A Python script inside the wifi router will post the data to the Internet. You can see pictures of the modified wifi router here and here.

   The process of retrieving data and displaying it dynamically on the web page can be seen in the block diagram bellow:

[ Homemonitor Block Diagram ]

Further analysis of the block diagram:

  1. The PicAxe 08M chip is retrieving data from the Dallas DS18B20 temperature sensor. The data is  then sent though an RS-232  serial connection to the openWRT based wifi broadband router.
  2. On the wifi router there is a small Python script that reads the serial port's data and sends it to the web server over the Internet connection. For each data that the script is receiving the wget utility is called and a special URL is opened (postdata.php) in order for the data to be posted to the web server.
  3. The PHP running on the webserver receives the data by extracting it from the URL (HTTP GET) and then stores it in a file (temp.txt).
  4. When the page is requested, another PHP scripts generates the image based on the temperature values of the file temp.txt

   Please note that the house image displayed in the web page is actualy created by hand.  This is the base image used by the PHP script on the server to create along with the thermometer images the final image.

Comments and suggestions are welcomed.