TomTheGeek

All the geeky stuff that gets me hot.

Monday, December 10, 2007

Environment monitoring with 1-wire sensors

I was looking for a solution to monitor our server room's temperature over a serial port and discovered the world of 1-wire sensors. 1-wire stuff is fantastically simple and has a wide variety of sensors and switches. The basic idea is that you can hook a large number of sensors to a pair of wires ( ground + data, hence 1-wire ) and can individually target and read each sensor.

Here you see the circuit I constructed as a 1-wire serial port adapter. The 1-wire sensors are run in parallel from the RCA connector. RJ-11 might have been a better connector to use in hindsight since the cabling is cheaper but it would be an easy retrofit if I ever want to expand my network. Right now I only have 1 temperature sensor (shown below) so the RCA connector is adequate.

The label you see on the side is a unique 64-bit address burned into each sensor. This is equivalent to the MAC address on a network card. The actual sensor is just a three pin through hole mount similar to many transistor packages. It's small enough that I was able to fit it entirely into the connector housing with a hole open on the end so that it's still exposed to the environment.

This is the final 1-wire adapter with sensor attached. It's not quite how I imagined it as I have to use an extension serial cable to hook it up instead of plugging the whole thing right into the serial port but it works and I can always change it later if I run into an appropriate connector. Ordering parts online is always a crap shoot unless you can see a picture. The whole setup cost under $10 and I can expand it to use more sensors if I want. All I would have to do is build/buy some RCA extensions and splitters.

The output of the whole system is the graph you see below. Not terribly exciting to say the least but considering the cost of the project it's pretty neat. I'm thinking about adding some window sensors for a cheap alarm system. Email notifications can be added to the polling script to notify you of any sensor conditions. In our server room the system is set to notify the IT staff if the temp gets any higher than 85F or below 55F. I doubt the server room would ever get below 55F but if it does it's a pretty good indicator that something has gone seriously wrong!