Design of Automatic Temperature Measurement and Alarm System Based on AT89C51

Publisher:CreativeDreamerLatest update time:2011-06-10 Keywords:AT89C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

At present, whether in industrial production or scientific research experiments, the equipment for automatic control through temperature measurement is becoming more and more popular, and there are more and more application occasions. The problem that follows is how to measure the accurate temperature to ensure that the automatic control equipment can correctly issue control instructions to control the production process. On the other hand, if the temperature is too high, it may cause damage to some semiconductor components in some equipment. Therefore, the demand for automatic high temperature alarm is also gradually increasing. Based on the above considerations, this paper studies and designs an automatic temperature measurement and alarm system based on a single-chip microcomputer.

1 System Hardware Design

Although there are many varieties of microcontrollers on the market and their functions are increasing, due to cost constraints, 8-bit microcontrollers with excellent performance are still the first choice in industrial detection and control applications.

This system is based on the AT89C51 single-chip microcomputer of ATMEL Company. It converts the output voltage of the temperature sensor into digital form through the analog-to-digital converter AD7812, and then sends the conversion result to the single-chip microcomputer for corresponding processing. The processing result is analyzed through programming, and finally it is decided whether to alarm. The design of each hardware function module is introduced below.

1.1 Temperature sensor design

The temperature sensor is an important component for sensing temperature changes in the external environment. It is the interface between the outside world and this system. It converts changes in the external temperature into changes in voltage, so that the external temperature can be indirectly measured by processing and analyzing the voltage. The temperature sensor used in this system is LM35, which is produced by National Semiconductor Corporation of the United States. At room temperature, it can reach an accuracy of 0.25℃ without additional calibration processing. Its output voltage is linearly related to the Celsius temperature, and this relationship can be expressed as:


or


In the formula, Vo is the output voltage of the sensor, in V, and T is the temperature in the external environment, in °C. Since the highest temperature that LM35 can measure is 150 °C, its maximum output voltage is 1.5 V according to formula (1). In order to match the input of AD7812, the output voltage of the sensor needs to be amplified by about 3.33 times. An integrated operational amplifier can be connected as a common-direction amplifier to achieve the function of voltage amplification. The amplified voltage is about 5 V, which can just match the input of the analog-to-digital conversion part. The circuit design of this part is shown in Figure 1.

Temperature sensor circuit

Figure 1 Temperature sensor circuit [page]

1.2 A/D conversion design

The output voltage value after the temperature sensor conversion cannot be directly sent to the microcontroller for processing. An A/D conversion device must be added between them. In this article, AD7812 is selected as the A/D converter. AD7812 is a 10-bit 8-channel A/D converter with a serial interface produced by Analog Devices. Compared with the general parallel interface A/D converter, its advantage is that it can save the processor's pin resources. The saved pin resources can further expand the system to make it more powerful. There are 8 analog switches inside the AD7812 that can collect 8 analog signals. Here, you only need to input the amplified sensor output signal to any one of them. For simplicity, the first analog switch is taken as the channel of the input signal. Since the AD7812 has a conversion clock source inside, there is no need to provide an external clock source. The microcontroller only needs to control it through its serial clock input, data output, data input, and conversion input pins. The circuit design of this part is shown in Figure 2.

A/D conversion circuit

Figure 2 A/D conversion circuit

1.3 MCU Processor Circuit Design

The AT89C series microcontroller is a low-voltage, cost-effective 8-bit microcontroller. Compared with the MCS-51 microcontroller, it has two major advantages: first, the on-chip memory uses flash memory, making program writing more convenient; second, a smaller chip size is introduced, making the circuit size smaller.

AT89C51 is a high-performance 8-bit microcontroller in this series with 4 KB of programmable and erasable read-only memory and 128 bytes of random access data memory (RAM). It uses ATMEL's high-density non-volatile memory manufacturing technology and is compatible with the industry-standard MCS-51 instruction set and output pins. In short, ATMEL's AT89C51 microcontroller provides a cost-effective implementation solution for embedded control systems.

