The Gory Details
This design is targeted for corporate machine rooms, so the temperatures involved are not expected to be too far from room temperature. Additionally, the customer wanted to make sure the device could be used on Linux systems. Everything works on Windows (sort of), but any self-respecting machine room will have some old Linux box kicking around (yes, even at IU!). Finally, keep it cheap.
Choosing the Sensor and the Data Acquisition Platform
In the design, we found that getting a decent temperature sensor was really easy. The LM35 is a great cheap part, requiring only one resistor for an A/D connection. The A/D connection is another matter altogether. There are a great number of possibilities for this. There are serial (RS232) systems like the old Hot Little Therm (the old standby in this arena), to cheap USB DAQ (data acquisition) systems, up to full blown PCI LabView-aware DAQ systems. Clearly LabView-aware systems are ridiculous solely for this application. The Hot Little Therm has long been discontinued. So we tried a cheap USB DAQ system. In truth, the USB DAQ system is also painfully overkill for this application. At the time of design, it was a reasonable choice for around $100.
The chosen DAQ unit is Measurement Computing's USB-1208LS. Providing 8 channels of 12-bit analog input, 1.2 kS/s, two D/A outputs and 16 DIO bits, the USB-1208LS does much more than we need. But it is cheap and fun to work with. There are a number of other vendors out there that make similar devices such as the National Instruments' USB-6008. Costing 30% more than Measurement Computing's USB-1208LS, the NI USB-6008 looks suspiciously similar. It also has very similar specs. I hope to evaluate the NI USB-6008 at some point.
The Hardware
Below is the schematic for the USB Thermometer.

The LM35 provides a voltage level based on the temperature on the output pin which is connected to the 1208LS pin1 (CH0 High). The 1208LS pin3 is ground, which is connected to the ground pin of the LM35 as well as the low side of channel 0 (pin 2 of the 1208LS). The only other item is an 80K Ohm pull-down resister between the pin 1 (CH0 HI) and ground (pin 3 of the 1208LS).

As for the LM35, the final product has the LM36 soldered to an old phone cord and dipped into plastic dip to protect it. The use of plastic dip turned out to be a real help during testing as we could drop the LM35 into hot/cold water without fear.
The Software
The libusb driver for the 1208LS for Linux can be found here. There are sample programs to start with. For this application, we created a simple executable written in C which calls the device, fetches the value from the DAQ device, calculates the temperature in celsius, then recalculates in Fahrenheit, then prints the values to the console. Of course, using libusb requires root. Our customer's application used a monitoring and notification system called Nagios (which braingrove deployed). Properly configured, Nagios could check the machine room temperature, go into alarm if warranted and notify via email or pager if required. The first interesting part of the code are the lines that initializes the USB connection:
usbDConfigPort_PMD1208LS(fd, DIO_PORTB, DIO_DIR_IN); usbDConfigPort_PMD1208LS(fd, DIO_PORTA, DIO_DIR_OUT); usbDOut_PMD1208LS(fd, DIO_PORTA, 0x0);
These lines set port B as inputd and port A as output (not required for our application). The next important lines do the real fetch.
channel = (__u8) 0; // set channel to 0 gain = BP_1_00V; svalue = usbAIn_PMD1208LS(fd, channel, gain); // get value on channel 0 with gain of 1V svalue = usbAIn_PMD1208LS(fd, channel, gain); // get value on channel 0 with gain of 1V
The channel is set to 0 (CH0 in as pin 1) and the gain is set to 1v. Note that the fetch of the actual value is called twice. This is to get around a bug where the first call always gives erroneous data.

