Design of water temperature monitoring system based on SPCE061A

Publisher:淡雅时光Latest update time:2011-08-10 Keywords:SPCE061A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Temperature control It is widely used in both industrial control and consumer electronics, such as the control of boilers and heating furnaces in industrial control, and the control of water heaters and water dispensers in consumer electronics. Temperature control is involved internally. The current abundance of control algorithms also provides convenient conditions for temperature control. The more commonly used ones are proportional integral differential (PID) control and fuzzy control.

1 System Hardware Design

This system uses SPCE061A as the control core, including four modules: sensor circuit, keyboard and display circuit, relay control circuit and UART communication circuit. The 10-bit A/D converter of SPCE061A is used in combination with PT100 temperature sensor to complete the sampling of water temperature. The interference factors of the system are eliminated through digital filtering and other technologies to restore the current temperature value, which is displayed through the digital tube, and the collected temperature value is processed by PID operation to realize the control of water temperature. In addition, the system also needs to realize the communication function between the upper and lower computers of PC and single-chip microcomputer, and display the temperature heating curve in real time on PC. The overall block diagram of the system is shown in Figure 1.

a.JPG

1.1 SPCE061A core controller

SPCE061A is a 16-bit u'nspTM core microcontroller, which can not only realize basic control functions but also has some DSP functions. The chip has built-in 32k FlashROM and 2 k words of SRAM, and also integrates ADC, DAC, AGC amplifier circuit, etc. It is a powerful SOC chip. The chip has 8 10-bit precision ADCs, one of which is an audio conversion channel, and the other 7 can be used as ordinary AD conversion channels. It can realize simple addition and subtraction operations. In order to handle complex arithmetic operations, a hardware multiplier is added, which can perform n inner product operations. The highest system clock can reach 49 MHz. The high processing speed enables SPCE061A to perform complex arithmetic and logical operations very easily and quickly. This system uses the 61 board, which is the development system of SPCE061. In addition to the minimum system of the single-chip microcomputer, the 61 board also has power supply circuits, audio circuits, reset circuits and buttons.

1.2 Sensor Circuit

The sensor circuit consists of two parts: a measuring bridge and an amplifier circuit, as shown in Figure 2.

b.JPG

The temperature sensor of this system uses a platinum thermal resistor temperature sensor PT100. The physical and chemical properties of the platinum thermal resistor are very stable in high temperature and oxidizing media. It can be used as an industrial temperature measurement element, and this element has good linearity. At 0-100°C, the maximum nonlinear deviation is less than 0.5°C. R2, R3, R and PT100 form a sensor measurement bridge. In order to ensure the stability of the bridge output voltage signal, the input voltage of the bridge is stabilized to 2.5 V through TL431. The differential signal obtained from the bridge is amplified by a two-stage op amp and then input into the microcontroller. One arm of the bridge uses an adjustable resistor R3. By adjusting R3, the size of the differential voltage signal input to the op amp can be adjusted, which is usually used to adjust the zero point.

The amplifier circuit uses the LM358 integrated operational amplifier. In order to prevent the nonlinear error caused by the excessively high single-stage amplification factor, the amplifier circuit uses two-stage amplification, as shown in Figure 2. The first stage is about 10 times, and the second stage is about 3 times. The temperature changes from 0 to 100℃. When the temperature rises, the resistance of PT100 increases, the differential signal input to the amplifier circuit increases, and the output voltage AV of the amplifier circuit increases accordingly. [page]

1.3 Keyboard and display circuit

The keyboard directly uses the keys that come with the 61 board, and can be used without connecting additional hardware. The display circuit is implemented using an LED keyboard module, which is powered by DC 5 V and integrates LED, KEY, and digital tube functions. It is used as an expansion module for SPCE061A peripheral devices. The LED module expands the 6-bit 8-segment digital tube, and the maximum display data is 999 999; there are 8 light-emitting diodes, 8 keys (can be composed of 1x8KEY or 2x4KEY), and 1 potentiometer, which can provide 0-5 V analog voltage signals or 0-3.3 V analog voltages, which are related to the VDD input of the module. The keyboard and display circuit are mainly used to set and display real-time temperature.

1.4 Relay control circuit

The main power device of this system is an AC 220 V/1 000 W electric heater, which is driven by a relay. The relay is the OMRONG6B-1174P relay, which has the advantages of low trigger voltage (DC: 5 V), large controllable power (AC: 8 A, 250 V), and short response time. The relay is driven by the NPN8050 transistor. When the control terminal Ctrl is loaded with a high-level signal, the transistor is turned on and the relay works. When the control terminal Ctrl is a low-level signal, the transistor is turned off and the relay stops working. There is a freewheeling protection circuit around the relay.

The circuit and working indication circuit of the power drive part are shown in Figure 3. Ctrl is the relay control signal input terminal, which is controlled by IOA7 of the single chip microcomputer. J2 is the switch interface for controlling the heater.

c.JPG

2 System Software Design

The control idea of ​​the system program: After setting the target temperature, the system samples the water temperature, and generates four output parameters through PID calculation based on the preset temperature, current temperature, historical deviation, etc. The heating time is controlled by this parameter, thereby adjusting the average power of the heater and realizing the PID control of the system. The overall function is realized by the cooperation of the main program and the interrupt service program. The interrupt service includes IRQ5_2Hz interrupt, IRQ5_4Hz interrupt, IRQ2_TimerB interrupt and IRQ6_TMB2 (1 024 Hz) interrupt. The main program flow and the main subroutine flow are mainly introduced here. The system first initializes I/O, TimerB, UART and other components, and then enters the main loop to perform temperature sampling and related processing. The core idea of ​​the software design of this system lies in the realization of PID control. The target temperature can be reset by pressing KEY3 during the operation of the system. The main program flow is shown in Figure 4.

