Hi All

This might not be completely on-topic, but hey, you might learn something.


On 30 Oct 2008, at 23:44 , Sebastien LELONG wrote:

A logger which logs temperature, humidity and CO2 levels to a PC

serial port. The PC makes a gnuplot graph on request of a webpage (Do

you know how to tie python scripts to webservers? Please tell me!)


Search mod_python for Apache.

I also use a lot cherrypy, full python-based. Nice to build small apps. 


I'm a bit lost in the mod_python documentation: the "hello world" example is baffling. Where is the HTML code?

OK, here is what I want.

My PIC spews out a serial log:

Serial data from PIC16F876A powered CO2 & humidty logger
3-11-2008 17:25:00 941  18.25 62.01
3-11-2008 17:30:00 963  18.31 60.71
3-11-2008 17:35:00 962  18.31 61.65
3-11-2008 17:40:00 950  18.00 60.04
3-11-2008 17:45:00 904  17.81 61.31

I can already make nice gnuplots, see attach. Yes, the linewidth sucks, that is a gnuplot 4 problem. I'm on FreeBSD 6.3, which has troubles with gnuplot.
Anyway, the graphs shows het central heating system kicking in at 08:15 and my father entering the office at 09:00. at 22:00 I start working at my Mac, this time much closer to the CO2 sensor. 

What I want is  web page that displays:

Time 17:45:00

CO2 904 ppm Temperature 17.81C Humidity 61% 

GRAPH

Where the values are read form the last line of the log file and the graph is generated on each refresh. I plan to have a cron job that fires up a python script that writess a new gnuplot file every day, say today.plt, as:

set terminal png size 800,600
set title "CO2, temperature and humidity on 03 nov 2008, Fiwihex office, Almelo"
set output "today.png"

set xdata time
set timefmt "%H:%M:%S"
set format x "%H:%M"

set yrange [0 : 30]
set ytics nomirror 0, 5
set ylabel "temperature C"

set y2range [0 : 3000]
set y2tics 0, 500
set y2label "CO2 ppm"

plot "2008_11_03.log" using 2:3  with lines lt 7  lw 3 ti "CO2 concentration" axis x1y2,\
"2008_11_03.log" using 2:4  with lines lt 5  lw 3 ti "Temperature",\
"2008_11_03.log" using 2:5  with lines lt 6  lw 3 ti "Humidity"


Where al the dates will be updated. So I keep a named graph (copied to a specific name at 23:55) and a named log for every day. The index.html file just points to the today.png.


So do I tell mod_python to write a  new index.html file at every refresh? If so, how? If not, how should it be done?

Ob_topic: if all of this works, I'd like a place to put it all. 

A PIC project is seldom only JAL and a schematic. If your PIC is not tied to the internet, how can others be sure it even exists?
How can you be sure? Computers that are not connected might as well be no computers at all, nobody will notice them. 



---

ir EE van Andel [EMAIL PROTECTED] http://www.fiwihex.nl

Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands

tel+31-546-491106 fax+31-546-491107


Reply via email to