This is a translation of my post on measuring temperature with linux, written in German.

The Idea

There are several possibilities to measure temperatures with your computer. 1-Wire sensors like the DS18S20 offer a simple and affordable solution, as it digitalizes the temperature directly inside the sensor and offers an easy interface to query the result. Hence there is no need for analog circuitry or calibration. A comprehensive article on how to wire the sensors to the computer's serial port can be found here. Then there also is the datasheet of the manufacturer as well.

Soldering up

A couple of weeks ago I soldered together a bunch of electronic parts and now I can use my computer to measure room and outside temperatures. For detailed schematics I referred to the aforementioned article.

Part List

  • Any amount of sesors DS18S20 (exactly this part!)
  • One diode 1N5817 per sensor (optional to reduce glitches)
  • Two 1N5818 Schottky diodes (also known as hot carrier diodes)
  • One 1N5234 6.3 Volt zener diode
  • One 1N5228 3.9 Volt zener diode
  • One 1.5 kΩ resistor

Multiple sensors can be hooked up in parallel and 3.5mm stereo jacks are a good option for that. When connecting a larger number of sensors the parasitical power supply will be insufficient and an active power source will be needed. For this purpose, the third pin of the stereo jacks will come handy.

To reduce glitches, you also can solder a 1N5817 diode directly onto the sensor between GND and DATA so that it is open from GND to DATA and blocked from DATA to GND.






Software

Soon I am going to post a tutorial on how to use Metricfire to plot the measured temperature values into nice graphs.

Digitemp

For starters you can use Digitemp to verify the sensors work correctly. First you have to create a configuration file by running

pimp@eekkater:~$ digitemp_DS9097 -i -s /dev/ttyS0
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
10AC010202080029 : DS1820/DS18S20/DS1920 Temperature Sensor
1032D4010208008F : DS1820/DS18S20/DS1920 Temperature Sensor
ROM #0 : 10AC010202080029
ROM #1 : 1032D4010208008F
Wrote .digitemprc

This will add all sensors to the configuration file for future calls. Afterwards you can query all sensors at once with digitemp_DS9097 -a.

pimp@eekkater:~$ digitemp_DS9097 -a
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Apr 10 00:43:59 Sensor 0 C: 11.94 F: 53.49
Apr 10 00:44:00 Sensor 1 C: 21.88 F: 71.38