Design of ATmega16 single chip microcomputer in real-time temperature acquisition and analysis system

Publisher:咖啡狐狸Latest update time:2014-01-22 Source: dqjswKeywords:ATmega16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  Temperature is a very important parameter in industrial and agricultural production, which directly affects the quality and performance of products. A real-time temperature acquisition and analysis system based on ATmega16 single-chip microcomputer and temperature sensor is proposed. This system introduces the software processing based on MFC in the analysis, with ATmega16 single-chip microcomputer as the core, as well as the automatic control device GTJJ4-10A solid-state relay and digital temperature sensor DS18B20, alarm and indication circuit, etc. It includes the drawing of temperature curve, the preservation of temperature value, display of historical records, etc. After the test of boiling water temperature, the system is stable, reliable and easy to analyze. The temperature error is 0.5℃, which can meet the requirements of industrial and agricultural production.

  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

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

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

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

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

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.

Keywords:ATmega16 Reference address:Design of ATmega16 single chip microcomputer in real-time temperature acquisition and analysis system

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

AVR Notes 7: ATmega16 locked
Today, my classmate asked me to help look at a ATmega16 program. He modified the fuse bits on his computer. I remember clearly that he changed the internal 4MHz crystal to 1MHz. After the modification, I downloaded it without carefully checking the reference materials. I found that the LED connected was not on. I thoug
[Microcontroller]
Design of intelligent control system for arc-free AC contactor based on ATMEGA16
0 Introduction     The strong arc generated by the traditional AC contactor in the process of breaking the circuit not only causes contact wear and reduces the electrical life of the contactor; at the same time, the excitation system of the AC contactor is mostly controlled by AC, which not only generates a lot of AC
[Microcontroller]
Design of intelligent control system for arc-free AC contactor based on ATMEGA16
AVR microcontroller (learning) - (IV), ATMEGA16 timer/counter - 04
4. ATMEGA16 Timer/Counter Four - (04), 0~5V digital voltage regulator PWM digital voltage regulator Since timer 2 (the previous experiment) can only form 8-bit PWM, its accuracy is not enough as a digital voltage regulator. Here, timer 1 is used to form a 10-bit PWM to achieve a digital voltage adjustment value of 0~5
[Microcontroller]
AVR microcontroller (learning) - (IV), ATMEGA16 timer/counter - 04
atmega16 and 24l01 key main program
#include avr/io.h #include avr/delay.h #include"NRF24L01.h" //#define Open_TX #define Open_RX typedef unsigned char uint8; /* defined for unsigned 8-bits integer variable Unsigned 8-bit integer variable */ typedef signed char int8; /* defined for signed 8-bits integer variable Signed 8-bit integer variable */ typede
[Microcontroller]
B001-Atmega16-Watchdog WDT-(ques=1)
I tested the watchdog today. You can use wdt_enable(value) and wdt_disable() in wdt.h, or you can use your own defined WDT_enable(uint8_t count) and WDT_disable(void). To reset the watchdog, use wdt_reset() in wdt.h. ------------------------------------------------------------------------------------------------
[Microcontroller]
AVR ATMega16 displays infrared codes on segment LCD
Hardware: ATMega16 (8MRC) + HT1621 + integrated infrared receiver Idea: Infrared decoding uses interrupt capture mode (NEC encoding), and the display uses LCD driver HT1261 The program is as follows (compiled in WinAVR GCC environment): #include avr/io.h #include avr/delay.h   #include avr/signal.h #include avr/inte
[Microcontroller]
Design of wireless RF transceiver system based on ATmega16 and nRF905
0Introduction With the rapid development of electronic technology today, various intelligent control systems (such as wireless meter reading systems, access control systems, anti-theft alarm systems and security fire protection systems in intelligent communities), industrial data acquisition systems, hydrologic
[Microcontroller]
Design of wireless RF transceiver system based on ATmega16 and nRF905
Design of semiconductor refrigeration system based on solar power supply
At present, most refrigeration equipment is driven by electricity. Traditional refrigeration equipment not only consumes a lot of electricity, but also pollutes the environment because of the use of refrigerants such as Freon. Therefore, energy saving and environmental protection in refrigeration have become the foc
[Microcontroller]
Design of semiconductor refrigeration system based on solar power supply
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号