AT89C51 provides the following standard functions: 4 K bytes of Flash memory, 128 bytes of internal RAM, 32 I/O lines, 2 16-bit timer/counters, 1 5-vector two-level interrupt structure, 1 full-duplex serial communication port, on-chip oscillator and clock circuit. At the same time, AT89C51 can be reduced to 0 Hz static logic operation and supports two software-selectable power-saving working modes. The idle mode stops the CPU from working, but allows the RAM, timer/counter, serial communication port and interrupt system to continue working. The power-down mode saves the contents of the RAM, but the oscillator stops working and prohibits all other components from working until the next hardware reset. In this article, the central processing circuit is shown in Figure 3. Single chip processing circuit

Figure 3 Single chip microcomputer processing circuit [page]

1.4 Abnormal situation alarm circuit design

The function of the alarm circuit is to remind the staff to take measures as soon as possible when an abnormal situation occurs, reduce the danger and avoid catastrophic consequences. Therefore, when designing the alarm circuit, its alarm behavior should be quickly noticed by people so that further corresponding measures can be taken to avoid or reduce the losses caused by the hazards. Modern scientific research has proved that the purpose of alarm can be better achieved by stimulating people's vision and hearing. In addition, flashing lights and intermittent sounds are most likely to attract people's attention. Based on the above considerations, a pulse signal generator composed of integrated gate circuit chips such as 74LS00 and 74LS04 is used in the design to control the intermittent sound and the on and off of the light.

The temperature in the external environment is collected by the temperature sensor, which converts the temperature into a voltage value. The voltage value is matched and sent to the A/D converter. The converted data is sent to the microcontroller for processing. The microcontroller processes according to the compiled program. If the temperature at this time exceeds the threshold set by people based on experience, the microcontroller will make the output of P0.0 and P0.1 high level (about +5 V) through instructions, so that the speaker and the light-emitting diode generate an alarm signal. The circuit design of this part is shown in Figures 4 and 5.

Sound alarm circuit

Figure 4 Sound alarm circuit

Light alarm circuit

Figure 5 Light alarm circuit

2 System Software Design

In order to facilitate the modification of the program, the system is designed in a modular way. The system consists of four modules: temperature acquisition, A/D conversion, data processing, and alarm output. Temperature acquisition is completed by the temperature sensor LM35, and A/D conversion and alarm output are controlled by the single-chip microcomputer. The data processing part is completed inside the single-chip microcomputer after the single-chip microcomputer receives the data sent by the A/D converter, and the result will determine whether the alarm output module works.

The working process of the system is: LM35 collects temperature and converts the temperature signal into an electrical signal; A/D conversion converts the linearly amplified analog electrical signal into a digital signal that can be processed by the single-chip microcomputer; the single-chip microcomputer analyzes the sampled temperature value by processing the converted digital signal and sends the analysis result to the alarm output circuit; the alarm output circuit responds accordingly according to the analysis result. The software design flow chart of the system is shown in Figure 6.

System design flow chart

Figure 6 System design flow chart

2.1 A/D conversion module

The A/D converter needs to be initialized before starting, otherwise it will affect the subsequent use. According to the connection method in Figure 2, set the P1.4 port of the microcontroller to 1 during initialization, and then the software can start a conversion process. During the conversion process. Since any A/D converter will have a certain conversion time, a certain delay must be set during the conversion, and the delay must be slightly longer than the conversion time of the device. Since the conversion time of AD1812 is about 2.3 μs, the delay can be set to 3 μs in the program to ensure the smooth progress of the conversion process.

2.2 Central Processing Module

The software design of this module mainly includes three parts: the control of the A/D conversion module by the microcontroller, the processing of the data sent by the microcontroller, and the control of the alarm system by the microcontroller.

