Sunday, July 25, 2010

1-wire digital temperature sensors

I read about 1-wire sensors from Dallas Semiconductor (now produced by Maxim) back in college in the mid-90's, but I've never had the chance to play with them. The principle is that many sensors can be strung along the same wire like Christmas lights, creating a mini network. A computer or microcontroller can poll the sensors using a single port, eliminating the need for multiple analog-to-digital converters or complex switching circuitry to monitor many sensors.

Each sensor has an electronic serial number, so the computer can tell them apart. The sensors all share the same data wire, and they all "suck" power from that same wire (referred to as "parasitic" power), making it very easy to connect many sensors.

This is exactly what this project needs! With 1-wire sensors, I can log all the system temperatures automatically in real-time. And at less than $5 per sensor, I can put them all over the place and monitor any interesting temperature in the system that I want!

I wanted to keep the temperature sensing cheap, simple, and compatible. And I didn't want to spend an entire weekend getting the sensors to work. So I chose the iButtonLink "LinkUSB" 1-wire reader. This is a USB device, so it works on any PC without adapters, but it emulates a serial (COM) port and is compatible with software designed for the original Maxim 1-wire readers.

Nothing is ever easy, so it actually took me a day or two of e-mails with iButtonLink to get the device working properly. It turns out that there are slight differences between the LinkUSB and the older native Maxim serial reader, and recent updates to the Maxim-provided drivers crippled the LinkUSB. They helped me find the older (version 4.02) drivers that work fine here:

http://files.dalsemi.com/auto_id/licensed/files_1_wire_drivers_v402.zip

...and the Windows command-line utility bm_demo.exe here:

http://www.ibuttonlink.com/ExperimentalSoftware.aspx

I wrote a simple scheduled batch file using my favorite add-on Unix utilities to poll the sensors, append the raw data to a log file, and convert the data to a comma-delimited (CSV) format with headers for Excel to read. The Unix utilities grep, sed, tail, and cut are really helpful tools in Windows batch files! This could be done with native batch commands, but I'm more comfortable with the original Unix versions.

Next, I used Excel's "Get External Data" feature to point a worksheet at the CSV file and auto-update every minute.

Now, the tables, graphs and diagrams in the Excel spreadsheet will be able to auto-update throughout the day showing the current data!

This is quite a step up from my original plan of manually connecting a digital meter to various individual sensors every time I wanted to take a measurement.

Here are some photos of the sensors going together:

Sensors in various stages of progress:




Sensors mounted in PEX plugs, almost ready to add to a "Tee" fitting. I used plumber's epoxy (a 2-part epoxy resin that you knead together and form like putty):



A sensor plug crimped onto a short piece of PEX, ready to crimp onto a Tee:



Sensor visible through open end of Tee:

No comments:

Post a Comment