Temperature control with LinuxOn hot days it is always good to know the temperature in the server room. Using the solution described in this article you can simply visit an Apache webserver and query the current temperature values.
Of course the range of applications are much wider than only server rooms. A hobby-meteorologist can design an automated temperature control or a gardener can check his greenhouse.
There are temperature control instruments which have integrated a webserver for queries. But they cost about 300 EUR.
This solution takes a certain amount of time but it is much cheaper (about 20 EUR) and can be personalized very well.
The component parts you will need for the circuit are:
- 1 DallasSemiconductor DS1820 temperature sensor
(EXACTLY this identifier!),about 6 EUR
- 2 Schottky Diodes (1N5818)
- 1 Zener Diode 6.2V (1N5234)
- 1 Zener Diode 3.9V(1N5228)
- 1 RS232C female plug for soldering
- 1 resistor 1,5K Ohm
The occupancy for serial plugs with 9 and 25 poles:
|GND||1 and 7
(must be connected!)
While soldering you must pay attention that you connect the right pins to the DS1820. Here is a small but helpful drawing:
It is even possible to connect several DS1820 sensors in parallel to the circuit.
The DS1820 sensors have a unique item id that is transmitted along with the
measurement. The digitemp software by Brian Lane can use several sensors
without any problems.
The config file that will be created by digitemp looks like the following:
TTY /dev/ttyS0 FAIL_TIME 5 READ_TIME 500 LOG_TYPE 1 LOG_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F" SENSORS 2 ROM 0 16 54 147 66 0 0 0 186 ROM 1 16 44 180 66 0 0 0 135I recommend to solder all the component parts directly to the RS232C plug so you can put the case around it. Images of my "artwork":
The software for querying the temperature is available for Linux and Win95. It
was written by Brian Lane (http://www.brianlane.com/digitemp.php) from Nexuscomputing and
is called digitemp.
For the circuit used here you need version 1.3. After you have downloaded the package just decompress and compile it. There is a README file included describing everything in detail.
Now you can start!
First of all, digitemp must recognize the sensor.
This is done by entering:
>> digitemp -s/dev/ttyS0 -iThis command invokes digitemp and it trys to recognize a sensor located at COM1 and read from it. If your sensor is connected to COM2 you'll have to use ttyS1. If this is successful, the sensor's ID will be printed.
Now you can query the temperature with the command:
>> digitemp -a
You can write the values to a log file with
>> digitemp -a -l/var/log/temperatureand read from this file with a PERL script to show the values on a webserver.
You will get very nice results when reading the temperature in chronological order from the log file and display it graphically with a program like rrdtools.
Links to similiar information
- www.brianlane.com/digitemp.php - Digitemp Homepage
- http://people.ee.ethz .ch/~oetiker/webtools/rrdtool/ -Tools for displaying graphs
- http://www.nexuscomput ing.com -Nexuscomputing
- www.brianlane.com - Homepage of Brian Lane
Enter Own Comment