EDN logo


Design Ideas: December 21, 1995

Remote temp sensor needs no power supply

Wes Freeman,
Analog Devices Inc
Santa Clara, CA


fig 1 thumbnail

Measuring temperature at a remote location is a common requirement, but the implementation is usually not straightforward. Most temperature sensors have a voltage or current output, which, to minimize noise pickup, should undergo conversion to digital form near the sensor. Thus, an ADC, a digital interface, and a power supply must all be situated at the temperature-measurement point. The circuit in Figure 1 monitors the temperature at a remote location and transmits that temperature to a host computer.

The data transmission takes place over an RS-232C line, which is available in most computer systems. Because the circuit requires only about 1 mA of supply current, the RS-232C line can supply the power, eliminating the need for a separate power supply. Temperature sensor T1 directly converts temperature to a pulse-width-modulated digital output. The sensor’s nominal output frequency is 35 Hz at 25ŚC. Therefore, the relatively slow rise and fall times of the RS-232C protocol do not adversely affect system accuracy. The output of IC1 arrives at the host computer on the data-set-ready (DSR) input. The host computer monitors the DSR line to determine the output pulse widths and then calculates the temperature using the formula

where t1 is the time IC1’s output is high and t2 is the time the output is low.

Power for the circuit comes from the ready-to-send (RTS) output. RS-232C levels are typically about ±10V but can be lower in laptop computers. The circuit’s low supply current ensures proper operation even when the RTS output voltage is as low as 6V. Normally, IC1 operates with its ground pin connected to the power-supply ground. However, ground is not a convenient reference point in this circuit, because the RS-232C signal must swing above and below ground. To eliminate complicated level shifting, IC1’s power-supply pin connects directly to the RTS "power-supply" line.


Remote Temperature Measurement
`Program to measure temperature at a remote location,
`    via a TMP04 attached to COM1:
CLS
'Define the Serial Port Address
serialport = &H3F8

rtscontrol = serialport  + 4
dsrstatus = serialport  + 6
'
'Turn on the RTS output by setting bit 2 in register 4
portval = INP (rtscontrol)
OUT (rtscontrol), portval OR &H2

'Measure the temp sensor duty cycle
PRINT "Measuring temperature..."
PRINT "   t1", "   "t2", "Temperature"
l = 0: h = 0
'Align the timer routine to the rising edge of the sensor output
DO While a =  INP (dsrstatus) AND &H20

LOOP
'Measure t1 and t2
For x = 1 to 10000
a = INP (dsrstatus) AND &H20

IF a >  0 THEN h = h + 1 else l = l + 1
NEXT x
'Print temp sensor duty cycle measurements, and the temperature
PRINT l , h
PRINT USING "###.#"; (245 - (420 * l / h)); : PRINT " deg C"
'Reset the RTS output
OUT (rtscontrol), portval XOR &H2

END

Zener diode D1 limits the supply voltage across IC1 to 5.1V, and R1 limits the current through D1. The sensor’s digital output swings rail to rail, so this arrangement provides a –5.1V gate drive to the p-channel FET, Q1. When Q1 is on, it pulls the DSR line to the RTS potential. When Q1 is off, R1 pulls DSR about 2V below ground. To power up the circuit, the host computer simply sets RTS to its high (10V) state and DSR to its low (–10V) state. It then measures the t1 and t2 periods using a hardware counter or a software loop and calculates the temperature using the cited formula.

Typical microcontrollers, such as the 8051 and 68HC11, have on-chip counters that can accurately measure the sensor’s t1 and t2 periods. However, you can also use a Basic program for a simple evaluation of the circuit. Although Basic is usually not fast enough for real-time measurements, integrating a large number of readings can produce reasonable resolution. Listing 1 shows a program written in QBasic. The program repeatedly reads the DSR status bit from the Com1 port and increments one counter if DSR is high or a second counter if DSR is low. The program accumulates readings for several seconds to provide useful resolution. (DI #1802)



| EDN Access | feedback | subscribe to EDN! |
| design features | out in front | design ideas | departments | products |


Copyright © 1995 EDN Magazine. EDN is a registered trademark of Reed Properties Inc, used under license.