Temperature measurement with Linux

Simply done, no?

My old office had a medium big Server room with about 60 machines in it. THe AC was pretty much crap and used to die during the weekends which caused havoc on the hardware. So we installed two new ACs. Main and backup but we didn't want to lay our trust into the hands of this new setup. We needed a way to check up on the temperature of the server room in general. What is the best way to go at this? Good question.
Well, one way is to check the temperature of each server. Use the mainboard temp sensors, if available. Hmmm, sure, that is one way to go at it, Each machine being so different though this could turn into a whole kernel recompile for each box. Not only that though. Where do you say what temp is good for what server? Some run hotter then the others, etc etc etc. So we said lets get an overal room reading.
I did some research and stumbled upon digitemp by Brian C. Lane. Check his site out at digitemp.com
Brian C. Lane's solution is wonderful. He uses single wired sensors and a little circuit board to measure the temp. You can add virtually unlimited amounts of Sensors to the setup. Each sensor has it's unique ID which makes sifting through the data realy easy.

But now enough. Behold the creation. The pics on this page are not actual images from my soldering job (i suck at soldering, so it wasnt nice to look at).

Solution for the Hardware hacking enthusiast.

This solution is dead cheap and is guaranteed to earn you lots of geek points. Trust me. Chicks will love it. You will have mad babes cueing up to get some from you ... yeah, ;) Why? Cause, you did some craftmanship AND you are using LINUX to do the hard work. All works out :)

Now, what do we need. You need Soldering Iron, Solder, a circuit board, components, money (bout 15 Euros), a RS232 Port on a PC running Linux, a steady hand, some time and beer. Well, beer is optional but it always comes in handy. (need to cool a burn from hot solder? there ya go. Beverages are not included in the price). Oh, you'll need a Component Vendor aswell. For you in germany give http://www.reichelt.de a try.

This is how it could look like:

  • Professional circuit board
  • A cool Fisherman's Friend box
  • Two Temp Sensors on various length cabling with nifty connectors.

The top solution is ofcourse a pro job. I wouldn't expect you to do it like that. Yours could look more like the following.

here are the things you'll need to buy:

Here you have a diagram:

and here the Circuit layout.(YAY) :

Just to tell you what goes where, I present you the chart. Speaks for itself no ?

Description  DB-25 DB-9
DTR 20 4
RXD 3 2
TXD 2 3
GND 1 and 7 (you GOTS to combine those two!) 5

It's abit more difficult finding the right legs on the sensor, so here a small diagram of which are the correct two on the DS1820:

Now all you gots to do is stick em component pins through the holes, bend and solder. Easy said, easy done. Behold the beauty, or not:

now put it all in a box and you are set.

Multiple Sensores?

As I said it is possible to attach multiple sensors to the whole thing and since my daddy always told me. MORE IS BETTER *wink*wink*nudge*nudge*I show you how it is done. You connect the DS1820 Sensors parallel. Since each one has a unique ID there won't be a confusion later what data came from who. Brian Lane's digitemp program can be told from which sensor to read. (snippet of the config file)

TTY /dev/ttyS0
LOG_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F"
ROM 0 16 54 147 66 0 0 0 186
ROM 1 16 44 180 66 0 0 0 135

The logfile will look like this with multiple sensors:

gatekeeper:/usr/local/bin/digitemp # cat /var/log/temperature
Jul 21 17:10:03 Sensor 0 C: 21.10 F: 69.99
Jul 21 17:10:06 Sensor 1 C: 20.36 F: 68.65
Jul 21 17:20:03 Sensor 0 C: 20.70 F: 69.26
Jul 21 17:20:06 Sensor 1 C: 20.51 F: 68.91

digitemp Program by Brian Lane

The program exists for Linux and *cough* Win32 and was written Brian Lane. (http://www.brianlane.com/digitemp.php)

Get it here for as low as $0.00 - SPECIAL OFFER:

To run it in Linux:

linux # cd /usr/local/bin/digitemp
linux # ./digitemp -a -l/var/log/temperature 
DigiTemp v1.3 Copyright 1997-99 by Nexus Computing

Temperature Log File:

linux # tail -f /var/log/temperature
Jul 20 20:58:49 Sensor 0 C: 19.81 F: 67.66
Jul 20 21:34:06 Sensor 0 C: 18.77 F: 65.79
Jul 20 21:40:03 Sensor 0 C: 18.76 F: 65.77
Jul 20 21:50:02 Sensor 0 C: 18.64 F: 65.55
Jul 20 22:00:04 Sensor 0 C: 18.61 F: 65.51
Jul 20 22:10:03 Sensor 0 C: 18.56 F: 65.42

The Logfile can now be parsed with Perl to make nice little graphs using rrdtools. :


or like this


or like this

(red line is the warning level at which an Email and SMS is send out)

Graph software

Updated info

This said, I hope this helped you. It surely helped me. Now if you get it all done and it works, I guarantee you, you will get laid. If it doesn't work out for you that way, well, obviously the gods are not taking a liking to you. ;-)


This page
was modified:
October 19, 2004
Would like to thank Brian C. Lane for his work on digitemp and the whole group supporting it's devel. Also thank Lena Franken and LinuxNetMag for their great info on how the darn thing is actually supposed to look like. :) Oh, yeah, thanx for their graphics and all aswell, i used them in this page.