Detailed explanation of STM32 water temperature control system hardware

Publisher:FreeSpirit123Latest update time:2016-06-14 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
System introduction: Water temperature control system based on STM32F103. Realize water temperature control in any range from room temperature to 100 degrees. Accuracy: +/-1 degree Celsius. Average response time: 5 minutes. Control object: 1 kg of water.

The main components of the system are: platinum temperature measurement drive circuit (realized by constant current source), mains voltage zero-crossing detection circuit. Power drive circuit (realized by solid-state relay), small signal amplification circuit (realized by instrument op amp), STM32 microcontroller minimum system. 500W water temperature heating tube.

 

 

Detailed explanation of STM32 water temperature control system hardware

 

 

 

 

 

  1. Platinum resistance temperature measurement drive circuit

Drive the PT100 platinum temperature measuring resistor. The principle is similar to the resistance bridge. Use a 1MA precision constant current source to add to one end of the platinum resistor and the other end to ground. Use another 1MA precision constant current source to add to one end of the precision 100 ohm resistor and the other end to ground. (100 ohms is selected because the resistance value of PT100 is 100 ohms at zero degrees)

Detailed explanation of STM32 water temperature control system hardware

This is a platinum resistor driving circuit. R3 is a platinum resistor. When the temperature changes, the resistance will change, which will affect the voltage difference between VF1 and VF2 to be non-zero. They are respectively used as the input ends of the INA128 instrument amplifier (the advantages of the instrument amplifier are very high input impedance, good common-mode rejection ratio, and very suitable for bridge circuits). After amplification, the differential mode signal is output. However, the common mode signal of its input is relatively narrow, and the maximum can only reach near the power supply voltage. At this time, the output voltage can be adjusted by adjusting the Ref end. Then use OPA335 to complete the 10-fold amplification work to make its output within a suitable range, which is convenient for AD acquisition.

2. The current source driving the resistance bridge is 1 mA, so a precision current source must be used. Ensure that the change in resistance does not affect the current of the current source. If it is not a precision current source, the change in resistance cannot truly reflect the change in temperature, affecting the accuracy of the entire system. I used a HowLand current pump

Detailed explanation of STM32 water temperature control system hardware

 

 

Detailed explanation of STM32 water temperature control system hardware

 

 

This is a 1 mA current source. It has been tested and built to be very stable and is suitable for driving a bridge temperature measurement circuit.

3. The heating wire driving circuit uses a solid-state relay. It has stable performance but is expensive. The zero-crossing detection circuit used when adjusting the heating power notifies the microcontroller to enter an interrupt, adjusts the relay on-off time, controls the conduction angle, and thus controls the heating power. In fact, zero-crossing detection is not necessary, but it is used here because it can accurately adjust the input power, control more accurately, and have less impact on the power grid, making the entire system work more stably.

Detailed explanation of STM32 water temperature control system hardware

4. Temperature control algorithm. In the control field, water is a medium with serious hysteresis. In the control of heating power, a certain algorithm control must be adopted. Here, the PID control algorithm is adopted, which is simple and easy. By adjusting the proportion, integral, and differential constants, the power is controlled to avoid overshoot. The following is the program algorithm model

   struct PID {  

unsigned int SetPoint; // Set the target Desired Value  

unsigned int Proportion; // Proportional constant Proportional Const  

unsigned int Integral; // Integral constant Integral Const  

unsigned int Derivative; // differential constant Derivative Const  

unsigned int LastError; // Error[-1]  

unsigned int PrevError; // Error[-2]  

unsigned int SumError; // Sums of Errors  

}; 

//PID processing function

//================================================ ================================================== ===*/  

unsigned int PIDCalc( struct PID *pp, unsigned int NextPoint )  

{  

unsigned int dError,Error;  

Error = pp->SetPoint - NextPoint; // Deviation     

pp->SumError += Error; // integral     

dError = pp->LastError - pp->PrevError; // Current differential   

pp->PrevError = pp->LastError;     

pp->LastError = Error;  

return (pp->Proportion * Error // Proportional term     

+ pp->Integral * pp->SumError // Integral term  

+ pp->Derivative * dError); // differential term  

}  

