With the development of computer technology, especially single chip microcomputer technology, temperature has a great impact on people’s life and work, so it is necessary to collect and analyze the temperature in real time. Therefore, real-time and accurate measurement and monitoring is realized. The data is transmitted by serial port and analyzed on PC. Due to the convenience, simplicity and flexibility of single-chip microcomputer control, high-performance AVR single-chip microcomputer is used to control gtj4-10a solid-state relay, which can achieve the most total temperature control. Thus, the temperature curve can be drawn on PC and the data can be saved and analyzed.

1. System composition and basic principle

The system consists of temperature acquisition module, solid state relay control module, single chip microcomputer module and PC software processing module. The four modules are used to control the temperature, collect the temperature and analyze the temperature by software. Their logical relationship is shown in Figure 1.

Design of real time measurement and monitoring system based on AVR MCU and gtj4-10a solid state relay

The task of this system is to collect, save and re display the temperature of a specific environment, control the solid-state relay through the single-chip microcomputer, so as to control the size of its temperature value, and then display the current temperature in real time through the PC, and analyze and save the current temperature. It is easy to compare with the temperature value in the future. First, ATmega16 MCU controls gtj4-10a solid-state relay to control AC, and then to control the temperature value. At this time, the current temperature value is collected by DS18B20 temperature sensor. The results of the collected data are sent to the single chip microcomputer through TX. on the one hand, the single chip microcomputer sends the temperature value to the computer through the serial communication port, on the other hand, it compares and analyzes the temperature data, 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 PC is sent to MFC software to draw the temperature curve. At the same time, the temperature value and the time of collecting the current temperature are recorded by the Save button. Then the temperature and time will be displayed through the display button. This is the real-time acquisition and analysis of temperature.

2. Hardware design

The system mainly uses high-performance AVR microcontroller, gtj4-10a solid-state relay, DS18B20 temperature sensor, alarm output circuit. The main system circuit diagram.

2.1 introduction of ATmega16

ATmega16 is a low power 8-bit CMOS microcontroller based on enhanced AVR RISC architecture. Due to its advanced instruction set and single clock cycle instruction execution time, ATmega16’s data throughput is up to 1 MIPS / MHz, which can slow down the contradiction between power consumption and processing speed. Atmega16avr core has rich instruction set and 32 general working registers. All the registers are directly connected to the ALU, so that an instruction can access two independent registers simultaneously in one clock cycle. This structure greatly improves the code efficiency, and has a data throughput up to 10 times higher than the common CISC microcontroller. Therefore, it can be used for data transmission, relay control and temperature acquisition.

2.2 temperature acquisition module

DS18B20 adopts the unique single bus protocol of Dallas. The temperature conversion result can be selected as 9-12 bits, and the maximum conversion time is 750 ms when the conversion result is 12 bits. The state value of DS18B20 can be read to judge whether the conversion is completed. The temperature measurement range is from – 55 ℃ to + 125 ℃, and the accuracy is in the range of 0 ± 0.5℃。

2.3 control of solid state relay

The relay module unit is controlled by the IO port of the single-chip microcomputer to let the calculator of the single-chip microcomputer count. When the ambient temperature needs to be heated, we let the relay work through io. When it reaches a certain value, we give the IO port of the relay a low level, so as to realize the function of controlling AC through the single-chip microcomputer and the relay. Here, we mainly use the PWM of the single-chip microcomputer to realize the control, Thus the control of temperature value can be realized. The specific circuit diagram is shown in Figure 2.

Design of real time measurement and monitoring system based on AVR MCU and gtj4-10a solid state relay

2.4 alarm output circuit

The alarm output circuit controls the 8550 triode through the PA6 port of the single chip microcomputer to control the buzzer. When the temperature reaches a certain value, the buzzer will give an alarm. At this time, the MCU is informed to stop heating, and then the heating equipment is controlled by the solid-state relay to maintain the temperature near a constant temperature value. If the temperature value is lower than a certain value, the MCU informs the heating equipment to heat. This principle is controlled by collecting the temperature value, so as to meet the requirements of users.

3. Software design

After the completion of the system hardware architecture, the main function of the system software is to draw the temperature curve, real-time record and archive the temperature value, and realize the historical record. The program flow chart is shown in Figure 3.

Design of real time measurement and monitoring system based on AVR MCU and gtj4-10a solid state relay

The data is transmitted to the PC through a single chip, and the PC will display the received data in the temperature curve display and analysis user meeting. This software also has the basic functions of serial port selection, baud rate selection, stop display, clear data, close program and so on. Here is mainly the temperature value curve drawing, and then save the temperature value and re display operation. So as to achieve the function of real-time acquisition and analysis. The temperature curve display and analysis user interface is shown in Figure 4.

Design of real time measurement and monitoring system based on AVR MCU and gtj4-10a solid state relay

3.1 temperature display curve

The main task of temperature display graph is to display the data received by MCU. When the temperature is out of date, the current temperature value and time are displayed in the software. The time of each temperature value is recorded by time function in MFC. The temperature value and the current time of temperature are drawn into a curve by using the drawing function, and then the curve is drawn by special processing of the data. Here, the more difficult to deal with is the real-time temperature acquisition and drawing curve.

3.2 save design unit

The data received by MCU is saved by writedata() in MFC. This method is conducive to the analysis and use of data in the future. The temperature value and time value are recorded and archived into a TXT file. You can clearly see the change of data by opening the txt file. This part of the function is mainly to record the current time of temperature value and temperature value, It is helpful to make a comparative analysis of the temperature value in the future.

3.3 display design unit

The display design unit is to draw the saved temperature value and time value into a temperature curve, so as to analyze the data clearly. Read out the saved data through the ReadData function, and then draw the temperature curve through the drawing function. You can clearly see the historical data here, which is convenient for scientific analysis of experimental data. This part of the function is mainly to display the historical temperature value and time. The experimental results are shown in Figure 5.

Design of real time measurement and monitoring system based on AVR MCU and gtj4-10a solid state relay

4. Concluding remarks

The real-time temperature acquisition and analysis system is stable and reliable. In addition, the system is composed of ATmega16 single chip microcomputer with high performance. The digital temperature sensor with high sensitivity is selected as the basis. By controlling the output of different PWM, the actual temperature curve can be drawn, and the temperature value at each time can be analyzed according to different environment. This software design also has the important function of saving and displaying historical records. It is conducive to the comparative analysis of data in the future. At the same time, it can meet the requirements of real-time environmental temperature detection and a variety of users.

Editor in charge: GT

Leave a Reply

Your email address will not be published. Required fields are marked *