Home Web Temp Sensor
Web Temp Sensor PDF Print E-mail
Written by Erik van Oudheusden   
Thursday, 27 November 2008 07:53
PC Board Terminals 4@$2.49 $0.62ea Radio Shack
Resistor 1,5 kOhm 5@$0.99 $0.20ea Radio Shack
D-sub 9 female connector 1@$1.99 $1.99ea Radio Shack
Circuit Board design kit 1@$19.49 $4.49ea Radio Shack (there is a bunch of DIY out there)
Dallas Semiconductor
DS18S20 Temp Sensor 3@$15.12 $5.04ea www.newark.com
Schottky Diode (1N5818) 5@$0.35 $0.07ea www.newark.com
Zener Diode 6.2V (1N5234) 5@$0.24 $0.05ea www.newark.com
Zener Diode 3.9V (1N5228) 5@$0.24 $0.05ea www.newark.com

Soooooo....One thermometer would cost: $12.71 for hardware, my total cost for hardware was $25.91, I bought spares just in case I screwed something up. The software and Operating System (Linux) are free. I have an old PC laying around, and I might have a laptop if I can fix it.

Then I got the design:

draw01

Reference: http://pihost.us/~stacato/digitemp/

The pins you are going to want are 1 and 2

ds18s20

I then did the old Breadboard test:

temp01
temp02


I then downloaded digitemp for Windows (It was the closest computer with a Serial port) just to test. http://www.digitemp.com/software.shtml

cd to the directory you uncompressed Digitemp to and run digitemp -i -s4 -a (you will have to change the s4 to the com port you are connected to)


Here are the results :

temo03

Sweet Success!


I then etched my board, (go easy, it was my first try at etching)

temp06

I then soldered it all together:

temp07
temp09

Here is the finished product:

temp10

As root on your linux machine: (Everything in `ticks` is run without the ticks; It is assumed that you already have Apache up and running)

1a) For Red Hat and most others:

a) download digitemp v3.6.0 for Linux from http://www.digitemp.com/software.shtml
b) extract digitemp-3.6.0.tar.gz
c) 'tar -zxf digitemp-3.6.0.tar.gz'
d) cd into digitemp-3.6.0
e) copy DS9097 to /usr/bin: `cp digitemp_DS9097 /usr/bin/digitemp`

1b) For Ubuntu:

a) `sudo apt-get install digitemp`
b) `sudo ln -s /usr/bin/digitemp_DS9097 /usr/bin/digitemp` without the ticks

2) run `digitemp -s/dev/ttyS0 -i` (If you are using com2 it would be -s/dev/ttyS1) you should see something like the below:

DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Turning off all DS2409 Couplers.
Searching the 1-Wire LAN
116BDF4C1000CF : DS1820/DS18S20/DS1920 Temperature Sensor
ROM #0 : 116BDF4C1000CF
Wrote .digitemprc
You can now run sudo digitemp -a (you should get results similar to the whats here)
Nov 21 08:38:01 Sensor 0 C: 27.38 F: 81.28

3) Run `digitemp -s /dev/ttyS0 -i -c /etc/digitemp.conf`
This creates the config file digitemp.conf with your sensors.
Watch the output to see what number the sensors get.

4) Check the temperature with `digitemp -aq -c /etc/digitemp.conf`

5) Dump the output data into a file. I dump to a file within apaches wwwroot, that way I can access the temperature from anywhere.
The command `digitemp -aq -c /etc/digitemp.conf > /var/www/digitemp.txt` puts the output of digitemp into the file digitemp.txt

6) Automate this process:
type `crontab -e`, this opens roots crontab.
Type `* * * * * digitemp -aq -c /etc/digitemp.conf > /tmp/digitemp; mv /tmp/digitemp /var/www/digitemp.txt` into that file, and save it.

Creating the graphs:

1) Make a place to put the scripts, a place to store the images, and a place to store the data.
`mkdir /etc/tempsensor`
`mkdir /var/www/temperature`
`mkdir /var/log/digitemp_rrd`

2) Install software:
You will need, PHP and RRDtool.

Red Hat:

`yum install php*`
I got the rpm from http://rpm.pbone.net (I grabbed the latest)
After you download it `rpm -ivh rrdtool-1.2.19-1.el5.kb.i386.rpm`

Ubuntu:

`sudo apt-get install rrdtool`
`sudo apt-get install php` (there are many php packages, install one with a console executable)

3) Download and install the scripts responsible for making the graphs:
Download tempsensor-0.2.tar.gz to your linux machine.
`tar xvzf tempsensor-0.2.tar.gz`
`cp -v tempsensor/* /etc/tempsensor`

4) Configure the scripts
Open /etc/tempsensor/config.php and follow the comments in this file.
Change the script to read input data from "/var/www/digitemp.txt" if you followed the example in the previous step.

5) Automate.
Add a crontab entry the same way as in the previous step. The script should run every 5th minute.
`crontab -e` and add the lines.

The lines should look like this:
`*/5 * * * * php /etc/tempsensor/logdata.php`
`*/5 * * * * php /etc/tempsensor/graphdata.php`

6) Run the scripts manually to check if it works.
`php /etc/tempsensor/logdata.php`
`php /etc/tempsensor/graphdata.php`

7) Visit http://your.ip.or.hostname/temperature or whatever you specified in the config file.

tempsengraph


Here is were the original idea came from....instructables.com
Trackback(0)
Comments (2)Add Comment
0
Link is broken
written by Marc, April 26, 2009
smilies/cry.gif
On the websit Web Temp Sensor the link http://hohenfels.com/tempsensor-0.2.tar.gz is not working
Erik van Oudheusden
...
written by Erik van Oudheusden, April 26, 2009
sorry about that, you should be able to get to it now. smilies/cool.gif

Write comment

busy
Last Updated on Thursday, 04 March 2010 09:50
 
Brew-Fab.com, Powered by Joomla!; Joomla templates by SG web hosting