This model is easy to implement on a single-chip microcomputer and has good performance. It has been verified to meet higher requirements. For the selection of various parameters, I used matching and adjusted the parameters according to the effect, and finally adjusted them to the appropriate parameters.

5. The last point is that the reference voltage source for AD acquisition is also very important, which directly affects the sampling accuracy. If possible, try to use a dedicated reference voltage source chip to control the AD sampling error.

 

The above are the design points of the entire water temperature control system, which are relatively simple. But they are very helpful for understanding PID control, as well as the use of instrument op amps, current sources, and bridge circuits. Both hardware and software have achieved a certain training effect.

Keywords:STM32 Reference address:Detailed explanation of STM32 water temperature control system hardware

Previous article:Detailed explanation of STM32 serial port function library functions and advanced application of DMA serial port (reprinted)
Next article:Detailed explanation of ucosii transplantation on stm32 4

Recommended ReadingLatest update time:2024-11-16 23:46

STM32 uses dma mode ADC
# define M 3 #define N 10 uint16_t AD_Value ; void ADC_Configuration(void) { ADC_InitTypeDef  ADC_InitStructure; ADC_DeInit (ADC1); //Set all registers of peripheral adc1 to default values ADC_InitStructure .ADC_Mode =ADC_Mode_Independent ; //Set to independent ADC mode ADC_InitStructure .ADC_ScanConvMode =ENABLE ; /
[Microcontroller]
STM32 learning notes one by one input capture
1 Overview Input capture mode can be used to measure pulse width or frequency. Except for TIM6 and TIM7, all other STM32 timers have input capture function. Simply put, STM32 input capture detects the edge signal on TIMx_CHx. When the edge signal changes (such as rising edge/falling edge), the current timer value (TIM
[Microcontroller]
STM32 learning notes one by one input capture
STM32 controls two servos
Principle: Two PWM outputs from one timer Reference: Punctual atomic code timer.c code void TIM5_PWM_Init(u16 arr,u16 psc) {   GPIO_InitTypeDef GPIO_InitStructure; TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE);//Enable timer
[Microcontroller]
STM32 study notes: basic settings of general timer
STM32 contains 11 timers, of which TIM2~TIM5 are general timers. The general timer is mounted on the low-speed peripheral bus APB1, and its clock comes from a frequency multiplier whose input is APB1. As long as the clock division number of APB1 is not 1, the clock frequency of TIMx will be twice the clock frequency
[Microcontroller]
STM32 learning notes: PWM output
1. PWM Introduction Pulse Width Modulation (PWM) is a very effective technique to control analog circuits using the digital output of a microprocessor, i.e. the control of pulse width. Except for TIM6 and 7, all other timers of STM32 can be used to generate PWM output. Among them, advanced timers TIM1 and TIM8 can gen
[Microcontroller]
STM32 learning notes: MCU button single click, double click, long press function implementation
Due to the needs of the project product, only one button can be set, but multiplexing functions such as short press (i.e. single press) to switch the working mode, long press to turn on and off, double press to pause, etc. need to be realized. The following figure shows the button waveforms in three cases. When the bu
[Microcontroller]
STM32 learning notes: MCU button single click, double click, long press function implementation
The difference between the timer timing and counting of 51 MCU and stm32
51 single chip microcomputer To set the timing time, assuming that the timer is set for 50 milliseconds, you can use this method: TH0 = (65535 - 50000) / 256, TL0 = (65535 - 50000) % 256; it can be understood as follows: because this is the initial value of the timer (the actual timing time is 65535 - initial value),
[Microcontroller]
Portable human-machine interface system based on STM32
In the process of total station measurement applied to aircraft, calculations are often involved to meet different application environments and measurement requirements. In the past, the post-measurement editing software was implemented on the computer. Modern measurement urgently needs a portable handheld computing sy
[Microcontroller]
Portable human-machine interface system based on STM32
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号