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:
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.
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.
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.
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.
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.
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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- AwtkGUI-RedBull-STM32F103ZET6
- How to choose the type and model of diode in circuit design
- There is a large gap in FPGA talent, and the domestic FPGA industry is facing challenges!
- 1. Development board unpacking test
- Analog components and msp 432
- MSP430F149 Learning Road - Capture/Compare Mode
- [Mil MYC-J1028X development board trial] Build a super powerful OpenWRT soft router
- Codebook Background Modeling
- It's Friday. Let's do a little reasoning
- Why should rectifier filter capacitors use high frequency and low resistance?