Research on PID Algorithm for Electronic Pressure Controller
2026-04-06 05:13:33··#1
With the development of automatic control technology, the application of precision air pressure generation and control technology is becoming increasingly widespread. However, traditional valve controllers lack sufficient control precision, operate slowly, and are expensive, failing to meet these requirements. This paper focuses on an electronic pressure controller based on the Infineon XC164 microcontroller and PI control algorithm, and explores the implementation of precision pressure control using this device. Automatic Selection System Composition and Implementation The electronic pressure control system consists of an air supply device, controller, valves, air storage device, and sensor units. The function of the electronic pressure controller is to maintain a proportional relationship between the output air pressure and the input signal. To achieve precise control of the air pressure in the air storage device, the opening and closing of two high-frequency solenoid valves are used to regulate the output pressure. The system adopts closed-loop PI control, with pressure obtained from two pressure sensors: one at the user end and one at the controller end. Figure 1 is a block diagram of the system, showing that the pressure sensor and PI controller constitute the closed-loop feedback part of the system. Figure 1: Electronic Pressure Controller Structure Diagram. Control System Accuracy Analysis In the electronic pressure control system, the main modules affecting control accuracy are the ADC, pressure sensor, and valve. The electronic pressure controller operates normally at pressures of 0–100 psi. However, the accuracy of traditional 8-bit ADCs is too low; to achieve 1% accuracy, a 10-bit ADC (with a sampling value of 0.09 psi) is required. The electronic pressure controller places many demands on the sensor, such as high accuracy, good linearity, good temperature stability, and long service life. Therefore, the Honeywell SX series pressure sensor is selected. Its pressure measurement range is 0–150 psi, with an accuracy of 0.3 mV/psi, which is sufficient to meet the accuracy requirements of this controller. The switching speed of the solenoid valve will also be an important indicator. However, to extend valve life, the number of valve switching operations should be minimized. Practical control systems always need to track the input signal or overcome interference from agitation signals. Therefore, it is necessary to analyze the dynamic error of the system. Let the error transfer function be , which can be expanded into a Taylor series at s=0: where is the open-loop transfer function of the system. Under any input function, the Laplace transform series of the system's dynamic error converges in the neighborhood of s=0. Therefore, when s approaches 0, i.e., t is large, we have: e(t) = C0r(t) + C1r(t) + C2r/2! + ... where e(t) is the system's dynamic error; C0, C1, ... are the dynamic error coefficients. When s→0, it can be seen that by obtaining the dynamic error coefficients, the tracking error can be directly linked to the system's open-loop transfer function, and the transfer function can be designed according to the accuracy requirements of the system; or, based on the input and output data of the identified object, the relevant model can be obtained through identification, and the model can be converted into a transfer function or state-space model, and then the theoretical error of the system can be analyzed using the above methods. Electronic Pressure Controller Hardware Structure and Software Implementation The electronic pressure controller has an input voltage of 24V and a normal operating air pressure of 0~100psi. Users can select control signals (0~10V or 0~5V, 4~20mA, 8-bit digital signal) to control the air pressure. The input voltage of 24V is converted into 5V and 2.5V by the power supply module to supply the microcontroller. Simultaneously, a 10V reference voltage is output through the power reference module to supply the sensor. The user-provided control signal is amplified and output to the microcontroller's ADC, or output to the microcontroller's I/O port via a data latch to provide the pressure setpoint. The sensor output signal is amplified and sent to the microcontroller for sampling, and simultaneously displayed on the LCD. The user can control the valve using buttons. Furthermore, communication between the controller and the computer is achieved via a serial port. The controller hardware structure block diagram is shown in Figure 2. The software design is based on DAVE and KEIL software. Upon system startup, the calibration value stored in FLASH is read. Before performing PI calculations, A/D sampling and processing of the A/D sampled values must be completed; therefore, the A/D sampling period cannot be too long, otherwise, it will not be able to reflect the instantaneous value of the system. The LCD display program should use a polling method to avoid repetitive writing. Since the microcontroller is a high-speed device, while the LCD is a low-speed device, sufficient delay time must be ensured for the LCD instructions; otherwise, errors will occur. To display the pressure change curve and facilitate calibration or command control, the controller is controlled via a PC interface using the Modbus protocol. To store sensor calibration values, the controller program uses in-application programming (IPM). The result of the PI calculation is used to generate a PWM signal to control the opening and closing of the intake/exhaust valves, thereby achieving precise air pressure control. The PI control algorithm (PID control) primarily uses a microprocessor to compare the given pressure setpoint with the actual pressure value fed back from the sensor, using the deviation to control the intake and exhaust volume of the valves, thus achieving precise air pressure control. When the deviation between the actual pressure and the setpoint is within a certain range, the intake and exhaust valves stop operating, and the pressure in the pressure chamber reaches equilibrium. The general form of the discrete PID algorithm is: Kp, KI, and KD represent the proportional coefficient, integral coefficient, and derivative coefficient, respectively, which can be adjusted according to the controlled object. This algorithm is simple, and the parameters are easy to adjust, so it is widely used. The author's program only uses PI control, which is briefly introduced below. Proportional coefficient: Increasing the proportional coefficient Kp can make the system more sensitive and faster in response; however, a large Kp will lead to more oscillations and a longer settling time; excessively large Kp will cause system instability. It should be noted that increasing Kp can only reduce the error, not completely eliminate the steady-state error. Integral coefficient: The integral coefficient KI can eliminate the steady-state error of the system and improve the accuracy of the control system. It is worth noting that to improve the control response speed, it is best to assign a non-zero initial value to the integral. Since the intake and exhaust speeds are different, it is best to give the intake and exhaust different initial values to improve speed and accuracy. Adding integral correction to the system can cause a saturation effect, and the overshoot may be too large; therefore, an integral separation algorithm is introduced. To reduce the impact of integral correction on the dynamic performance of the control system, integral correction needs to be canceled at the beginning of control or during large value changes; and when the error between the actual pressure value and the set value is less than a certain value, the integral correction effect is restored to eliminate the steady-state error. The integral separation algorithm can maintain the effect of the integral while reducing the overshoot, improving the performance of the control system. The block diagram of the control algorithm is shown in Figure 3. Figure 3 shows the structure of the PI control algorithm. Figure 4 shows the response curves of the controller under different pressure setpoints. Due to system leakage or user-used air pressure, the pressure fluctuation increases with the increase of the setpoint, and the time to reach steady state becomes longer. Figure 5 compares the response curves with and without an integral initial value. In this figure, the sampling time is 1 second, and the number of sampling points is 115. It can be seen from the figure that the time to reach steady state with an integral initial value is significantly shorter than that without an integral initial value. The result of the PI calculation is used to generate a PWM signal. The PWM signal is generated using the Infineon Capture/Compare Unit (CAPCOM1/2), and the PI algorithm is called in the overflow interrupt generated by the timer register to obtain the value of the comparison register. The execution period of the PWM needs to be appropriately selected. If the period is too short, it may lead to frequent valve opening and closing, shortening the valve's service life, and may also cause over-control of the valve; if the period is too long, it will be impossible to adjust the air pressure in a timely manner and control accuracy will be compromised. The PWM period in the program is 10ms (the valve turn-on time is only 3.4ms). Conclusion The electronic pressure controller, based on dual-sensor negative feedback and employing an integral-separated PI control algorithm with dead zone, solves the problems of speed and stability in pressure control. This system has a simple structure, reliable operation, and achieves precise control of air pressure.