Cascade PID (Proportion Integration Differentiation)-based double-wheel balance car system
Through the combination of cascade PID control algorithm and high-precision sensors, the power module design is optimized, and the high accuracy and stability of the dual-wheel balancing vehicle system is achieved, solving the lack of performance of the existing system under complex tasks, and improving anti-interference ability and response speed.
Patent Information
- Application Number
- CN202510570161.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-15
AI Technical Summary
The existing two-wheeled balance bike system has shortcomings in control architecture, hardware design, sensor accuracy, real-timeness, and system stability, resulting in poor performance under complex tasks or harsh conditions.
The cascade PID control algorithm is adopted, combined with the speed closed-loop control module and the upright angle closed-loop control module, and high-precision sensors such as MPU6050 and Hall encoder are used to design a reasonable power module to improve system stability and anti-interference ability. The sensor data is processed through a first-order complementary filtering algorithm, and the motor drive module is optimized to achieve precise control.
Improves the control accuracy, stability and anti-interference ability of the system, ensuring balance and rapid response in complex environments.
Smart Images

Figure CN120491679A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a two-wheeled balancing vehicle system based on cascade PID, and belongs to the field of robot control. Background Art
[0002] Two-wheeled self-balancing scooters are widely used in various fields of production and life. For example, in warehouse robotics, their high maneuverability and compact structure enable them to maneuver flexibly in confined spaces. In education, their simple mechanical structure and rich control problems make them a classic experimental platform for learning control theory. As a typical underactuated, nonlinear system, the two-wheeled self-balancing scooter has important research value in the field of robotic intelligent control. Its core control algorithms involve posture perception, motion control, and stability maintenance, making it an ideal platform for verifying various control strategies (such as PID control, fuzzy control, adaptive control, and reinforcement learning). Therefore, building a high-performance, low-cost two-wheeled self-balancing scooter system will help promote the development of robotic intelligent control technology.
[0003] The operating principle of a two-wheeled self-balancing vehicle is similar to that of an inverted pendulum system, characterized by strong nonlinearity, strong coupling, and instability. To maintain the vehicle's upright position and motion control, the system must collect real-time information about the vehicle's posture (such as tilt angle and angular velocity) and motor motion (such as speed and displacement). This system then uses a control algorithm to adjust the motor driver module's output in real time. This places high demands on the hardware platform's real-time performance, sensor accuracy, and robustness of the control algorithm. Existing two-wheeled self-balancing vehicle systems typically consist of a power module, two wheels, a motor driver module, posture sensors, encoders, and an MCU controller. These are controlled by closed-loop control modules for both upright angle and speed. Common two-wheeled self-balancing vehicle systems utilize real-time feedback control, using posture sensors and encoders to detect the vehicle's posture and velocity, and then driving the motors to maintain dynamic balance. The system uses gyroscopes and accelerometers to measure the vehicle's pitch angle and angular velocity, combined with encoders to obtain wheel speed.
[0004] Then, a parallel PID control strategy is adopted. The upright angle closed-loop control module quickly corrects the tilt through PD control to make the vehicle body tend to be vertical, while the speed closed-loop control module converts the error between the target speed and the actual speed into a compensation amount based on encoder feedback through PI control to avoid continuous acceleration and form a closed-loop system.
[0005] However, the existing two-wheeled balancing vehicle system still has many deficiencies in terms of control architecture, hardware design, sensor accuracy, real-time performance, and system stability. For example: (1) The stability of the parallel architecture is low: the traditional parallel PID control architecture has a simple and direct control algorithm structure, and the system is easy to implement. However, under this architecture, when the system suddenly changes, continuous oscillation will occur, which significantly reduces the control stability. Therefore, the general parallel architecture PID control has problems such as dynamic coupling interference and weak anti-interference ability. (2) Sensor algorithm defects lead to limited control performance: Many existing solutions use low-cost accelerometers and gyroscope modules, but do not perform effective sensor data fusion. They only rely on the raw data of the sensor without combining Kalman filtering or complementary filtering, resulting in large drift errors in attitude estimation. (3) The power module design is unreasonable, affecting stability: the linear regulated power supply is used, which has low efficiency and serious heat generation. The endurance is poor in battery-powered scenarios, and the voltage fluctuation problem when the motor starts and stops is not considered, which may cause abnormal sensor data.
[0006] The existing simple two-wheeled balancing vehicle system cannot perform well when handling complex tasks or under harsh working conditions. Therefore, it is of great significance to propose a two-wheeled balancing vehicle system that can optimize real-time control accuracy, power efficiency and overall algorithm control architecture. Summary of the Invention
[0007] In order to overcome the above-mentioned disadvantages and design a two-wheeled balancing vehicle system with better performance in all aspects, the present invention proposes a two-wheeled balancing vehicle system based on cascade PID.
[0008] The technical solution adopted in the present invention is as follows:
[0009] The two-wheeled balancing vehicle system based on cascade PID includes a power module, a two-wheeled vehicle body, a motor drive module, a posture sensor, an encoder and an MCU controller in terms of system composition, wherein the power module supplies power to the entire system to ensure the stable operation of the two-wheeled vehicle body, the two-wheeled vehicle body is composed of a body frame and a motor, the motor drive module controls the motor to realize the rotation of the two-wheeled vehicle body, the posture sensor and the encoder respectively collect the angle and speed information of the two-wheeled vehicle body, the MCU controller integrates the angle and speed information, and runs the cascade PID control algorithm to realize the operation of the two-wheeled vehicle body: the system architecture design adopts a speed closed-loop control module and an upright angle closed-loop control module in cascade to form a dual closed-loop feedback loop, which can achieve real-time and precise control of the speed and angle of the two-wheeled balancing vehicle system; in terms of control algorithm, it is characterized by using a cascade PID control algorithm and adopting first-order complementary to reduce errors.
[0010] Furthermore, the components of the two-wheeled balancing vehicle system based on cascade PID are characterized by:
[0011] (1) Power module: Use a power module circuit based on the FP6296XR-G1 DC-DC buck converter and add a Schottky diode to the input network to prevent reverse input voltage. Design a feedback network to accurately adjust the output voltage and optimize loop stability. Add an output filter capacitor to the output part to smooth the output DC voltage and reduce ripple.
[0012] (2) Two-wheeled vehicle body: mainly composed of a vehicle frame and a motor. In terms of center of gravity design, the modules are concentrated in the lower middle part of the vehicle body to lower the center of gravity and enhance stability. The motor and wheels are located on both sides of the bottom to provide power and support, and ensure the response speed and stability of the vehicle during dynamic balance.
[0013] (3) Motor drive module: A motor drive module based on TB6612FNG is used to control the dual motors using PWM signals to achieve precise control of the vehicle's movement.
[0014] (4) Posture sensor: The MPU6050 sensor is used to measure the acceleration and angular velocity of the two-wheeled vehicle body in three directions using its accelerometer and gyroscope;
[0015] (5) Encoder: Use Hall encoder to provide wheel speed and position information;
[0016] (6) MCU controller: Integrates and processes the angle information obtained by the posture sensor and the speed information obtained by the encoder, runs the cascade PID control algorithm, and outputs control information to the motor drive module to realize the operation control of the two-wheeled vehicle body.
[0017] Furthermore, the system architecture of the two-wheeled balancing vehicle system based on cascade PID is as follows:
[0018] The speed closed-loop control module is used as the front-end control and is implemented using PI control. The specific steps are as follows:
[0019] (1) Use the encoder to detect the real-time speed of the motor, output two pulse signals A and B to determine the direction of rotation, and return the information to the MCU controller;
[0020] (2) Compare the actual speed value with the target speed value in real time;
[0021] (3) The PI control program corrects the speed value according to the received real-time speed value and the set target speed, and outputs the corrected control signal to the subsequent upright angle closed-loop control module;
[0022] The upright angle closed-loop control module is implemented using PD control. The posture angle is corrected based on the output value of the previous speed closed-loop control module and the return value of the posture sensor. The specific steps are as follows:
[0023] (1) The posture sensors installed on the two-wheeled vehicle body integrate the measured acceleration and angular velocity and output the return value;
[0024] (2) The PD control program combines the output value of the speed closed-loop control module, processes the return value of the posture sensor through a first-order complementary filter, performs angle correction, and outputs it;
[0025] (3) The above output values are output to the motor drive module to adjust the speed and posture angle of the two-wheeled balancing vehicle system.
[0026] Furthermore, the control algorithm of the two-wheeled balancing vehicle system based on cascade PID is:
[0027] (1) Using cascade PID control algorithm, cascade processing speed and angle information, improve the system dynamic performance and anti-interference ability;
[0028] (2) Use the first-order complementary filtering algorithm to process the angle information of the posture sensor.
[0029] Furthermore, the control algorithm of the two-wheeled balancing vehicle system based on cascade PID also includes adding a low-pass filter after the accelerometer to filter out high-frequency noise, adding a high-pass filter after the gyroscope integration process to filter out low-frequency noise, and finally adding the two processed parts and inputting them into the upright angle closed-loop control module.
[0030] Furthermore, in the two-wheeled balancing vehicle system based on cascade PID, the MCU controller can be implemented using an STM32 series single-chip microcomputer.
[0031] The present invention is based on a cascade PID control architecture, which has breakthrough advantages such as high control accuracy, high stability and strong anti-interference ability compared to the traditional parallel structure. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Attachment Figure 1 Provides a description of the system design.
[0033] Attachment Figure 2 The test results of the attitude angle balance of the two-wheeled balancing vehicle control system based on cascade PID DETAILED DESCRIPTION
[0034] The present invention proposes a two-wheeled balancing vehicle system based on cascade PID, which includes three parts: system composition, system architecture, and control algorithm.
[0035] 1. The system is mainly divided into the following parts:
[0036] (1) Power module:
[0037] The proposed cascade PID-based two-wheeled balancing vehicle system uses a 12V lithium battery for power. Because different modules require different power voltages, two power supplies are required to power the entire system: a 3.3V MCU controller and a 6V main power supply for the motor drive module and encoder.
[0038] 3.3V is generated using the AMS1117-3.3 linear regulator. The AMS1117-3.3 takes a +6V input voltage and converts it to a stable +3.3V output through internal regulation. The output is filtered by a capacitor to ensure a stable output voltage.
[0039] How to generate 6V: The circuit uses the FP6296XR-G1 switching regulator, a voltage converter. After voltage conversion, the input voltage is converted into a stable +6V output. The output is filtered to ensure a stable output voltage. Finally, two LED indicators are added to indicate the normal +3.3V output and +6V output, respectively.
[0040] A TP4056-based lithium battery charging circuit was also added. A resistor was added to the input for current limiting protection, and a filter capacitor was added to reduce power supply noise. The charging control circuit uses the TP4056 chip for charging logic control, and finally, an LED indicator was added to display the status: a red LED indicates charging, and a green LED indicates charging is complete.
[0041] (2) Two-wheeled vehicle body:
[0042] The compact design primarily consists of a chassis and motor. The chassis measures approximately 14.5 cm wide and 6.7 cm high, with a wheelbase of approximately 12 cm. The center of gravity design concentrates the weight of the battery, main control board, and sensors in the lower middle of the chassis to lower the center of gravity. The motors and wheels are located on either side of the chassis, providing power and support, and ensuring the responsiveness and stability of the two-wheeled balancing vehicle during dynamic balancing.
[0043] (3) Motor drive module:
[0044] The motor driver module uses the TB6612FNG motor driver chip. The MCU controller controls the motor through the motor driver chip. The motor drive voltage is 12V. The peripheral correspondence between the TB6612FNG and the MCU controller STM32F103C8T6 is as follows:
[0045] PWMA:C8T6-PA8
[0046] AIN1:C8T6-PB14
[0047] AIN2:C8T6-PB15
[0048] PWMB:C8T6-PA11
[0049] BIN3:C8T6-PB13
[0050] BIN2: C8T6-PB12
[0051] The PWM signals PWMB and PWMA are used as PWM control signals for the left and right motor rotation speeds transmitted by the MCU controller. BIN1 and BIN2, and AIN1 and AIN2 control the forward and reverse rotation of the left and right wheels of the two-wheeled balancing vehicle system, respectively.
[0052] Let's take the left wheel drive as an example for a specific explanation: PA11 is channel 1 of the timer TIM1 of the STM32F103C8T6 MCU controller, and outputs PWMB to drive the left wheel motor, corresponding to BIN1 and BIN2. The corresponding rules for the values of BIN1 and BIN2 and the direction of the motor are as follows:
[0053] Rule 1: Motor stopped - BIN1 = 0, BIN2 = 0
[0054] Rule 2: Motor forward rotation - BIN1 = 1, BIN2 = 0
[0055] Rule 3: Motor reverse direction - BIN1 = 0, BIN2 = 1
[0056] Rule 4: Motor stopped - BIN1 = 1, BIN2 = 1
[0057] The same applies to PWMA. In addition, since driving the motor requires PWM input, the output of motor lines AO1 and AO2 is required.
[0058] (4) Posture sensor:
[0059] The posture sensor uses the MPU6050 sensor. The MPU6050 has a built-in ADC that converts analog posture signals directly into digital values by simply reading the corresponding registers. The MPU6050 posture sensor offers different ranges: the gyroscope range is from ±250° to ±2000°, and the accelerometer range is from ±2g to ±16g, meeting most use cases. In actual implementation, the gyroscope range is set to ±2000°, and the accelerometer range is set to ±2g.
[0060] The MPU6050 posture sensor uses IIC for communication. The SDA and SCL interfaces need to be pulled up to VCC using pull-up resistors. The IIC communication protocol is driven by software simulation.
[0061] (5) Encoder:
[0062] The encoder is implemented using Hall effect sensors. The proposed cascade PID-based two-wheeled balancing vehicle system uses two pulse signals, A and B, to determine the steering direction. The right wheel corresponds to channels 2 and 1 of timer TIM4 on the STM32F103C8T6 MCU controller; the left wheel's A and B signals correspond to channels 1 and 2 of timer TIM3 on the core STM32F103C8T6 MCU control circuit, respectively.
[0063] Now let’s explain how to measure the motor speed in conjunction with the motor drive module.
[0064] The motor is integrated with a Hall sensor, which can obtain the specific motor speed based on the pulse count. When implementing motor drive, the speed is calculated by measuring the number of output pulses of the encoder, and the output pulse frequency f of the encoder is obtained by dividing the measured number by the running time.
[0065] Assume that the motor generates k pulses per revolution
[0066] k=4×N×ρ(1)
[0067] Here N is the encoder line count, and ρ is the motor reduction ratio. The final speed is (unit: revolutions per minute).
[0068]
[0069] (6) MCU controller:
[0070] The MCU controller uses an STM32F103C8T6, which processes sensor data and runs the PID control algorithm. It combines angle information obtained by the MPU6050 position sensor with speed information from the encoder to control the motor drive module through a timer output of a specific PWM signal. During operation, it uses an 8MHz passive internal crystal oscillator, multiplied to 72MHz.
[0071] 2. System Architecture:
[0072] In terms of the overall control system architecture design, a two-wheeled balancing vehicle system based on cascade PID adopts a dual closed-loop feedback loop consisting of a speed closed-loop control module and an upright angle closed-loop control module. The speed closed-loop control module and the upright angle closed-loop control module adopt PI control and PD control, respectively. The speed closed-loop control module measures the motor speed and direction in real time through a Hall encoder and outputs two pulse signals, A and B. The STM32's timers TIM3 and TIM4 capture the A and B two-phase pulses to calculate the speed and direction. The MCU controller compares the measured speed with the target speed and outputs a PWM speed control signal to the subsequent upright angle closed-loop control module. The upright angle closed-loop control module obtains three-axis acceleration and angular velocity data from the posture sensor MPU6050. After integration processing, the two are fused through a first-order complementary filter to obtain the inclination angle value of the two-wheeled vehicle body. The PD control module combines this with the output value of the preceding speed closed-loop control module and adjusts the speed and posture angle. Finally, the integrated control signal is output to the motor drive module to achieve speed regulation and posture stabilization of the two-wheeled balancing vehicle system. The control equation of the system is as follows:
[0073] Speed closed-loop control module:
[0074] θ1=K p1 *e(k)+K i *∑e k (3)
[0075] Standing angle closed-loop control module:
[0076] α=K p2 *(θ-θ1)+K d *θ′ (4)
[0077] After combining:
[0078] α=K p2 *[θ-(K p1 *e(k)+K i *∑e k )]+K d *θ′ (5)
[0079] Here θ1 is the output of the speed closed-loop control module (as the setpoint offset of the angle closed-loop control module), K p1 is the proportional gain coefficient of the speed closed-loop control module, e(k) is the speed error at the current moment, K i is the integral gain coefficient of the speed closed-loop control module, e k is the difference between the target speed in the speed control loop and the actual measured current speed, ∑e k is the discrete integral of the difference; α is the output of the upright angle closed-loop control module (the control signal sent to the motor), K p2is the proportional gain coefficient of the upright angle closed-loop control module, K d is the differential gain coefficient of the upright angle closed-loop control module, θ is the currently measured vehicle body inclination angle (from the MPU6050 sensor), and θ′ is the rate of change of the two-wheel vehicle body inclination angle (obtained by the gyroscope through angle difference).
[0080] A two-wheeled balancing vehicle system based on cascade PID is designed, and its kinematic model is:
[0081]
[0082]
[0083] In the above formula, 2L represents the distance between the wheels of the two-wheeled vehicle body, and v R 、v L Represent the speed of the right and left wheels respectively, is the linear velocity of the two-wheeled balancing vehicle system, ω is the angular velocity of the motion, is the orientation angle of the two-wheeled balancing vehicle system, and R is the turning radius.
[0084] 3. Control algorithm:
[0085] The control algorithms designed for the two-way balancing vehicle system are a cascade control algorithm and a first-order complementary filter algorithm. The cascade control algorithm processes speed and angle information in a cascade manner to improve the system's dynamic performance and anti-interference capabilities, while the first-order complementary filter algorithm processes angle information to filter out noise and improve stability.
[0086] (1) Cascade PID control algorithm: The speed closed-loop control module (PI) and the vertical angle closed-loop control module (PD) are connected in cascade. The output of the PI control module is connected to the input of the PD control module. The output of the PD control module is finally transmitted to the motor drive module to achieve precise control. The PI control module is responsible for eliminating the speed steady-state error, and the PD control module is responsible for suppressing the angle fluctuation. The two work in cascade to ensure the dynamic response and stability of the system. The continuous form of the principle formula is as follows:
[0087]
[0088] The combined form is:
[0089]
[0090] In formula (10), e(t) is the velocity error at the current moment, K p1 is the proportional gain coefficient of the speed closed-loop control module, K i is the integral gain coefficient of the speed closed-loop control module, is the integral of the velocity difference; in formula (11), e(t) is the error of the vehicle posture angle, is the rate of change of the vehicle posture angle, K p2 is the proportional gain coefficient of the upright angle closed-loop control module, K d is the differential gain coefficient for the upright angle closed-loop control module. Its discrete form is given in the system architecture section, and its code implementation is completed in the MCU controller.
[0091] (2) First-order complementary algorithm:
[0092] The first-order complementary filtering algorithm fuses the measurements from the MPU6050 posture sensor to accurately estimate the attitude angle of the two-wheeled balancing vehicle system. The MPU6050 contains an accelerometer and a gyroscope. The accelerometer calculates the inclination angle by measuring the three-axis gravity component, but is susceptible to high-frequency vibration noise. The gyroscope obtains the angle change by integrating the angular velocity, but is subject to integral drift (low-frequency error). The complementary filter combines the two, low-pass filtering the accelerometer data to remove high-frequency noise and high-pass filtering the gyroscope's integrated angle to suppress low-frequency drift. Finally, the two components are weighted and summed to output a stable angle estimate. The algorithm can be expressed as:
[0093]
[0094] Here δ is the angle estimate, α is the weight coefficient, and θ is the accelerometer angle. is the angle at the previous moment, is the gyroscope angular velocity, where the value of α determines the filtering characteristics. A smaller α trusts the gyroscope dynamic response more, while a larger α depends on the long-term stability of the accelerometer.
[0095] In order to verify the control effect of the two-wheeled balancing vehicle system based on cascade PID proposed in the invention, its control effect was tested.
[0096] The test target is the posture angle of the two-wheeled balancing vehicle system. The test method is as follows: after starting the system, use the XCOM serial communication tool to receive the posture angle change data of the two-wheeled balancing vehicle system, test two situations of flat ground start and stop and manual interference, record and draw the posture angle change curve of the two-wheeled balancing vehicle system, and the system sampling frequency is 100Hz.
[0097] The test results are as attached Figure 2 As shown in the test results, the two-wheeled balancing vehicle system based on cascade PID proposed in the invention can quickly enter the equilibrium state about 0-5 seconds after starting (the starting process corresponds to the attached Figure 2The vehicle can maintain stability when stationary or moving slowly, and will not lose control due to sensor noise or drift. In addition, after the interference is added at time t=9s, the vehicle will recover balance in about 4.50s (the recovery process corresponds to the additional Figure 2 The sampling points are 900-1350. When subjected to external vibrations or shocks, the two-wheeled balancing vehicle system can quickly respond and return to a balanced state. Test results demonstrate that the proposed two-wheeled balancing vehicle system based on cascade PID has the characteristics of high control accuracy, high stability, and strong anti-interference ability.
[0098] It should be noted that the above embodiments are not intended to limit the scope of protection of the present invention, and equivalent changes or replacements made on the basis of the above technical solutions fall within the scope of protection of the claims of the present invention.
Claims
1. A two-wheeled balancing vehicle system based on cascade PID, characterized in that: The system consists of a power module, a two-wheeled vehicle body, a motor drive module, a posture sensor, an encoder and an MCU controller. The power module supplies power to the entire system to ensure the stable operation of the two-wheeled vehicle body. The two-wheeled vehicle body consists of a body frame and a motor. The motor drive module controls the motor to realize the rotation of the two-wheeled vehicle body. The posture sensor and the encoder respectively collect the angle and speed information of the two-wheeled vehicle body. The MCU controller integrates the angle and speed information and runs the cascade PID control algorithm to realize the operation of the two-wheeled vehicle body. The system architecture design adopts a speed closed-loop control module and an upright angle closed-loop control module in cascade to form a dual closed-loop feedback loop, which can achieve real-time and precise control of the speed and angle of the two-wheeled balancing vehicle system. In terms of control algorithm, it is characterized by the use of a cascade PID control algorithm and the use of first-order complementary control to reduce errors.
2. According to the two-wheeled balancing vehicle system based on cascade PID as described in claim 1, the characteristics of each component are as follows: (1) Power module: Use a power module circuit based on the FP6296XR-G1 DC-DC buck converter and add a Schottky diode to the input network to prevent reverse input voltage. Design a feedback network to accurately adjust the output voltage and optimize loop stability. Add an output filter capacitor to the output part to smooth the output DC voltage and reduce ripple. (2) Two-wheeled vehicle body: mainly composed of a vehicle frame and a motor. In terms of center of gravity design, the modules are concentrated in the lower middle part of the vehicle body to lower the center of gravity and enhance stability. The motor and wheels are located on both sides of the bottom to provide power and support, and ensure the response speed and stability of the vehicle during dynamic balance. (3) Motor drive module: A motor drive module based on TB6612FNG is used to control the dual motors using PWM signals to achieve precise control of the vehicle's movement. (4) Posture sensor: The MPU6050 sensor is used to measure the acceleration and angular velocity of the two-wheeled vehicle body in three directions using its accelerometer and gyroscope; (5) Encoder: Use Hall encoder to provide wheel speed and position information; (6) MCU controller: Integrates and processes the angle information obtained by the posture sensor and the speed information obtained by the encoder, runs the cascade PID control algorithm, and outputs control information to the motor drive module to realize the operation control of the two-wheeled vehicle body.
3. The two-wheeled balancing vehicle system based on cascade PID according to claim 1, wherein the system architecture is characterized by: The speed closed-loop control module is used as the front-end control and is implemented using PI control. The specific steps are as follows: (1) Use the encoder to detect the real-time speed of the motor, output two pulse signals A and B to determine the direction of rotation, and return the information to the MCU controller; (2) Compare the actual speed value with the target speed value in real time; (3) The PI control program corrects the speed value according to the received real-time speed value and the set target speed, and outputs the corrected control signal to the subsequent upright angle closed-loop control module; The upright angle closed-loop control module is implemented using PD control. The posture angle is corrected based on the output value of the previous speed closed-loop control module and the return value of the posture sensor. The specific steps are as follows: (1) The posture sensors installed on the two-wheeled vehicle body integrate the measured acceleration and angular velocity and output the return value; (2) The PD control program combines the output value of the speed closed-loop control module, processes the return value of the posture sensor through a first-order complementary filter, performs angle correction, and outputs it; (3) The above output values are output to the motor drive module to adjust the speed and posture angle of the two-wheeled balancing vehicle system.
4. According to the two-wheeled balancing vehicle system based on cascade PID as described in claim 1, the control algorithm is characterized by: (1) Using cascade PID control algorithm, cascade processing speed and angle information, improve the system dynamic performance and anti-interference ability; (2) Use the first-order complementary filtering algorithm to process the angle information of the posture sensor.
5. A two-wheeled balancing vehicle system based on cascade PID according to claim 1, characterized in that: The control algorithm also includes adding a low-pass filter after the accelerometer to filter out high-frequency noise, adding a high-pass filter after the gyroscope integration process to filter out low-frequency noise, and finally adding the two processed parts and inputting them into the upright angle closed-loop control module.
6. A two-wheeled balancing vehicle system based on cascade PID according to claim 1, characterized in that: The MCU controller can be implemented using a single-chip microcomputer of the STM32 series.
Citation Information
Cited By
Motor driving direction correction method and device based on encoder feedback
CN120963399A
Motor driving direction correction method and device based on encoder feedback
CN120963399B