Intelligent control method and system for brushless pump based on single-chip microcomputer
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NINGBO PUZE INTELLIGENT ELECTRIC APPLIANCE CO LTD
- Filing Date
- 2026-07-07
- Publication Date
- 2026-08-04
AI Technical Summary
[0005]本申请旨在提出一种基于单片机的无刷泵智能控制方法及系统,通过在同一单片机内执行ADC采样、级联数字滤波、PID计算、模式切换、FOC矢量控制和通信任务,并通过中断控制器管理所述FOC矢量控和所述ADC采集的优先级,解决现有方案中传感器接口与实时控制架构的结构性冲突、信号波动导致的误触发以及单一模式运行能耗高的问题
(1)模拟压力传感器直接连接ADC模块、温度传感器通过分压电路连接ADC模块、脉冲式流量传感器连接定时器捕获单元,三种传感器信号分别通过不同的片上外设直接采集,无IIC总线通信等待延迟,无需单总线时序解析,无中断禁用风险;同时,中断控制器将FOC矢量控制的定时中断配置为最高优先级、将ADC采集的定时中断配置为次高优先级,使ADC采集和FOC矢量控制在同一单片机内由中断控制器协调执行时序,互不抢占,确保压力传感器信号能够在定时中断中以足够的采样率稳定采集,为PID闭环控制提供及时、连续的压力反馈数据;
Smart Images