The control of the A/D module mainly includes writing relevant control words to AD7812 and setting and clearing the pin of P1 port; the data processing part mainly compares the voltage value converted from the external temperature with the preset empirical threshold to decide whether to start the alarm system; the design of the alarm system is to clear or set the P0 port according to the result of data processing to start or stop the alarm circuit.

3 Conclusion

This paper mainly designs an automatic temperature measurement and alarm system. The design of this system is mainly based on the AT89C51 single-chip microcomputer. The central processing unit and the peripheral expansion module are simple in structure, and the cost of the entire system is low. Since LM35 is powered by a single power supply, the system can only work within the range of 5 to 150°C. It can be used as an alarm device at room temperature, especially in some electrical equipment that is sensitive to temperature. It can prevent equipment failures, so it has certain practical value. In the design, the parallel A/D converter AD0809 is not used, but the serial port converter AD7812 is used to save a lot of port resources for the single-chip microcomputer. These resources can be used to expand the LED or LCD display system, and can also be made into a temperature measurement and alarm system to make its functions more complete.

Keywords:AT89C51 Reference address:Design of Automatic Temperature Measurement and Alarm System Based on AT89C51

Previous article:Design of Universal Automatic Test System Based on PC104
Next article:Design of a high-speed and integrated data acquisition system

Recommended ReadingLatest update time:2024-11-16 18:08

Design of frequency characteristic tester based on AT89C51 microcontroller and DDS device
1 Introduction Frequency characteristics are the response characteristics of a system (or component) to sinusoidal input signals of different frequencies. As shown in Figure 1, the system under test inputs a sinusoidal signal with amplitude Ar and angular frequency ω. If the system is linear, its steady-state output i
[Microcontroller]
Design of frequency characteristic tester based on AT89C51 microcontroller and DDS device
Design of train voice broadcasting system based on ISD4004 and AT89C51 microcontroller
In the modern industrial control process, working status and fault status alarm devices are widely used. They usually use sound and light to remind the operator to deal with the problems in time. With the development of new technologies, people have begun to apply voice technology to this field. It provides relevant i
[Microcontroller]
Design of train voice broadcasting system based on ISD4004 and AT89C51 microcontroller
Simulation experiment of single chip microcomputer (AT89C51) - running lights and flashing lights one by one (input and output)
Before conducting the simulation experiment, you must install the software, one is the MCU simulation software (ISIS 7 Professional) and the MCU programming software (Keil uVision4), one is for writing programs and the other is for burning programs. If you haven't installed it, you can chat with me privately. Implem
[Microcontroller]
AT89C51 single chip microcomputer --1. Preliminary preparation
The information required for this article is stored in the network disk. If necessary, download it yourself. Link: https://pan.baidu.com/s/1eAvlj3hTU9971qYIp4f8XA Extraction code: 1zpk 1.Win10 system driver installation Reasons for installing the driver: In layman's terms, it's like a mouse. It looks like it c
[Microcontroller]
AT89C51 single chip microcomputer --1. Preliminary preparation
AT89C51 00-99 single chip microcomputer with countdown counter
1. Design tasks (1. "00" is displayed when power is turned on, and counting starts after the first press of SP1. (2. After pressing SP1 for the second time, the counting stops. (3. After pressing SP1 for the third time, the count is reset.  (4. Press countdown for the fourth time. 2. Circuit Schematic  3. Hardware
[Microcontroller]
AT89C51 00-99 single chip microcomputer with countdown counter
Single chip microcomputer design electronic piano music box (AT89C51)
1. Circuit Design This circuit consists of AT89C51 minimum system, key module, digital tube display and buzzer. Function: Seven buttons represent Do La Mi So Re La Si and the last button represents switching music. 2. Operation Results 3. Partial Code #include reg52.h #define uchar unsigned char #define uint un
[Microcontroller]
Single chip microcomputer design electronic piano music box (AT89C51)
Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号