Posts

Showing posts from May, 2009

openwrt stuff

Config changes to the openwrt to make it work: problem : pachube did not recognize my xml file as xml solution : create a /etc/httpd.conf file with this line: .xml:application/xml problem : need to start at boot time the process that reads from serial port solution : follow this tutorial: http://oldwiki.openwrt.org/CustomStartupScripts.html problem : enable cron solution : follow this tutorial: http://oldwiki.openwrt.org/HowtoEnableCron.html

Pachube rules

The whole Pachube concept is amazing, so many cool things made so simple! (...well, some of them not simple enough for me...) The pachube feed is on. I have been struggling for a while with the xml system of putting data to the pachube site, finally decided to track back and start with the more simple csv system. And so this very simple sh script is uploading the temperature every 300 seconds: #!/bin/sh while [ 1 ] do temp=$(grep -m 1 "temp" /dev/ttyS0|cut -d "=" -f 2) curl --request PUT --header "X-PachubeApiKey: your-key-here" --data "$temp" "http://www.pachube.com/api/1931.csv" sleep 300 done This is an example of the very cool things you can find in the Pachube site:

The temperature sensor

Image
I have soldered the DS18S20 sensor to a cat5 cable, inserted the sensor in a small plastic bottle and sealed everything with silicone. Ugly, uh? After doing it I thought I should have filled the bottle with some stuff that is not electricity conductive but conduces heat... Something like vaseline might work... need to Google a bit for this. For now the silicone needs to dry up. Also decided to use perl instead of php, I am more familiar with it and took me no time to set-up a script to read the serial port and write a html file: (will paste the code when I can figure how to make the blog ignore the html code embedded) #!/usr/bin/perl -w -I /usr/lib/perl5/5.10/CGI open( SERIE, "/dev/ttyS0" ) or die "no abre serie"; while ( <SERIE> ) { if( ($temp) = /(d+.d+)/ ) { $date = `date '+%d-%h %H:%M'`; open( OUT, ">/www/lwa/index.html" ) or die "no abre index.html"; print OUT "<html>

The prototype

Image
The prototype is ready, this is the picture: and this is the Arduino program . This is how the output looks: root@OpenWrt:/usr/bin# cat /dev/ttyS0 1 temp_c=22.00 2 temp_c=22.00 Led OFF 1 temp_c=22.00 2 temp_c=22.00 Led OFF The LED will light if temperature in sensor 2 goes above a set limit. You can also switch on and off the led from the fonera, sending an I or an X : root@OpenWrt:/usr/bin# echo I > /dev/ttyS0 The Fonera is the 2200 version, I installed openwrt kamikaze: root@OpenWrt:~# uname -a Linux OpenWrt 2.6.26.5 #21 Sat Feb 14 23:12:28 CET 2009 mips unknown The serial connection was giving me trouble, as openwrt uses the only Fonera serial port for console, so the login prompt was interfering Finally found how to disable the login prompt at the serial console: root@OpenWrt:~# cat /etc/inittab ::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K stop tts/0::askfirst:/bin/ash --login # disable login in console to release serial port #ttyS0::askfirst:/bin/ash --login

The Goal

The purpose of this blog is to document the progress of my project to track the solar warming of the swimming pool. The solar panel is a very basic black plastic panel connected to the swimming pool filter circuit. So when the water is filtering, a portion of it is bypassed through the solar panel, warmed by the sun, and returned to the swimming pool. I want to do this: measure and record the initial water temperature measure and record the water temperature after going through the solar panel visualize everything in the internet, and display graphs Stretch targets: if the temperature after warming is lower than a set limit, close the warming circuit by operating an electrovalve with Arduino ability to change the temperature limit from the internet abilit to close the circuit manually from the internet record the weather temperature and wind speed, to track the cooling effect of wind and nights record the water flow with a flowmeter (need to find one that can be read from Arduino) buil