Digital Temperature Measurement System Based on Oscillator

advertisement
Digital Temperature Measurement System
Based on Oscillator*
Ling Zhu
Electrical Engineering Automation Department of Zhejiang University
Lilac9152@163.com
Abstract. To solve the conventional temperature measurement system’s
problems, such as lots of hardware, high cost, poor Anti-interference ability, a
new temperature measurement system based on oscillator is designed. This
system, which takes negative temperature coefficient thermistors as
temperature-sensing and goes through ring oscillator RC, will reflect the change
of the temperature to the change of the pulse cycle. Error compensation and then
LED display is done through the single-chip microcomputer timing/counter
measuring pulse cycle and then processed by the software. The system, using the
minimum hardware circuit design, is characterized by its simple circuits, low
power consumption, low cost and reliable function. It is especially suitable for all
kinds of intelligent household appliances.
Keywords: negative temperature coefficient thermistors (NTC), RC ring
oscillator, microcontroller, temperature measurement.
1
Introduction
Different temperature sensors, such as sensor thermocouple, thermal resistance,
thermal resistance of semiconductor are commonly used to measure temperature while
negative temperature coefficient thermistor (NTC) is used on the room temperature
zone. Negative temperature coefficient thermistor is characterized by high sensitivity,
small size, fast response and low cost. The resistance will change obviously as the
temperature changes. The paper presents a new method of temperature measurement,
using NTC as the foundation and oscillator RC as the key.
The conventional measurement, according to different methods of analog to digital
conversion, can be divided into two categories; one is analog-to-digital conversion with
AD chip, which is composed of testing circuit, amplifying circuit, A / D conversion
circuit and single-chip microcomputer. Through the NTC and the detection circuit,
output the simulation of weak voltage corresponding to the temperature, which is
converted to digital signal by A/D after being amplified. The temperature is measured
through the single chip computer data processing of the digital signal. The other is to
*
2011 Zhejiang University Students’ Scientific Research Training Plan(7672).
D. Jin and S. Lin (Eds.): Advances in CSIE, Vol. 2, AISC 169, pp. 461–466.
springerlink.com
© Springer-Verlag Berlin Heidelberg 2012
462
L. Zhu
use V / F chip to replace the A / D chip. Their shared defects are complex structure,
high cost and lots of hardware.
2
Principle of Temperature Measurement
The principle of RC ring oscillator [1] is shown as in Figure 1. In the figure, Rt is
negative temperature coefficient thermistor, Rs current-limiting resistor. The output
voltage waveform of the VO is shown as in Figure 2. It is a rectangular pulse, period T =
2.2RtC [2]. C is a constant. So the resistance of the Rt will change as the temperature
changes, making period T of the oscillator output pulse change. By detecting the pulse
period T, the environment temperature of the thermal resistance can be measured,
which is called the realization of temperature. Compared with the conventional
measurement circuit, the new method has the advantages of less hardware, reduced cost
and greatly improved reliability of resisting disturbance because of the pulse signal.
Fig. 1. RC ring oscillator schematic diagram
Fig. 2. VO waveform voltage
3
Hardware Circuit Design
Shown as in Figure 3, hardware circuit is composed of an SCM, RC ring oscillation
circuit, display, keypad and watchdog. For a minimal optimization system, chip
P87LPC764BN, a 20-foot encapsulated chip, made in Philips Company is chosen,
which fit in with the requirement of high integration and low cost.
Accelerated kernel 80C51 is used to speed up by two times as fast as the standard
MCU 80C51. In the chip, there is a 32Byte user code and RAM of 28 bytes which can
meet the needs of the system. The 32Byte user code can be used for storing sequence
code and set parameters; With the watchdog circuit, external watchdog is not needed.
No external components are needed with the power-on reset in the chip. There are 2 16
digital timers / counters; All architraves have 20mA drive ability. The voltage VDD =
4.5 ~ 6.0V.
Digital Temperature Measurement System Based on Oscillator
463
Fig. 3. System hardware circuit diagram
The system has two temperature measuring points. They are the negative temperature
coefficient thermistor Rt1 and Rt2, and the temperature measurement range is 0 ~ 99 C.
The chip HD74HC04P has six negaters, forming two RC oscillators. A rectangular pulse
which is generated through the RC oscillator were transmitted to input pins of
P87LPC764BN’s counter T0 and T1 and then temperature can be calculated. As the line
P0 has driving power, which directly drives LED device. When LED1 is on, the
temperature (t1) of the measuring point1 is displayed; when LED2 lights, it shows the
temperature (t2) of measuring point 2. Human-computer dialogue is achieved and
parameter is set by the keyboard interrupt function of the chip P87LPC764BN’s mouth
P0. To improve the reliability of the system, the watchdog timer used. The figure is
cleared to zero in the subprogram. The base pin is to be developed.
4
4.1
Software Design
Interrupt Service Program of Temperature Measurement
4.1.1 Mathematical Model of Temperature Measurement
Resistance value of NTC is an exponential non-linear curve, which in general can fully
meet the requirements of precise measurement after linear processing according to the
temperature range. In order to improve precision, a compensation link is added in
software. The temperature calculation formula is as follows:
464
L. Zhu
T = t0-KRt
In the equation,
T --- the measured temperature
t0 --- temperature parameter relating to thermistor characteristics
K ---resistance value of coefficient
Rt is the resistance of the thermistor
According to this formula, if Rt, t0 and K is known, the measured temperature can be
calculated. T = 2.2RtC; C is known, as long as T is measured, Rt can be calculated.
4.1.2 Measurement of Rectangular Pulse Period T
The single-chip internal two timers / counters are used to measure the rectangular pulse
period T[3 ] in order to track in real-time temperature measurement, and occupy less
CPU. The principle of measuring point 1 (t1) is as follows: supposing T0 is set as
counter, T1 timer, T0, at the same time both T0 and T1 start to work. T0 begins to count
on the RC oscillating circuit output pulse 1 while T1 begins to count frequency signal in
the internal, i.e. using twelve internal clock frequency signal for timing pulse.
When timing is up, overflow trap T1 makes T0 stop counting, so that a period of
measurement is completed. Rectangular wave period T = N1T1 / 12 / N0, in which N0, N1
are respectively count value of T0 and T1, T1 / 12 is the frequency signal period of the
internal clock. Apparently, N0 changes real time, N1 ( preset ) and T1 / 12 are known. If
T0 and T1 exchanges, we can know the measuring principle.
4.1.3 Interrupt Service Program of Temperature Measurement
In the initial program, T0 is set as counter T1 timer, and T0 and T1 start to work at the
same time. T1’s interrupt service program flow diagram is shown as in figure 4. In the
T1 timer interrupt service procedures, first make T0 stop counting and read count value
N0, which is compared with the previous measured value N0. If there is a change,
subroutine is started. Calculate T, Rt1 and t1, convert t1. into BCD and store it in digital
display buffer. Then set T1 as counter, T0 timer, both T0 and T1 start to measure the
temperature on point 2 (T2). Return CPU to the main program. T0’s program is the same
as T1’s procedure, thus completing the measurement of T2, and start the next period’s
measurement.
4.2
Main Program
The main program is mainly composed of initial program and display subroutine.
In initial procedure, automatic reset in the internal chip is used. T0 is set as counter
T1 timer, and T0 T1 keyboard interrupt and watchdog circuit begin to work. After
initialization of CPU, the value of T1 and T2 is dynamically displayed by starting
subroutine. Whenever a dynamic scanning is completed, the watchdog is cleared to
, ,
Digital Temperature Measurement System Based on Oscillator
465
Fig. 4. T1 interrupt service program
zero. If executive agencies are needed, the only thing to do is to control subroutine;
real-time temperature measurement can be realized.
5
Conclusion
Digital temperature measurement system based on oscillator, using the minimum
hardware circuit design, is characterized by its. simple circuits, low power
consumption, low cost and strong anti interference capability. It is especially suitable
for all kinds of intelligent household appliances. Besides it can also be used to measure
intelligent instrument in far distance.
466
L. Zhu
References
1. Fu, Y.: Digital Circuits And Systems. Sichuan University press (2003)
2. Tang, Y.: Digital Electronic Technology. Shanghai Jiaotong University Press (2001)
3. Li, H.: CS-51 Series MCU Practical Interface Technology. Beihang University press (1993)
Download