With the development of computer technology, especially single-chip microcomputer technology, temperature has a great impact on people's lives and work, so it is necessary to collect temperature in real time and analyze it. To this end, real-time and accurate measurement and monitoring are achieved. The serial port is used to transmit data and analyze it on the PC. Due to the advantages of convenient, simple and flexible control of the single-chip microcomputer, a high-performance avr single-chip microcomputer is used to control the GTJ4-10A solid-state relay to achieve temperature control. In this way, the temperature curve can be drawn on the PC and the data can be saved and analyzed.
1 System composition and basic principles
This system consists of a temperature acquisition module, a solid-state relay control module, a single-chip microcomputer module, and a PC software processing module. The four modules together realize temperature control, temperature acquisition, and temperature analysis after software processing. Their logical relationship is shown in Figure 1.
Figure 1 Logical relationship diagram
The task of this system is to collect, save and display the temperature of a certain environment. The solid-state relay is controlled by the single-chip microcomputer to control the size of its temperature value. The current temperature is displayed in real time by the PC, and the current temperature is analyzed and saved. It is convenient for comparison with future temperature values and other applications. First, the ATmega16 single-chip microcomputer controls the GTJ4-10A solid-state relay to control the AC power, and then the temperature value is controlled. At this time, the current temperature value is collected by the DS18B20 temperature sensor. The collected data results are sent to the single-chip microcomputer through Tx. The single-chip microcomputer sends the reached temperature value to the computer through the serial communication port on the one hand, and compares and analyzes the temperature data on the other hand, and then controls the GTJ4-10A solid-state relay through IO. Thus, the temperature value control is realized. On the other hand, the temperature value obtained by the PC is sent to the MFC software to draw the temperature curve, and the temperature value and the time of collecting the current temperature are recorded through the save button. Then the temperature value and time are displayed through the display button. This is the real-time collection and analysis of temperature.
2 Hardware Design
This system mainly uses high-performance AVR microcontroller, GTJ4-10A solid-state relay, DS18B20 temperature sensor, and alarm output circuit. The main system circuit diagram is omitted.
2.1 Introduction to ATmega16 MCU
ATmega16 is a low-power 8-bit CMOS microcontroller based on an enhanced AVR RISC structure. Due to its advanced instruction set and single-clock cycle instruction execution time, the data throughput of ATmega16 is as high as 1 MIPS/MHz, which can alleviate the contradiction between power consumption and processing speed in the system. The ATmega16AVR core has a rich instruction set and 32 general working registers. All registers are directly connected to the arithmetic logic unit (ALU), so that one instruction can access two independent registers simultaneously in one clock cycle. This structure greatly improves code efficiency and has a data throughput of up to 10 times that of ordinary CISC microcontrollers. Therefore, data transmission, control of relays and temperature collection can be well performed.
2.2 Temperature acquisition module
DS18B20 uses Dallas' unique single bus protocol. The temperature conversion result can be selected as 9-12 bits. The maximum conversion time is 750 ms when the conversion result is 12 bits. The status value of DS18B 20 can be read to determine whether the conversion is completed. Its temperature measurement range is -55~+125℃, and the accuracy is ±0.5℃ within the range.
2.3 Control of solid-state relays
The relay module unit is controlled by the IO port of the single-chip microcomputer, and the calculator of the single-chip microcomputer counts. When the ambient temperature needs to be heated, we use the IO to make the relay work. When it reaches a certain value, we give the relay IO port a low level, so as to realize the role of weak point control of alternating current through the single-chip microcomputer and the relay. Here, the single-chip microcomputer PWM is mainly used to realize the control, so as to realize the control of the temperature value. The specific circuit diagram is shown in Figure 2. [page]
Figure 2 MCU control circuit
2.4 Alarm output circuit
The alarm output circuit controls the 8550 transistor through the PA6 port of the microcontroller, thereby controlling the buzzer. When the temperature reaches a certain value, the buzzer alarms. At this time, the microcontroller is notified to stop heating, and then the solid-state relay controls the heating device to maintain the temperature near a constant temperature value. If the temperature value is lower than a certain value, the microcontroller notifies the heating device to heat up. This principle is controlled by collecting temperature values to meet user requirements.
3 Software design
After the system hardware architecture is completed, the functions implemented by the system software are mainly aimed at drawing temperature curves, real-time recording and archiving of temperature values, and realizing historical records. The program flow chart is shown in Figure 3.
Figure 3 Software Flowchart
The data is transmitted to the PC through the single chip, and the PC displays the received data on the temperature curve display and analysis user interface. This software design also has basic functions such as serial port selection, baud rate selection, stop display, clear data, and close program. Here, the main operation is to draw the temperature value curve, and then save the temperature value and display it again. In this way, the function of real-time collection and analysis is achieved. The temperature curve display and analysis user interface is shown in Figure 4. [page]
Figure 4 User interface
3.1 Temperature display curve
The main task of the temperature display curve is to display the data received by the single chip microcomputer. When the temperature is transmitted, the current temperature value and time are displayed in the software. The time of each temperature value is recorded through the Time function in MFC. The temperature value and the current time of the temperature are plotted into a curve using the drawing function, and then the data is specially processed and drawn into a curve. What is more difficult to handle here is the real-time temperature acquisition and drawing curve.
3.2 Save Design Unit
The data received by the microcontroller is saved as temperature value and time value through WriteData() in MFC. This approach is conducive to future analysis of the data. The temperature value and time value are recorded and archived into a txt file. When the txt file is opened, the data changes can be clearly seen. This part of the function is mainly to record the temperature value and the current time of the temperature value, which is conducive to future comparative analysis of the temperature value.
3.3 Display Design Unit
The display design unit is to draw the saved temperature value and time value into a temperature curve chart, which is convenient for clear data analysis. The saved data is read out through the ReadData function, and then the temperature curve chart is drawn through the drawing function. Here you can clearly see the historical data, which is convenient for scientific analysis of experimental data. This part of the function mainly displays the historical temperature value and time. The experimental results are shown in Figure 5.
Figure 5 Experimental results
4 Conclusion
The real-time temperature acquisition and analysis system is stable and reliable. In addition, the system is composed of a high-performance ATmega16 single-chip microcomputer. A high-sensitivity digital temperature sensor is selected as the basis. Through the single-chip microcomputer control output of different PWM, the actual temperature curve can be drawn, and the temperature value at each moment can be analyzed according to different environments. This software design also has an important function of saving and displaying historical records . It is conducive to comparing and analyzing data in the future. At the same time, it meets the requirements of real-time environmental temperature detection and multiple users.
Previous article:How to avoid AVR microcontroller fuse lock
Next article:Simulation and Design of AVR Processor on VLSI Platform
Recommended ReadingLatest update time:2024-11-16 14:51
- 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
- Why is Huawei's 5G technology stronger than that of the United States?
- msp430f5137+adxl362 accelerometer, can read ID but cannot read acceleration data!
- Microchip Live: MPLAB breaks the "This microcontroller programming is too difficult, I can't do it" and calls you to develop quickly
- Made a progressive volume control circuit
- How to filter square waves into round ones?
- EEWORLD University - How to choose the right RS-485 transceiver
- Two questions about single chip microcomputer
- SD boot and burning
- 6 protection functions of power amplifiers and common troubleshooting methods
- After cashing out 1.5 billion yuan, Mobike's post-80s founder left behind two unspoken rules for life