Abstract : The sand mixing truck is an important component in fracturing operations, and the control of its liquid level is the core of the sand mixing truck system. This paper introduces the design process of using an STM32 microcontroller as the control core, inputting system parameters through a touch screen, collecting, analyzing, and processing data to perform PID automatic control of the liquid level. This includes hardware circuit design, touch screen design, and software programming, and has certain practical significance.
Keywords : STM32; sand mixing truck; liquid level control
1 Introduction
Sand mixing trucks are mainly used in fracturing operations involving the addition of proppant. They mix liquids (such as water or base fluid) with proppant (quartz sand or ceramsite) and additives (solid or liquid) in a specific ratio, delivering fracturing fluids of different sand ratios and viscosities to the fracturing truck (or fracturing unit) under pressure. The automatic level control system in the mixing tank is the core component of the sand mixing truck, directly affecting its performance; therefore, studying its system design is of great significance.
2 Design Concept
This paper introduces the design of an intelligent liquid level control system for a sand mixing truck based on STM32. The system includes 4 ADCs and 2 DACs for measuring and controlling data . Users can input system parameters and PID control coefficients through a human-machine interface terminal, and simultaneously monitor the system's control status and execute some switching actions . Meanwhile, the measured data is stored in an EEPROM data memory according to a certain pattern for later data retrieval and processing. The control system structure diagram is shown in Figure 1.
Figure 1. Structure diagram of the liquid level control system
In the system's 4-channel ADC, the AD1 channel measures the liquid level of the mixture, the AD2 channel measures the angle of the suction butterfly valve, the AD3 channel measures the suction flow rate, and the AD4 channel measures the discharge flow rate. In the 2-channel DAC, the DA1 output controls the hydraulic pump, and the DA2 output controls the angle of the suction butterfly valve. Through this process, the current system operating parameters are monitored and the liquid level of the mixture is automatically controlled to reach the target liquid level.
3 Hardware Design
The hardware design block diagram of this system is shown in Figure 2. The system design uses the STM32F103RC chip as the control core. This chip has three different clock sources to drive the system clock, with a clock frequency reaching 72MHz. It features high performance, low power consumption, a Harvard architecture, and rich enhanced I/O interfaces and peripherals connected to two APB buses, meeting the design requirements.
Figure 2 Overall Hardware Block Diagram
As shown in the figure, data from four sensors is processed through acquisition, A/D conversion, filtering, and stabilization. This data is compared with parameters input by the user via the touchscreen. A PID algorithm controls the DA conversion output, which in turn controls the operation of the hydraulic pump and butterfly valve, achieving the effect of controlling the liquid level in the sand mixing truck. The touchscreen and microcontroller communicate via a serial port. The microcontroller receives and sends commands through the serial port to identify and control the touchscreen's actions. The suction and discharge flow meters each have two options: #4 and #8, which need to be set by the user. The suction cavitation, target, high/low, and high-high-low-low liquid level values also need to be set by the user. When the measured liquid level is lower than the suction cavitation level, the system will output a suction cavitation alarm via PB3. When the measured liquid level is higher than the high liquid level, a high liquid level alarm will be output via PA6. When the measured liquid level is lower than the low liquid level, a low liquid level alarm will be output via PA7. Data storage is connected to the AT24C512 storage chip via the I2C bus. This chip is a serial, high-capacity, electrically erasable programmable controller with features such as compact structure, large storage capacity, low power consumption and price, long data retention time, and high read/write cycles. It has 512 pages of storage space, with each page containing 128 bytes. When the storage space is full, it will overwrite historical data and refresh the storage records, fully meeting the system's data and parameter storage requirements.
4. Touchscreen Design
The design of the human-computer interaction system plays a crucial role in the overall system design. The simplicity and aesthetics of the interface, as well as the accuracy and smoothness of the touchscreen operation, directly impact the performance of the entire liquid level control system. The touchscreen used in this system is the basic DMT64480T056_01WT color touchscreen terminal from Beijing Diwen Technology Co., Ltd. It has a 5.6 -inch screen, a resolution of 640×480 pixels, a 12V power supply, full-duplex asynchronous serial port mode, a baud rate of 115200bps, simple peripherals, and is inexpensive.
The DWIN touchscreen and controller use serial communication and a unified set of operating instructions. When the user sends data to the touchscreen, the data is input from the "DIN pin" of the touchscreen user interface. When the touchscreen sends data to the user, the data is output from the "DOUT pin" of the touchscreen user interface. Its serial data frame consists of 4 data blocks, as shown in Table 1. For the specific function of the instructions, please refer to the HMI instruction set.
Table 1. Composition of DIV HMI Data Frames
Based on the requirements of the measurement and monitoring data in the system, the main human-machine interface is designed as shown in Figure 3.
Figure 3 System Operation Main Interface
After the system is powered on, the main interface appears. On the left side of the interface is the display section, showing the system's four measurement data points: the liquid level of the mixed liquid, the angle of the suction butterfly valve, the suction flow rate, and the discharge flow rate. It also displays the set target liquid level and the calculated pump efficiency. On the right side of the interface are the liquid level alarm area and the function setting area. When the measured liquid level is higher than the high alarm level or lower than the low alarm level or the suction evacuation level, the system will sound an alarm buzzer and the alarm red light will flash. Pressing the "Alarm Mute" button will silence the buzzer.
The function setting area has five function keys: "Settings," "Open Valve," "Close Valve," "Start," and "Alarm Silent." The "Open Valve" and "Close Valve" keys control the opening and closing of the butterfly valve. The "Start" key initiates the system's automatic PID control process. The "Settings" key enters the system parameter setting interface, requiring a system password to access the main menu. The main menu contains "User Settings," "Manufacturer Settings," "Modify Time," and "Modify Password." The "Manufacturer Settings" option is inaccessible to the user and represents the system's default configuration, including settings for the proportional, integral, and derivative coefficients of the temperature control parameters. These settings can only be configured by the manufacturer and are protected by a manufacturer password; once set, the parameters cannot be changed by the user. The "Modify Time" and "Modify Password" options allow modification of the system display time and the password required to access the system settings. To prevent input errors, the new password must be entered twice. The "User Settings" option allows the user to modify system control parameters as needed; the user setting interface is shown in Figure 4.
Figure 4 User settings interface
In the user settings, "Level Setting" includes setting parameters such as target level, suction level, high level, low level, high-high level, and low-low level. The set parameters are stored in the EEPROM memory. "Manual Calibration" includes zero-point and endpoint calibration for data measurement from four ADC channels, correcting the data according to actual conditions. "Data Processing" includes setting the data storage period (in minutes), historical data peak query and index query, and setting whether to clear data. Note that clearing data will erase all historical data stored in the EEPROM; choose carefully. The suction and discharge flow meters each have two options: #4 and #8, which need to be set according to actual conditions. After setting the control parameters, the user can press the "Return" key to return to the system main interface. Once everything is ready, the system can be started to automatically control the liquid level and monitor the system's operation in real time.
5. Software Design
5.1 Overall Design
The software program mainly performs the following functions: system configuration, data processing, touchscreen communication, and PID algorithm control. System configuration includes timer configuration, serial port configuration, interrupt configuration, I/O port configuration, ADC and DAC configuration, touchscreen configuration, and EEPROM configuration. Touchscreen communication is implemented through serial port interrupts, and data processing is implemented through timer interrupts . The serial port has higher priority than the timer, and touchscreen commands are processed first. The software program flowchart is shown in Figure 5, and the software program is written based on this flowchart.
Figure 5 System Program Flowchart
5.2 PID Control Algorithm
This paper uses a PID control algorithm to control the liquid level of the mixture. The algorithm has a simple structure, good stability, reliable operation and convenient adjustment. The block diagram of its PID control system is shown in Figure 6.
Figure 6 Block diagram of PID control principle
The PID control algorithm used here is incremental control, and the calculation formula is shown below, where Kp is the proportional coefficient, TI is the integral time constant, and TD is the derivative time constant. The performance of PID control can be improved by adjusting the values of the three coefficients. In this system, the values of the three parameters can be changed in the "Manufacturer Settings" option.
6 Conclusion
The intelligent liquid level control system for sand mixing trucks is of great significance for controlling the liquid level in the mixing tank. Its control capability directly determines the performance of the sand mixing truck. This article details the overall design concept of the intelligent liquid level control system, including hardware design, touch screen design, and software programming process. It can accurately achieve automatic control of the liquid level, and the human-machine communication is precise and sensitive, which greatly improves the performance of sand mixing trucks in fracturing operations and has great practical significance.
[1] Yu Jinqian, Yu Bin. Development and Application of Microcontroller Based on STM32F Series ARM Cortex-M3 Core. Beijing: Tsinghua University Press, 2011.
[2] Wu Chunxue, Wang Na, Yu Zhenwei, Lei Ming, Li Hongkui. Automatic control system of HF2002 sand mixing truck [Journal article]. Computer Measurement & Control, 2003, 11(5).
About the authors : Du Miaomiao: Master's student, Class of 2012, School of Automation, University of Science and Technology Beijing; Research interests: Embedded systems, control theory and control engineering. Shi Zhongsuo: Professor, School of Automation, University of Science and Technology Beijing; Research interests: Control theory and control engineering, pattern recognition, embedded systems, intelligent analysis of image information and image engineering.