Design of automatic temperature measurement and alarm system based on single chip microcomputer

Publisher:达文西happyLatest update time:2011-03-23 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: At present, it is becoming more and more common to use temperature as a control quantity to automatically control the system in the field of automatic control. In view of this actual situation, this paper designs a simple and practical temperature alarm system. The system uses AT89C51 single-chip microcomputer as the central processing unit, which greatly reduces the cost of system development. The external temperature is collected by the temperature sensor LM35 and converted into the corresponding voltage value. The A/D conversion device performs analog-to-digital conversion on the voltage value and sends the result to the central processing unit for calculation. The single-chip microcomputer decides whether to start the alarm device based on the result of its processing. The results show that the system can work in an environment of 5-150℃, and when the external temperature reaches the set alarm temperature, the system can respond in time, which has certain practical value.
Keywords: AT89C51; sensor; A/D conversion; automatic alarm

At present, whether in industrial production or in scientific research experiments, the equipment for automatic control through temperature measurement is becoming more and more popular, and the application occasions are also increasing. 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, some semiconductor components in some equipment may be damaged. 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 single-chip microcomputer.

1 System hardware design
Although there are many varieties of single-chip microcomputers on the market and their functions are increasing, due to cost constraints, 8-bit single-chip microcomputers with excellent performance are still the first choice in the field of industrial detection and control applications.
This system is centered on ATMEL's AT89C51 single-chip microcomputer. The output voltage of the temperature sensor is converted into analog-to-digital by the analog-to-digital converter AD7812, and then the conversion result is sent to the single-chip microcomputer for corresponding processing. The processing result is analyzed by 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 the change of external temperature into voltage change, 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:
1.JPG
Wherein, Vo is the output voltage of the sensor, unit V, T is the temperature in the external environment, unit °C. Since the highest temperature that LM35 can measure is 150 °C, it can be obtained from formula (1) that its maximum output voltage is 1.5 V. In order to match the input of AD7812, it is necessary to amplify the output voltage of the sensor by about 3.33 times. An integrated operational amplifier can be connected as a common-direction amplifier to realize 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.

2.JPG
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 4 pins. The circuit design of this part is shown in Figure 2.

3.JPG


1.3 Single-chip processor circuit design
The AT89C series single-chip microcomputer is a low-voltage, cost-effective 8-bit single-chip microcomputer. Compared with the MCS-51 single-chip microcomputer, it has two major advantages: first, the on-chip memory uses flash memory, which makes program writing more convenient; second, a smaller chip size is introduced, making the circuit size smaller.
AT89C51 is a high-performance 8-bit single-chip microcomputer 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 industrial standard MCS-51 instruction set and output pins. In short, ATMEL's AT89C51 single-chip microcomputer 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.

4.JPG
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 lights.
The temperature in the external environment is collected by the temperature sensor, which converts the temperature at this time into a voltage value. The voltage value is sent to the A/D converter after matching, and the converted data is sent to the single-chip microcomputer for processing. The single-chip microcomputer processes according to the programmed program. If the temperature at this time exceeds the threshold set by people based on experience, the single-chip microcomputer 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 alarm signals. The circuit design of this part is shown in Figure 4 and Figure 5.

6.JPG

7.JPG



2 System software design
In order to facilitate the modification of the program, the system is designed according to the modular method. 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 its 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 analog electrical signal after linear amplification 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.

8.JPG


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 part of the 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 the relevant control word to AD7812 and setting and clearing the pin of port P1; the data processing part mainly compares the voltage value converted from the external temperature with the pre-experienced threshold to decide whether to start the alarm system; the design of the alarm system is to clear or set port P0 according to the result of data processing to start or stop the alarm circuit.

3 Conclusion
This paper mainly designs an automatic temperature measurement alarm system. The design of the system is mainly based on the AT89C51 single-chip microcomputer. The structure of the central processing unit and the peripheral expansion module is simple, and the cost of the whole system is low. Since LM35 is powered by a single power supply, the system can only work in 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 failure, so it has certain practical value. In the design, the parallel port A/D converter AD0809 is not used but the serial port converter AD7812 is used, which saves a lot of port resources for the microcontroller. 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.

Reference address:Design of automatic temperature measurement and alarm system based on single chip microcomputer

Previous article:Design of a new energy-saving fluorescent lamp system based on single-chip microcomputer
Next article:Temperature collection and wireless transmission based on 8051 single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号