Denman Island, British Columbia
Temperature Sensor |
This is the device I use to make the automatic observations on my temperature page. It is the essence of simplicity itself.
Most surplus PCs have a game port that is not being used. A game port expects to see four variable resistors. A thermistor is a resistor whose resistance varies with temperature. Put the two together, add a bit of software, and voilà.
PC game ports use a crude time-based method of analog-to-digital conversion. The game port analog channels each expect a 100 KOhm variable resistor. This resistor connects to a capacitor at one end and to +5V at the other end. Consequently, the capacitor remains charged to 5 volts.
When the software wants to sample the channel, it momentarily shorts out the capacitor, discharging it to 0 volts. The program then goes into a loop while the capacitor recharges through the variable resistor. When the software detects that it is fully charged, it breaks out of the loop. The time required to recharge the capacitor depends on the value of the resistor. The number of times the loop was executed is a measure of the resistance.
If there is no resistor connected to the channel, the capacitor will never recharge. The software must anticipate this and break out of the loop on its own after a predetermined number of iterations.
The timing loop is sensitive to CPU speed. Software that runs properly on a slow CPU will reach its timeout much too soon on a faster CPU, causing the program to think that there is no joystick connected. This is why there is a "turbo" switch on many PCs - so you can slow down the software to match the game port.
If you connect a 10 KOhm variable resistor instead of the expected 100 KOhm resistor, the capacitor will charge faster than normal. On a fast CPU, this is no problem. On a slow CPU, the timing loop may have counted only a few ticks, so the sensitivity will be low. (If the maximum resistance gives five ticks, then the port can only sense six discrete values: 0 - 5.)
I used a Radio Shack thermistor (Part number: 271-110) with a nominal value of 10 KOhm. Since this is well below the design range for the game port, I actually used two of the thermistors in series to improve the sensitifity at high temperatures.
Calibration was purely empirical. Whenever the temperature reached a new high or low that was outside the previously calibrated range, I would recalibrate by telling the program the current temperature, read off a thermometer adjacent to the sensor. Obviously, it takes 12 months to calibrate an outdoor thermometer this way. The result is a file of data points, each consisting of a timing loop count and temperature. Between these values, the program simply performs a linear interpolation.
The highest (+38°)
data point is a guesstimate only.
All others including the lowest (-37°) are actual observations.
Data points above +10°C and below -20°C are estimates based on DOS data (above).
All others are actual observations.
Home
Copyright © 2005 Keith Walker
Last modified: 7-Jan-2005