Figure CN122504618A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of microcontroller-based intelligent control and fluid transport equipment technology, specifically to a microcontroller-based intelligent control method and system for a brushless pump. Background Technology
[0002] Existing RO (Reverse Osmosis) water purification systems typically use a dual control method of pressure switch and relay for brushless pumps, starting when the water pressure is below the lower limit and stopping when it is above the upper limit. However, the actual operating state of the system is also affected by many factors such as water temperature, inlet water pressure, and outlet water flow. This control method cannot distinguish between temperature factors and changes in water demand under low temperature and low inlet water pressure conditions, resulting in frequent start-stop or idling of the brushless pump, increased energy consumption, and shortened lifespan.
[0003] To improve control accuracy, some solutions introduce pressure sensors as feedback to form a closed loop. However, if an IIC digital pressure sensor is selected, its internal ADC (Analog-to-Digital Converter) conversion time is 2.5ms to 5ms, the effective update frequency of the pressure feedback loop is less than 200Hz, and the PID (Proportional-Integral-Derivative) control lags behind load changes. If a DS18B20 single-bus temperature sensor is selected, its microsecond-level timing requirements coexist with the high-frequency interrupt of FOC (Field-Oriented Control) (carrier period 62.5µs). Disabling the global interrupt causes the FOC current loop to lose its control cycle, increasing current distortion by about 8%. At the same time, if the pressure spikes (lasting 50ms to 100ms) generated by the water hammer effect during the start-up and shutdown of the brushless pump are directly responded to, the false trigger rate is about 15% to 20%. Brushless pumps that only support a single constant pressure operating mode continue to run at rated speed in standby mode, with standby energy consumption accounting for 25% to 30% of total operating energy consumption. IoT solutions focus on data reporting rather than real-time closed-loop control, meaning the brushless pump cannot operate independently after a network outage.
[0004] In the aforementioned existing technologies, closed-loop control requires sensors to provide low-latency feedback signals at a frequency of at least 500Hz, and FOC high-frequency interrupts require that the sensor interface not introduce the risk of communication waiting or interruption disabling. However, existing solutions fail to simultaneously meet these requirements in terms of sensor interface and signal processing, resulting in the inability of real-time pressure closed-loop control and communication functions to operate collaboratively within the same microcontroller. This issue remains unresolved. Summary of the Invention
[0005] This application aims to propose a microcontroller-based intelligent control method and system for brushless pumps. By executing ADC sampling, cascaded digital filtering, PID calculation, mode switching, FOC vector control, and communication tasks within the same microcontroller, and by managing the priority of the FOC vector control and ADC acquisition through an interrupt controller, this method solves the problems of structural conflict between sensor interfaces and real-time control architecture, false triggering caused by signal fluctuations, and high energy consumption in single-mode operation in existing solutions.
[0006] To achieve the above objectives, this application provides a microcontroller-based intelligent control method for a brushless pump. The method utilizes a microcontroller to perform operations including ADC acquisition, cascaded digital filtering, PID calculation, FOC vector control, and communication tasks. The microcontroller integrates an interrupt controller, which configures the timer interrupt for FOC vector control as the first priority and the timer interrupt for ADC acquisition as the second priority, with the first priority being higher than the second priority. ADC acquisition is performed during the timer interrupt. The ADC module acquires the pressure signal output from an analog pressure sensor at a sampling rate of at least 500Hz, acquires the temperature signal output from a temperature sensor, and acquires the flow signal output from a pulse-type flow sensor through a timer capture unit. The analog pressure sensor is located at the outlet of the brushless pump and is used to measure the outlet pressure of the brushless pump. The pressure signal is used as the main feedback quantity for PID closed-loop control; the temperature sensor is installed on the brushless pump or its drive circuit to measure the operating temperature of the brushless pump or its drive circuit for over-temperature protection; the pulse flow sensor is installed on the output pipeline of the brushless pump to measure the output flow of the brushless pump to identify the user's water usage status; cascaded digital filtering: cascaded digital filtering is performed on the pressure signal, which includes median filtering and moving average filtering; PID calculation: PID calculation is performed using the cascaded digitally filtered pressure signal as the main feedback quantity to output the speed correction quantity; mode switching: switching between multiple operating modes according to the temperature signal and the flow signal, wherein the operating mode is triggered by the temperature signal, the flow signal and the preset duration; FOC vector control: driving the brushless pump according to the speed correction quantity through FOC vector control; communication task: performing communication tasks with external devices.
[0007] Preferably, the sampling rate of the pressure signal is 1 kHz; the sampling rate of the temperature signal is not less than 10 kHz.
[0008] Preferably, the window length of the median filter is a first window length that covers the duration of the pressure spike, and the window length of the moving average filter is a second window length that smooths the residual noise.
[0009] Preferably, the operating modes include constant pressure mode, constant current mode, energy-saving mode, sleep mode, and temperature drop mode; When initially set to constant flow mode, the constant flow mode is triggered, and the PID closed loop maintains a constant flow rate at the outlet of the brushless pump. When initially set to constant pressure mode, the PID closed loop maintains a constant pressure at the outlet of the brushless pump; When the flow rate signal is lower than the first flow rate threshold and the duration exceeds the first preset duration, the constant pressure mode is switched to the energy-saving mode, and the brushless pump is controlled to reduce its speed to the first preset speed percentage; when the flow rate signal is not lower than the second flow rate threshold, the energy-saving mode is switched to the constant pressure mode. When the flow signal remains zero for more than a second preset duration, the system switches from the energy-saving mode to the sleep mode, shutting down the motor drive; when the flow signal is not lower than the second flow threshold, the system switches from the sleep mode to the constant pressure mode. When the temperature signal exceeds the first temperature threshold, the constant pressure mode is switched to the temperature drop mode, and the brushless pump is controlled to reduce its speed to a second preset speed percentage; when the temperature signal drops below the second temperature threshold, the temperature drop mode is switched back to the constant pressure mode.
[0010] Preferably, the communication task includes RS-485 bus communication or Wi-Fi communication, and the microcontroller interacts with external devices via Modbus RTU protocol and / or MQTT protocol.
[0011] Preferably, the microcontroller stores local operating parameters, supports communication with external devices, and operates independently based on the stored local operating parameters when communication is interrupted.
[0012] Preferably, the method further includes communication interruption detection: the communication connection status is detected periodically at a preset period, and when the number of consecutive communication connection failures reaches a preset number, it is determined as a communication interruption; during the communication interruption, the microcontroller caches key event records, and automatically reconnects and resends the cached key event records after communication is restored.
[0013] This application also provides a microcontroller-based intelligent control system for a brushless pump, used to implement any of the methods described above, including a sensing layer, a decision layer, and an execution layer, wherein: the sensing layer includes an analog pressure sensor, a temperature sensor, and a pulsed flow sensor; the pressure sensor is located at the outlet end of the brushless pump, used to measure the outlet pressure of the brushless pump as the main feedback quantity for PID closed-loop control, and is directly connected to the ADC module of the microcontroller; the temperature sensor is located at the brushless pump or drive circuit, used to measure the operating temperature of the brushless pump or drive circuit for over-temperature protection, and is connected to the ADC module of the microcontroller through a voltage divider circuit; the pulsed flow sensor is located at the output end pipeline of the brushless pump, used to measure the output pressure of the brushless pump. The terminal flow rate is used to identify the user's water usage status and is connected to the timer capture unit of the microcontroller; the execution layer includes a three-phase inverter bridge and a brushless pump, the three-phase inverter bridge driving the brushless pump according to the speed correction amount; the decision layer, running inside the microcontroller, includes: a sampling module for implementing ADC acquisition, executed in a timer interrupt, acquiring the pressure signal and the temperature signal through the ADC module, and acquiring the flow rate signal through the timer capture unit; a cascaded digital filtering module for implementing cascaded digital filtering, performing median filtering and moving average filtering on the pressure signal; and a PID control module for implementing PID calculation, using the filtered pressure signal as the main feedback quantity for PID calculation, and outputting the speed correction amount; The FOC vector control module is used to implement FOC vector control to drive the brushless pump according to the speed correction amount; the multi-mode state machine module is used to implement mode switching to switch between multiple operating modes according to the flow signal and the temperature signal, wherein the operating mode is triggered by the temperature signal, the flow signal and the preset duration; the interrupt controller is used to configure the timer interrupt of the FOC vector control as the first priority and the timer interrupt of the ADC acquisition as the second priority, wherein the first priority is higher than the second priority.
[0014] Preferably, the system further includes a communication module for supporting data interaction with external devices and enabling the system to operate independently based on locally stored operating parameters when communication is interrupted.
[0015] Preferably, the sampling rate of the pressure sensor is 1 kHz; the sampling rate of the temperature sensor is not less than 10 kHz; the window length of the median filter is a first window length that covers the duration of the pressure spike; and the window length of the moving average filter is a second window length that smooths the residual noise.
[0016] The intelligent control method and system for a brushless pump based on a microcontroller provided in this application have the following beneficial effects: (1) The analog pressure sensor is directly connected to the ADC module, the temperature sensor is connected to the ADC module through a voltage divider circuit, and the pulse flow sensor is connected to the timer acquisition unit. The three sensor signals are directly acquired through different on-chip peripherals. There is no IIC bus communication waiting delay, no need for single-bus timing analysis, and no risk of interrupt disabling. At the same time, the interrupt controller configures the timing interrupt of FOC vector control as the highest priority and the timing interrupt of ADC acquisition as the second highest priority. This allows the timing of ADC acquisition and FOC vector control to be coordinated and executed by the interrupt controller in the same microcontroller without competing with each other. This ensures that the pressure sensor signal can be stably acquired at a sufficient sampling rate during the timing interrupt, providing timely and continuous pressure feedback data for PID closed-loop control. (2) The pressure signal is processed by median filtering and moving average filtering in a cascade manner, so that the pressure feedback entering the PID calculation is smooth and continuous, eliminating the interference of pressure spikes caused by water hammer effect at the moment of pump start-up and shutdown on the control logic, so that the subsequent PID calculation is based on clean pressure data, avoiding false triggering caused by sudden changes in pressure signal. (3) The analog pressure sensor is set at the outlet end of the brushless pump to directly measure the outlet pressure of the brushless pump. The pressure signal after cascaded digital filtering is used as the main feedback quantity for PID calculation, outputting the speed correction quantity, and driving the brushless pump through FOC vector control, so that the pump outlet pressure can be automatically adjusted according to the load change, and the precise closed-loop control of the outlet pressure is realized. (4) The mode switching steps are based on the temperature signal and the flow signal; the temperature sensor is set in the brushless pump or drive circuit to continuously monitor the operating temperature, and actively switches to the temperature drop mode to reduce speed protection when the temperature is too high; the pulse flow sensor is set in the output pipeline of the brushless pump to continuously monitor the user's water usage status, and switches to the energy-saving mode to reduce speed during water usage intervals, and switches to the sleep mode to shut down the drive when there is no water usage for a long time, so that the operating status of the brushless pump always matches the user's actual water usage needs, reducing unnecessary energy consumption in the standby state; (5) This application supports dual communication interfaces, and the microcontroller stores local operating parameters; when communication is interrupted, it automatically switches to local autonomous mode and runs independently based entirely on local sensor data and built-in judgment logic; after communication is restored, it automatically reconnects and resends cached key event records. Communication tasks and real-time control are managed and coordinated within the same microcontroller using interrupt priority, and the control function is not interrupted or degraded due to the execution of communication tasks, achieving dual-mode reliability of no system crash when disconnected from the network and controllable when connected to the network. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the method provided in an embodiment of this application.
[0019] Figure 2 This is a schematic diagram of the overall system architecture provided for an embodiment of this application.
[0020] Figure 3 This is a schematic diagram illustrating the switching state of the multi-mode operation strategy provided in the embodiments of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0023] like Figure 1 As shown, this application provides a microcontroller-based intelligent control method for a brushless pump (hereinafter referred to as the "method"). The method is applied to a microcontroller, which performs operations including ADC acquisition, cascaded digital filtering, PID calculation, FOC vector control, and communication tasks. The microcontroller integrates an interrupt controller, which configures the timing interrupt of the FOC vector control as the first priority and the timing interrupt of the ADC acquisition as the second priority, with the first priority being higher than the second priority. The higher priority of the FOC vector control ensures that hard real-time control and communication operate collaboratively within the same microcontroller. The FOC vector control executes precisely at a fixed period, resulting in low current waveform distortion and stable brushless pump operation. The ADC sampling is synchronized with the PWM cycle, ensuring precise sampling timing and accurate pressure feedback data. This application also provides a microcontroller-based intelligent control system for a brushless pump (hereinafter referred to as the "system") for implementing this method. The operations in the method are described below.
[0024] ADC acquisition operation: Executed in a timer interrupt, the ADC module acquires the pressure signal output from the analog pressure sensor at a sampling rate of no less than 500Hz, the temperature signal output from the temperature sensor is acquired through the ADC module, and the flow signal output from the pulse flow sensor is acquired through the timer capture unit. The analog pressure sensor is installed at the outlet end of the brushless pump to measure the outlet pressure of the brushless pump as the main feedback quantity for PID closed-loop control. The temperature sensor is installed at the brushless pump or its drive circuit to measure the operating temperature of the brushless pump or its drive circuit for over-temperature protection. The pulse flow sensor is installed at the output pipeline of the brushless pump to measure the output flow of the brushless pump to identify the user's water usage status. A simulated pressure sensor is directly connected to the ADC module, a temperature sensor is connected to the ADC module via a voltage divider circuit, and a pulsed flow sensor is connected to a timer acquisition unit. The signals from these three sensors are directly acquired through different on-chip peripherals, eliminating IIC bus communication delays, single-bus timing analysis, and the risk of interrupt disabling. Simultaneously, the interrupt controller configures the FOC vector control timer interrupt as the highest priority and the ADC acquisition timer interrupt as the second highest priority. This ensures that ADC acquisition and FOC vector control are coordinated and executed within the same microcontroller by the interrupt controller, preventing preemption and ensuring that the pressure sensor signal can be stably acquired at a sufficient sampling rate during the timer interrupt, providing timely and continuous pressure feedback data for PID closed-loop control. In one specific implementation, the pressure signal sampling rate is 1kHz; the temperature signal sampling rate is not less than 10Hz. The pressure sampling rate is quantized to 1kHz, allowing the PID calculation to obtain the current pressure value every 1ms. The temperature sampling rate is limited to not less than 10Hz to adapt to the temperature signal change rate and avoid wasting ADC resources.
[0025] In the cascaded digital filtering operation, the pressure signal undergoes cascaded digital filtering, which includes median filtering and moving average filtering. Performing cascaded median filtering and moving average filtering on the pressure signal smooths and ensures the pressure feedback entering the PID calculation is continuous. This eliminates the interference of pressure spikes caused by water hammer during pump start-up and shutdown on the control logic, ensuring that subsequent PID calculations are based on clean pressure data and avoiding false triggering caused by sudden pressure signal changes. In a specific embodiment, the window length of the median filtering is a first window length, such as 15, covering the duration of the pressure spike, and the window length of the moving average filtering is a second window length, such as 16, to smooth residual noise.
[0026] In the PID calculation operation, the pressure signal after cascaded digital filtering is used as the main feedback quantity for PID calculation, and the output speed correction quantity is output. An analog pressure sensor is set at the outlet end of the brushless pump to directly measure the outlet pressure of the brushless pump. The pressure signal after cascaded digital filtering is used as the main feedback quantity for PID calculation, and the output speed correction quantity is output. The brushless pump is driven by FOC vector control, so that the pump outlet pressure can be automatically adjusted according to the load change, realizing precise closed-loop control of the outlet pressure.
[0027] During mode switching, the system switches between multiple operating modes based on the temperature and flow signals. Each operating mode is triggered by the temperature, flow, and preset duration. A temperature sensor, located on the brushless pump or drive circuit, continuously monitors the operating temperature and actively switches to a temperature-reduction mode for speed protection when the temperature exceeds the limit. A pulse-type flow sensor, located in the output pipeline of the brushless pump, continuously monitors the user's water usage. During water usage intervals, it switches to an energy-saving mode to reduce speed, and during prolonged periods of no water usage, it switches to a sleep mode to shut down the drive. This ensures that the brushless pump's operating state always matches the user's actual water demand, reducing unnecessary energy consumption in standby mode. Preferably, the operating modes include constant pressure mode, constant flow mode, energy-saving mode, sleep mode, and temperature drop mode; when initially set to constant flow mode, the constant flow mode is triggered, and the PID closed loop maintains a constant flow rate at the outlet of the brushless pump; when initially set to constant pressure mode, the PID closed loop maintains a constant pressure at the outlet of the brushless pump; when the flow signal is lower than a first flow threshold and the duration exceeds a first preset duration, the mode switches from constant pressure mode to energy-saving mode, controlling the brushless pump to reduce its speed to a first preset percentage of its rotational speed; when the flow signal is not lower than a second flow threshold... When the flow rate signal is zero for more than a second preset duration, the system switches from the energy-saving mode to the constant pressure mode, shutting down the motor drive. When the flow rate signal is not lower than the second flow rate threshold, the system switches from the sleep mode to the constant pressure mode. When the temperature signal exceeds the first temperature threshold, the system switches from the constant pressure mode to the temperature drop mode, controlling the brushless pump to reduce its speed to a second preset speed percentage. When the temperature signal drops below the second temperature threshold, the system switches from the temperature drop mode to the constant pressure mode. By quantifying the triggering conditions and control strategies of each mode into specific values, it is ensured that each mode is triggered under correct operating conditions and exits when the conditions are not met. In a specific embodiment, the first flow rate threshold is 0.1 L / min and the first preset duration is 5 seconds, the first preset speed percentage is 60% of the rated speed; the second flow rate threshold is 0.3 L / min; the second preset duration is 30 minutes; the first temperature threshold is 85°C, the second preset speed percentage is 70% of the rated speed, and the second temperature threshold is 65°C. Among them, the target values of constant pressure mode and constant current mode are different, and the maximum value of speed correction is limited in energy saving mode and temperature drop mode. Therefore, by switching modes, the target value of PID calculation can be changed or the upper limit of PID output can be limited. PID calculation outputs speed correction according to the constraints of the current mode.
[0028] In FOC vector control operation, the brushless pump is driven according to the speed correction amount. FOC vector control converts the speed correction amount into a PWM (Pulse Width Modulation) signal to drive the brushless pump. The brushless pump speed is precisely tracked according to the speed correction amount, resulting in smooth operation and low noise. For example, FOC uses Clark / Park transformation to convert the speed correction amount into an SVPWM (Space Vector Pulse Width Modulation) signal to drive the brushless pump.
[0029] In the communication task operation, communication tasks with external devices are executed. The brushless pump controller interacts with external devices through a communication interface, receiving remotely sent operating parameters and reporting local operating status. Specifically, the communication tasks include RS-485 bus communication or Wi-Fi communication, and the microcontroller interacts with external devices through Modbus RTU protocol and / or MQTT protocol. By limiting dual communication interfaces and dual protocol stacks, it adapts to both wired and wireless communication paths. In one embodiment, the microcontroller stores local operating parameters, supports communication with external devices, and runs independently based on the stored local operating parameters when communication is interrupted, operating independently without relying on external instructions. Preferably, the method further includes a communication interruption detection operation: the communication connection status is detected periodically at a preset period, and when the number of consecutive communication connection failures reaches a predetermined number, it is determined as a communication interruption; during the communication interruption, the microcontroller caches key event records, and automatically reconnects and resends the cached key event records after communication is restored. By setting a preset monitoring period and a preset number of consecutive failures, frequent switching caused by instantaneous network jitter is avoided; the local caching and resending mechanism ensures that data is not lost during network outages. In this application, Modbus RTU refers to the Modbus Remote Terminal Unit protocol. MQTT refers to the Message Queuing Telemetry Transport protocol.
[0030] The six operations mentioned above—ADC acquisition, cascaded digital filtering, PID calculation, mode switching, FOC vector control, and communication tasks—exhibit close positive dependencies and inverse constraints. In the positive dependency direction: the pressure data acquired by the ADC serves as the input to the filtering algorithm, and the sampling rate determines the time resolution of the filtering window; the clean pressure signal output after filtering is the main feedback quantity for PID calculation, and the filtering quality determines the stability of the PID input; the speed correction quantity output by the PID calculation is the input quantity for FOC vector control, and the PID output frequency determines the update frequency of the FOC speed loop setpoint; the flow signal captured by the timer and the temperature signal acquired by the ADC are the basis for mode switching, and continuous monitoring of the flow signal determines the triggering timing of energy-saving mode and sleep mode; the mode switching output mode command changes the target value and output upper limit of the PID calculation, and also changes the speed upper limit and operating status of the FOC vector control; the external parameters received by the communication task can adjust the ADC sampling rate, PID target value and coefficients, mode switching threshold, and FOC speed upper limit, and the operating status reported by the communication task originates from the output variables of the above operations. In the reverse constraint direction: ADC acquisition must avoid the high-frequency interrupt execution period of FOC vector control to prevent data loss due to interruption of sampling operations; the window length of the filtering algorithm must match the ADC sampling rate (a window of 15 corresponds to a 15ms time window when the sampling rate is 1kHz), and the filtering delay should change synchronously if the sampling rate changes; the PID calculation cycle must be synchronized with the filter output update frequency (the filter updates every 1ms), and the PID is executed after each sampling cycle, with both running at the same frequency; the mode switching instruction must take effect at the boundary of the PID calculation cycle to avoid changes in the target value during PID calculation, which could cause control quantity jumps; communication tasks must not preempt the interrupt resources of FOC vector control, and communication protocol parsing and status reporting are executed in the main loop to ensure that the high-frequency interrupt of FOC vector control is not blocked or delayed by any operation. The above operations are managed and coordinated in the same microcontroller using interrupt priority, with high-priority interrupts (FOC vector control) preempting low-priority tasks (communication), and medium-priority interrupts (ADC sampling) nested in the main loop, forming a complete real-time control framework.
[0031] like Figure 2 As shown, this application also provides a microcontroller-based intelligent control system for brushless pumps, used to implement the aforementioned method. The system includes a perception layer, a decision-making layer, and an execution layer.
[0032] The sensing layer includes an analog pressure sensor, a temperature sensor, and a pulsed flow sensor. The pressure sensor is located at the outlet of the brushless pump to measure the outlet pressure of the brushless pump as the main feedback quantity for PID closed-loop control, and is directly connected to the ADC module of the microcontroller. The temperature sensor is located at the brushless pump or drive circuit to measure the operating temperature of the brushless pump or drive circuit for over-temperature protection, and is connected to the ADC module of the microcontroller through a voltage divider circuit. The pulsed flow sensor is located at the output pipeline of the brushless pump to measure the output flow of the brushless pump to identify the user's water usage status, and is connected to the timer capture unit of the microcontroller.
[0033] The decision layer, running inside the microcontroller, includes: (1) a sampling module, used to implement ADC acquisition, executed in a timer interrupt, to acquire the pressure signal and the temperature signal through the ADC module, and to acquire the flow signal through the timer capture unit; (2) a cascaded digital filtering module, used to implement cascaded digital filtering, to perform median filtering and moving average filtering on the pressure signal; (3) a PID control module, used to implement PID calculation, to perform PID calculation with the filtered pressure signal as the main feedback quantity, and to output the speed correction quantity; (4) a FOC vector control module, used to implement FOC vector control to drive the brushless pump according to the speed correction quantity; (5) a multi-mode state machine module, used to implement mode switching to switch between multiple operating modes according to the flow signal and the temperature signal, wherein the operating mode is triggered by the temperature signal, the flow signal and a preset duration; (6) an interrupt controller, used to configure the timer interrupt of the FOC vector control as the first priority and the timer interrupt of the ADC acquisition as the second priority, wherein the first priority is higher than the second priority.
[0034] The execution layer includes a three-phase inverter bridge and a brushless pump, wherein the three-phase inverter bridge drives the brushless pump according to the speed correction amount.
[0035] In summary, the pressure sensor in the sensing layer is directly connected to the ADC module, the temperature sensor is connected to the ADC module through a voltage divider circuit, and the flow sensor is connected to the timer capture unit. All sensor signals are directly acquired, with no IIC communication delay, no dual-bus timing conflicts, and no risk of interruption-disabled operation.
[0036] Preferably, the system further includes a communication module for supporting data interaction with external devices and enabling the system to operate independently based on locally stored operating parameters when communication is interrupted. Protocol parsing and status reporting by the communication module are performed in low-priority tasks, without preempting interrupt resources for FOC vector control and ADC sampling. The system can operate independently without external instructions during communication interruptions and automatically reconnects after communication is restored, achieving dual-mode reliability of autonomous operation when offline and controllable operation when connected to the network.
[0037] In one specific implementation, the pressure sensor has a sampling rate of 1 kHz; the temperature sensor has a sampling rate of at least 10 Hz; the median filter has a window length of 15, which is a first window length covering the duration of pressure spikes; and the moving average filter has a window length of 16, which is a second window length to smooth residual noise. The sampling module acquires pressure data at a frequency of 1 kHz and triggers a PID calculation every 1 ms; the filtering module processes the pressure data using a cascaded combination of windows 15 and 16 to reduce pressure signal fluctuation amplitude and false trigger rate. The quantization parameters provide verifiable boundaries for the system at the implementation level.
[0038] The perception layer, decision layer, and execution layer form a closed-loop signal chain. The pressure sensor in the perception layer outputs an analog voltage signal, which is acquired by the ADC sampling module and processed by the cascaded digital filtering module in the decision layer. This signal then enters the PID control module to calculate the speed correction, and is converted into a PWM signal by the FOC vector control module to drive the three-phase inverter bridge and brushless pump in the execution layer. The flow sensor and temperature sensor output signals enter the multi-mode state machine module, which outputs mode switching commands to adjust the PID target value or the upper speed limit. The actual operating status (pressure, flow, temperature, speed) of the execution layer is fed back to the decision layer through the sensors in the perception layer, forming a complete closed loop. The interrupt management module ensures that the execution timing of each link in the above signal chain does not interfere with each other. Without the perception layer, the decision layer cannot obtain raw data; without the decision layer, the data from the perception layer cannot be processed and converted; without the execution layer, the commands from the decision layer cannot be executed. The three layers work together to achieve real-time closed-loop control and remote communication of the brushless pump in parallel operation within the same microcontroller.
[0039] Preferably, the operating modes include constant pressure mode, constant flow mode, energy-saving mode, sleep mode, and temperature drop mode; when initially set to constant flow mode, the constant flow mode is triggered, and the PID closed loop maintains a constant flow rate at the outlet of the brushless pump; when initially set to constant pressure mode, the PID closed loop maintains a constant pressure at the outlet of the brushless pump; when the flow signal is lower than a first flow threshold and the duration exceeds a first preset duration, the mode switches from constant pressure mode to energy-saving mode, controlling the brushless pump to reduce its speed to a first preset percentage of its rotational speed; when the flow signal is not lower than a second flow threshold... When the flow rate signal is zero for more than a second preset duration, the system switches from the energy-saving mode to the constant pressure mode, shutting down the motor drive. When the flow rate signal is not lower than the second flow rate threshold, the system switches from the sleep mode to the constant pressure mode. When the temperature signal exceeds the first temperature threshold, the system switches from the constant pressure mode to the temperature drop mode, controlling the brushless pump to reduce its speed to a second preset speed percentage. When the temperature signal drops below the second temperature threshold, the system switches from the temperature drop mode to the constant pressure mode. By quantifying the triggering conditions and control strategies of each mode into specific values, it is ensured that each mode is triggered under correct operating conditions and exits when the conditions are not met. In a specific embodiment, the first flow rate threshold is 0.1 L / min and the first preset duration is 5 seconds, the first preset speed percentage is 60% of the rated speed; the second flow rate threshold is 0.3 L / min; the second preset duration is 30 minutes; the first temperature threshold is 85°C, the second preset speed percentage is 70% of the rated speed, and the second temperature threshold is 65°C. The target values for constant pressure mode and constant current mode are different. The maximum value of the speed correction is limited in energy-saving mode and temperature drop mode. Therefore, switching modes can change the target value of the PID calculation or limit the upper limit of the PID output. The PID calculation outputs the speed correction based on the constraints of the current mode. The technical solution of this application will be further described below with reference to specific embodiments.
[0040] Example 1: A booster pump controller applied to a household RO reverse osmosis water purifier. The water purifier is installed under the kitchen sink and is powered by AC 220V / 50Hz mains power, which is converted to DC 24V via a built-in AC-DC power module to supply the motor drive and control circuit. Rated operating conditions are an outlet water pressure of 0.6MPa to 0.8MPa and a rated flow rate of 1.0L / min to 1.5L / min. The process flow is as follows... Figure 1 As shown. The microcontroller selected is STM32F405RGT6.
[0041] like Figure 2As shown, the system comprises a perception layer, a decision-making layer, and an execution layer. The pressure sensor is an analog output silicon piezoresistive pressure sensor, with its output signal directly connected to the microcontroller's ADC_IN0 pin. The temperature sensor uses an NTC thermistor and a precision resistor in series for voltage division, with the midpoint of the voltage divider connected to the ADC_IN1 pin. The flow sensor is a Hall effect pulse flow sensor, with its output signal connected to the timer TIM_CH1 capture input pin. The three-phase MOSFET inverter bridge uses a PWM carrier frequency of 16kHz and a dead time of 500ns.
[0042] The ADC samples pressure signals at 1 kHz and temperature signals at 10 Hz. Pressure values are written to a median filter loop buffer with a depth of 15. In the main loop, median filtering (taking the median of 15 samples) and a moving average filtering with a depth of 16 are performed. The filtered pressure values are used as feedback input for PID calculation. PID calculation is performed after each ADC sampling, outputting the rotational speed correction.
[0043] FOC vector control is executed during a 16kHz interrupt, driving the brushless pump according to the speed correction. For example... Figure 3 As shown, the multi-mode state machine switches modes in the main cycle based on flow and temperature signals: when the flow rate is below 0.1L / min for 5 seconds, it enters energy-saving mode, reducing the speed to 60% of the rated speed; when the flow rate is zero for more than 30 minutes, it enters sleep mode, shutting down the motor drive; when the temperature exceeds 85℃, it enters temperature-reducing mode, reducing the speed to 70% of the rated speed, and exits when the temperature drops below 65℃. The Wi-Fi module reports its status every 60 seconds using the MQTT protocol, performs network disconnection detection every 5 seconds, switches to local autonomous mode after 3 consecutive failures, and automatically reconnects and resends cached records after communication is restored.
[0044] In this embodiment, the simulated pressure sensor directly acquires data via ADC, with a measured sampling rate of 1kHz; after cascaded digital filtering, the peak-to-peak fluctuation of the pressure signal is reduced, and the false trigger rate is reduced; under PID control, the steady-state pressure error is within the measured range; the five modes switch normally, and the standby power consumption is reduced; the device continues to run when the network is interrupted, and the data is fully retransmitted after communication is restored.
[0045] Example 2: A water pump controller for a commercial coffee machine. Coffee machines operate continuously for long periods (8 to 12 hours daily), requiring high reliability and control precision. Rated operating conditions are an outlet water pressure of 0.8 MPa to 1.0 MPa and a rated flow rate of 0.8 L / min to 1.2 L / min. The difference between this example and Example 1 is that the communication method is changed from Wi-Fi to RS-485 bus (Modbus RTU protocol).
[0046] The method and process used in this embodiment are also as follows. Figure 1As shown in the diagram. The difference from Embodiment 1 is that the communication method is replaced with an RS-485 bus (Modbus RTU protocol). The communication module in the system architecture is replaced by an RS-485 transceiver instead of Wi-Fi. The RS-485 transceiver (MAX3485) is connected to the microcontroller via UART. The pressure sensor range is extended to 0 to 1.6 MPa. The target pressure is set to 0.9 MPa and sent from the coffee machine's main control board via Modbus RTU. The temperature threshold is adjusted to 70°C. The power-saving mode trigger delay is adjusted to 30 seconds, and the sleep mode trigger delay is adjusted to 10 minutes. The Modbus RTU slave address is 0x01, the communication parameters are 115200bps / 8 / N / 1, and it supports function codes 0x03 (read holding register) and 0x06 (write single holding register). This embodiment verifies the adaptability of the sensor interface scheme and control system of this application to the Modbus RTU industrial communication protocol. The analog pressure sensor operates stably and reliably at 1kHz sampling speed under commercial high-pressure conditions, with a slave station response time of less than 5ms.
[0047] Example 3 is applied to an intelligent water supply booster system in a small building. The system needs to simultaneously meet the water demand of multiple water points, with a large flow rate variation range (0.5L / min to 8L / min) and high pressure stability requirements (pressure fluctuation not exceeding ±5%). The difference between this example and Examples 1 and 2 is the addition of a feedforward control loop. The microcontroller is upgraded to an STM32F407ZET6. An inlet water pressure sensor (second ADC input) is added. When the inlet water pressure drops, the microcontroller pre-increases the speed setpoint before PID feedback adjustment, shortening the pressure recovery time from approximately 3 seconds in a pure PID scheme to approximately 0.8 seconds. It is equipped with an RS-485 bus (Modbus RTU protocol, connecting to the building automation system), and a Wi-Fi module is optional (for remote operation and maintenance). This example verifies the applicability of this application in intelligent water supply scenarios with large flow rate variations and high control accuracy requirements, as well as the scalability of the control algorithm and communication interface. ADC sampling is stable, PID plus feedforward control improves response speed, and Modbus RTU communication seamlessly integrates with the building automation system.
[0048] In the above three embodiments, the differences in parameters (sampling rate, communication protocol type, mode switching threshold) are adaptive adjustments made according to the working conditions of different application scenarios. They are all parameters that can be freely adjusted within the scope of protection of this application and do not change the core inventive concept of this application.
[0049] Based on the above technical solutions, this application achieves the following in the field of microcontroller-based brushless pump control: By managing and coordinating the execution timing of ADC sampling, cascaded digital filtering, PID calculation, mode switching, FOC vector control, and communication tasks within the same microcontroller using interrupt priority, the effective update frequency of the pressure feedback loop is ensured to be no less than 500Hz, and FOC vector control is unaffected by communication tasks. Through cascaded median filtering and moving average filtering, pressure signal fluctuations are reduced to less than 10% of their original magnitude, significantly reducing the false trigger rate. Intelligent switching between five operating modes reduces overall energy consumption by 10% to 20%. Through local parameter storage and an automatic switching mechanism for network outages, dual-mode reliability is achieved, ensuring no system crashes during network outages and controllable operation during network connectivity.
[0050] The above descriptions are merely embodiments of this application. Commonly known technical solutions or characteristics are not described in detail here. It should be noted that those skilled in the art can make various modifications and improvements without departing from the technical solution of this application. These modifications and improvements should also be considered within the scope of protection of this application, and will not affect the effectiveness of the application or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A microcontroller-based intelligent control method for a brushless pump, applied to a microcontroller, characterized in that, The microcontroller performs operations including ADC acquisition, cascaded digital filtering, PID calculation, FOC vector control, and communication tasks. The microcontroller integrates an interrupt controller, which configures the timer interrupt for FOC vector control as the first priority and the timer interrupt for ADC acquisition as the second priority, with the first priority being higher than the second priority. ADC Acquisition: Executed in a timer interrupt, the ADC module acquires the pressure signal output from the analog pressure sensor at a sampling rate of no less than 500Hz, the temperature signal output from the temperature sensor is acquired through the ADC module, and the flow signal output from the pulse flow sensor is acquired through the timer capture unit. The analog pressure sensor is installed at the outlet end of the brushless pump to measure the outlet pressure of the brushless pump as the main feedback quantity for PID closed-loop control. The temperature sensor is installed at the brushless pump or its drive circuit to measure the operating temperature of the brushless pump or its drive circuit for over-temperature protection. The pulse flow sensor is installed in the output pipeline of the brushless pump to measure the output flow of the brushless pump to identify the user's water usage status. Cascaded digital filtering: Cascaded digital filtering is performed on the pressure signal, which includes median filtering and moving average filtering; PID calculation: The pressure signal after cascaded digital filtering is used as the main feedback quantity for PID calculation, and the speed correction is output. Mode switching: Switching between multiple operating modes based on the temperature signal and the flow rate signal, wherein the operating mode is triggered by the temperature signal, the flow rate signal and a preset duration; FOC vector control: The brushless pump is driven according to the speed correction amount through FOC vector control; Communication task: Perform communication tasks with external devices.
2. The method according to claim 1, characterized in that, The sampling rate of the pressure signal is 1 kHz; the sampling rate of the temperature signal is not less than 10 kHz.
3. The method according to claim 1, characterized in that, The median filter has a window length that is a first window length that covers the duration of the pressure spike, and the moving average filter has a window length that is a second window length that smooths out the residual noise.
4. The method according to claim 1, characterized in that, The operating modes include constant pressure mode, constant current mode, energy saving mode, sleep mode, and temperature drop mode; When initially set to constant flow mode, the constant flow mode is triggered, and the PID closed loop maintains a constant flow rate at the outlet of the brushless pump. When initially set to constant pressure mode, the PID closed loop maintains a constant pressure at the outlet of the brushless pump; When the flow rate signal is lower than the first flow rate threshold and the duration exceeds the first preset duration, the constant pressure mode is switched to the energy-saving mode, and the brushless pump is controlled to reduce its speed to the first preset speed percentage; when the flow rate signal is not lower than the second flow rate threshold, the energy-saving mode is switched to the constant pressure mode. When the flow signal remains zero for more than a second preset duration, the system switches from the energy-saving mode to the sleep mode, shutting down the motor drive; when the flow signal is not lower than the second flow threshold, the system switches from the sleep mode to the constant pressure mode. When the temperature signal exceeds the first temperature threshold, the constant pressure mode is switched to the temperature drop mode, and the brushless pump is controlled to reduce its speed to a second preset speed percentage; when the temperature signal drops below the second temperature threshold, the temperature drop mode is switched back to the constant pressure mode.
5. The method according to claim 1, characterized in that, The communication tasks include RS-485 bus communication or Wi-Fi communication, and the microcontroller interacts with external devices through Modbus RTU protocol and / or MQTT protocol.
6. The method according to claim 1, characterized in that, The microcontroller stores local operating parameters, supports communication with external devices, and runs independently based on the stored local operating parameters when communication is interrupted.
7. The method according to claim 6, characterized in that, The method also includes, Communication interruption detection: The communication connection status is detected at a preset period. When the number of consecutive communication connection failures reaches the preset number, it is determined that the communication is interrupted. During the communication interruption, the microcontroller caches key event records. After the communication is restored, it automatically reconnects and resends the cached key event records.
8. A microcontroller-based intelligent control system for a brushless pump, characterized in that, A method for implementing any one of claims 1 to 7, comprising a perception layer, a decision layer, and an execution layer, wherein: The sensing layer includes an analog pressure sensor, a temperature sensor, and a pulsed flow sensor. The pressure sensor is located at the outlet of the brushless pump to measure the outlet pressure of the brushless pump as the main feedback quantity for PID closed-loop control, and is directly connected to the ADC module of the microcontroller. The temperature sensor is located at the brushless pump or drive circuit to measure the operating temperature of the brushless pump or drive circuit for over-temperature protection, and is connected to the ADC module of the microcontroller through a voltage divider circuit. The pulsed flow sensor is located at the output pipeline of the brushless pump to measure the output flow of the brushless pump to identify the user's water usage status, and is connected to the timer capture unit of the microcontroller. The execution layer includes a three-phase inverter bridge and a brushless pump, wherein the three-phase inverter bridge drives the brushless pump according to the speed correction amount; The decision-making layer, running inside the microcontroller, includes: The sampling module is used to perform ADC acquisition, which is executed in a timer interrupt. It acquires the pressure signal and the temperature signal through the ADC module, and acquires the flow signal through the timer capture unit. A cascaded digital filtering module is used to perform cascaded digital filtering, applying median filtering and moving average filtering to the pressure signal. The PID control module is used to perform PID calculations, using the filtered pressure signal as the main feedback quantity for PID calculations, and outputs the speed correction quantity. The FOC vector control module is used to implement FOC vector control to drive the brushless pump according to the speed correction amount. A multi-mode state machine module is used to implement mode switching and switch between multiple operating modes based on the flow rate signal and the temperature signal. The operating mode is triggered by the temperature signal, the flow rate signal and a preset duration. An interrupt controller is configured to set the timing interrupt of the FOC vector control to a first priority and the timing interrupt of the ADC acquisition to a second priority, wherein the first priority is higher than the second priority.
9. The system according to claim 8, characterized in that, The system also includes a communication module for supporting data interaction with external devices and enabling the system to operate independently based on locally stored operating parameters when communication is interrupted.
10. The system according to claim 8, characterized in that, The sampling rate of the pressure sensor is 1 kHz; the sampling rate of the temperature sensor is not less than 10 kHz; the window length of the median filter is the first window length covering the duration of the pressure spike, and the window length of the moving average filter is the second window length to smooth the residual noise.