d.JPG

2.1 A/D conversion subroutine

A/D conversion: The temperature sampling operation is performed every 1 second. 18 A/D conversions are performed for each sampling. This is done in the IRQ5_2Hz interrupt service routine. IRQ5_2Hz is used to provide 1 second to determine the time interval for AD sampling. The A/D conversion subroutine flow chart is shown in Figure 5.

e.JPG

2.2 Implementation of temperature PID control

This solution uses the positional PID algorithm, takes the temperature sensor sampling input as the current input, and then subtracts it from the set value to get the deviation, and then performs PID operation on it to generate the output result four, and then lets four control the timer time to control the heater. IRQ2_TimerB provides an interrupt signal with an overflow frequency of 64 Hz, and cooperates with the PID operation result four of the main program to determine the heating time and realize the heater power regulation. The flow chart of this subroutine is shown in Figure 6 below.

f.JPG [page]

3 System operation performance test

The key to this system is PID control. For a PID system, the performance of the system mainly depends on the setting of the PID control parameters. From the PID control principle, we know that: proportional (P) control can quickly respond to errors and reduce steady-state errors: the increase in proportional action will cause system instability. The role of integral (I) control is that as long as there is a deviation in the system, the integral action will continue to accumulate and output the control amount to eliminate the error; too strong an integral action will increase the overshoot of the system and even cause the system to oscillate. Differential (D) control can reduce overshoot, overcome oscillation, improve the stability of the system, and at the same time speed up the dynamic response speed of the system, reduce the adjustment time, and thus improve the dynamic performance of the system.

The basic functions that this system can achieve are as follows:

1) Real-time collection and display of temperature:

2) The temperature change can be processed in time and PID adjustment can be applied;

3) Realize communication between upper and lower computers through UART, and display the temperature change curve on the upper computer.

During the system debugging process, by changing the key PID system parameters Kp and Kd, the changes in system operating performance are observed to put the system in the best operating state. The following is the test process and test results.

1) The corresponding curve of Kp=1.5, Kd=1.0 (temperature rise: 20~40℃) is shown in Figure 7. It can be seen from the figure that the overshoot is too large due to the excessive value.

g.JPG

2) The corresponding curve of Kp=1.2, Kd=1.0 (temperature rise: 40~60℃) is shown in Figure 8. It can be seen from the figure that due to the small value, the system's rapidity is poor and the response is relatively slow.

h.JPG

3) The corresponding curve of Kp=1.3, Kd=1.0 (temperature rise: 30~50℃) is shown in Figure 9. It can be seen from the figure that due to being too small, the overshoot of the system is relatively large and the predictability is poor, resulting in long-term temperature overshoot.

i.JPG

4) The corresponding curve of Kp=1.3, Kd=2.0 (temperature rise: 50~70℃) is shown in Figure 10. It can be observed from the graph that if the selection is moderate, the overshoot of the system is very small, and the overshoot lasts for a short time before the equilibrium point is restored.

j.JPG

Through the above measurement curve analysis, Kp=1.3, Kd=2.0 are finally selected. At this time, the temperature control indicators are as follows: static error: T≤0.5℃; resolution: 0.1℃; overshoot: T≤0.5℃. In this case, the system operation can reach the best.

4 Conclusion

Based on the DSP function and fast processing capability of the 16-bit single-chip microcomputer SPCE061A, the data acquisition and calculation processing of this system are very convenient and simple. In addition, since the IDE supports the standard C language function library, complex mathematical operations become easy, greatly reducing the difficulty of programming. In addition, VC is used to realize the communication between the upper and lower computers, and the temperature change curve is directly displayed on the upper computer, the control performance is directly observed, and the PID parameters of the system are appropriately modified according to the curve to optimize the control.

Keywords:SPCE061A Reference address:Design of water temperature monitoring system based on SPCE061A

Previous article:Design of Temperature Measurement Circuit Using Single Chip Microcomputer
Next article:Design of self-adaptive electric water boiler based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 18:00

Design of intelligent thermometer based on 51 single chip microcomputer SPCE061A
Commonly used thermometers can be divided into the following types according to their materials and uses: glass mercury thermometers, which are accurate and inexpensive, but must be in direct contact with the human body for more than 3 minutes, and are difficult to read due to their fine scales, and also have disadv
[Microcontroller]
Design of intelligent thermometer based on 51 single chip microcomputer SPCE061A
LED large screen system design based on Cyclone EP1C6 and SPCE061A
The control circuits of the LED large-screen display systems currently used are mostly composed of a single or multiple single-chip microcomputers and complex peripheral circuits. The single-chip microcomputer programming is relatively complex, the debugging of the entire circuit is relatively troublesome, and the r
[Power Management]
Design of embedded application system based on Lingyang SPCE061A
introduction SPCE061A is a 16-bit single-chip microcomputer with u-class SP core newly launched by Lingyang Technology. SPCE061A with embedded 32K words of Flash is an economical choice for digital speech recognition applications. It supports a streamlined instruction system and has rich hardware resources
[Microcontroller]
Design of embedded application system based on Lingyang SPCE061A
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号