CN116069019A - Control system of multifunctional intelligent balance trolley and fuzzy self-adaptive PID method thereof - Google Patents
Control system of multifunctional intelligent balance trolley and fuzzy self-adaptive PID method thereof Download PDFInfo
- Publication number
- CN116069019A CN116069019A CN202211571201.8A CN202211571201A CN116069019A CN 116069019 A CN116069019 A CN 116069019A CN 202211571201 A CN202211571201 A CN 202211571201A CN 116069019 A CN116069019 A CN 116069019A
- Authority
- CN
- China
- Prior art keywords
- trolley
- control
- module
- pid
- speed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000001514 detection method Methods 0.000 claims abstract description 19
- 238000005259 measurement Methods 0.000 claims abstract description 7
- 230000008569 process Effects 0.000 claims description 15
- 230000001133 acceleration Effects 0.000 claims description 12
- 230000008859 change Effects 0.000 claims description 11
- 230000000694 effects Effects 0.000 claims description 10
- 230000006870 function Effects 0.000 claims description 9
- 238000013139 quantization Methods 0.000 claims description 8
- 230000035508 accumulation Effects 0.000 claims description 6
- 238000009825 accumulation Methods 0.000 claims description 6
- 238000006243 chemical reaction Methods 0.000 claims description 6
- 230000005484 gravity Effects 0.000 claims description 6
- 230000033001 locomotion Effects 0.000 claims description 6
- 238000004891 communication Methods 0.000 claims description 5
- 238000012545 processing Methods 0.000 claims description 5
- 230000005540 biological transmission Effects 0.000 claims description 4
- 230000009467 reduction Effects 0.000 claims description 4
- 238000006073 displacement reaction Methods 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 claims description 3
- 238000001914 filtration Methods 0.000 claims description 3
- 238000005192 partition Methods 0.000 claims description 3
- 230000002093 peripheral effect Effects 0.000 claims description 3
- 230000002441 reversible effect Effects 0.000 claims description 3
- 230000004069 differentiation Effects 0.000 claims description 2
- 230000010354 integration Effects 0.000 claims description 2
- 230000007547 defect Effects 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 19
- 230000004044 response Effects 0.000 description 11
- 230000033228 biological regulation Effects 0.000 description 5
- 230000008901 benefit Effects 0.000 description 3
- 230000009699 differential effect Effects 0.000 description 3
- 230000005764 inhibitory process Effects 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000010355 oscillation Effects 0.000 description 1
- 230000002035 prolonged effect Effects 0.000 description 1
- 238000011002 quantification Methods 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
- 230000000087 stabilizing effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0255—Control of position or course in two dimensions specially adapted to land vehicles using acoustic signals, e.g. ultra-sonic singals
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0212—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory
- G05D1/0214—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory in accordance with safety or protection criteria, e.g. avoiding hazardous areas
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0212—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory
- G05D1/0221—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory involving a learning process
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/02—Control of position or course in two dimensions
- G05D1/021—Control of position or course in two dimensions specially adapted to land vehicles
- G05D1/0212—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory
- G05D1/0223—Control of position or course in two dimensions specially adapted to land vehicles with means for defining a desired trajectory involving speed control of the vehicle
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/60—Other road transportation technologies with climate change mitigation effect
- Y02T10/72—Electric energy management in electromobility
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Aviation & Aerospace Engineering (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Acoustics & Sound (AREA)
- Control Of Position, Course, Altitude, Or Attitude Of Moving Bodies (AREA)
Abstract
The invention relates to the technical field of two-wheeled balance trolleys and discloses a control system of a multifunctional intelligent balance trolley, wherein a motor driving module drives a motor to normally operate, a gesture detection module mainly detects the inclination of a trolley body, a Hall sensor module detects the operation speed of the motor through an encoder, a Bluetooth module remotely controls the front, rear, left and right operation of the trolley, and an ultrasonic module mainly achieves the distance measurement obstacle avoidance function of the trolley. The control system of the multifunctional intelligent balance trolley and the fuzzy self-adaptive PID method thereof can realize the traditional PID control of the balance trolley, but parameters Kp, ki and Kd of the PID are manually debugged to find out the value of an optimal system, the fuzzy PID control optimizes each parameter of the PID by utilizing a fuzzy logic rule according to the input condition, overcomes the defect that the traditional PID parameter cannot adjust the PID parameter in real time, and optimizes the output of the system.
Description
Technical Field
The invention relates to the technical field of two-wheel balance trolleys, in particular to a control system of a multifunctional intelligent balance trolley and a fuzzy self-adaptive PID method thereof.
Background
With the rapid development of electronic technology and intelligent machines, the intelligent machines play an irreplaceable role in the whole human production process, the intelligent machine vehicle is mature day by day, great convenience is brought to people's life, and meanwhile, the intelligent machine vehicle plays an important role in industrial mass production, the subject is to research on wheel-type balance car intelligent machine vehicles, research hotspots of two-wheel balance cars are continuously improved, the two-wheel self-balance car is similar to an inverted pendulum structure, the vehicle is popular in young people at present, the vehicle is integrally moved forward and backward by virtue of two wheels to keep the vertical balance state of the vehicle body, the operation is simple, the vehicle body is small and portable, the vehicle body can pass through a relatively narrow road and relatively crowded traffic road, the vehicle has strong adaptability to complex road sections, in addition, the vehicle can also be controlled by wireless remote control technology, the military environment operation can be performed, the future field is realized, and the future hotel service project is widely used in multiple occasions.
The whole system of the balance trolley control comprises multipath check signal feedback, the feedback signal is integrated and processed, and then the control measures are carried out, so that a closed loop control system is formed, the balance trolley control system has the advantages of strong stability, smaller balance trolley body size, light weight and the like, but the PID control is carried out, kp, ki and Kd parameters in the PID are fixed parameters which are already set before the production, and if the structure is changed or under the severe condition, the fixed parameters may lose the stable control effect or even be not matched, so that improvement is needed.
Disclosure of Invention
(one) solving the technical problems
Aiming at the defects of the prior art, the control system of the multifunctional intelligent balance trolley and the fuzzy self-adaptive PID method thereof provided by the invention have the advantages of adding fuzzy PID control and automatically adjusting Kp, ki and Kd parameters in PID according to specific conditions in real time, so that the adaptability of the whole system is greatly enhanced, the stability is improved, the safety is ensured and the like, and the problem that the set of fixed parameters may lose stable control effect or even be not matched once the structure is changed or under severe conditions is solved.
(II) technical scheme
In order to realize the fuzzy PID control, the Kp, ki and Kd parameters in the PID are automatically adjusted in real time according to specific conditions, so that the adaptability of the whole system is greatly enhanced, the stability is improved, and the safety is ensured, the invention provides the following technical scheme: the control system of the multifunctional intelligent balance trolley comprises a trolley model, an STM32 minimum system, a motor driving module, a Hall sensor module, a gesture detection module, a Bluetooth module, a power supply module, an ultrasonic module and an OLED display screen; the motor driving module drives the motor to normally run, the gesture detection module mainly detects the inclination of the car body, the Hall sensor module detects the running speed of the motor through the encoder, the Bluetooth module remotely controls the front, back, left and right running of the trolley, and the ultrasonic module mainly achieves the ranging obstacle avoidance function of the trolley.
Preferably, the STM32 minimum system comprises a CPU with the model number STM32F103C8T6, when the vehicle body is inclined, the gesture detection module detects that the vehicle body is inclined, the master controller receives a signal with the inclination angle, and outputs PWM to the motor drive to control the corresponding operation of the motor after processing by the PID algorithm, namely, outputs a control signal to control the trolley to drive in the same direction of inclination, and continuously detects the signal of the inclination angle to control the movement direction of the trolley to achieve a balance state;
the STM32 minimum system comprises a core board with the model of CORTEX-M3, a CPU with the model of STM32F103C8T6 is placed on the core board, the core board with the model of CORTEX-M3 has smaller volume, the highest working frequency of 72MHz and 48 pins, three general timers and one advanced timer are arranged in the core board, and the core board is provided with 3 serial ports, two IIC/SPI outputs and a UART peripheral device port.
Preferably, the power supply voltage of the motor driving module is 12V, the chip selects a chip TB6612FNG, the chip outputs continuous driving current of 1A at the highest per channel, the peak current is started to 2A/3A (continuous pulse/single pulse), and 4 motor control modes are as follows: forward rotation, reverse rotation, braking and stopping; PWM supporting frequencies up to 100kHz; a standby state; the on-chip low-voltage detection circuit and the thermal shutdown protection circuit.
Preferably, the attitude sensor is selected as an integrated device MPU6050 for 6-axis motion, namely a 3-axis gyroscope sensor and a 3-axis acceleration sensor, the MPU6050 is driven by an I2C protocol, both the configuration register and the acquired data need to realize communication between an STM32 microprocessor and the MPU6050 by the I2C protocol, the measured analog quantity is converted into the digital quantity and finally transmitted to an STM32 minimum system, but a conversion relation is still needed to acquire an actual angle value and an actual angular velocity value, so that the actual values of the two can be obtained, and in order to obtain a more exact vehicle body inclination value, a kalman filtering algorithm can be used for effectively eliminating noise interference and random drift errors of the gyroscope and the accelerometer in the measuring process, and accurately calculating the attitude inclination angle of the trolley.
Preferably, the hall sensor module is a hall encoder with a motor, the hall encoder is a sensor for converting mechanical geometric displacement on an output shaft into pulse or digital quantity through magneto-electric conversion, the sensor is mainly used for detecting the speed of the motor in real time, a timer of an STM32 minimum system is used for measuring the speed, and an encoder A/B is connected to a channel 1 and a channel 2 of the timer and used for feeding back speed information to a microprocessor.
Preferably, the power supply module is a voltage reducing module, three 3.7V18650D power supply batteries are used for supplying power, the driving voltage of the motor driving module is 12V, the driving voltage of the main control and the sensor is 5V, so that voltage reduction is needed to be carried out to meet the power supply use of the whole circuit, the voltage reducing module of the LM2596S chip is selected, the voltage of the module is displayed by a nixie tube, and the voltage is input to be 3.5V-40V and 3V-35V and is output in an adjustable mode.
Preferably, the Bluetooth module is selected as HC-06 and supports Bluetooth 4.0 driving, can be freely used in the latest android, IOS, windows operating system and WeChat applet, has strong compatibility, and can be directly communicated with an upper computer through a USART serial port of STM 32.
Preferably, the ultrasonic module is an HY-SRF05 ultrasonic module, the distance is measured by adopting ultrasonic waves based on an ECHO detection principle, the detection distance is 2cm to 450cm, the precision is 3mm, the module has 5 interfaces, four VCCs are used as power supply ends, TRIG is used as trigger signal input, and ECHO is used as ECHO signal output end. The time of the high level of the ECHO output, which is the time of the ultrasonic wave transmission waveform to the return waveform, is calculated by a timer in STM32, and the measurement distance = (ECHO output high level duration × acoustic wave (340 m/S))/2.
Preferably, the OLED display screen is selected to be a 0.96 inch OLED screen, and a chip of SSD1306Z is selected to be a screen with a size of 128 x 64, and SPI communication is performed with STM32 to transfer data; 3.3V-5V can work, 5V is selected here, the distance measurement is mainly used for displaying ultrasonic waves, the speed transmitted by the left Hall sensor and the right Hall sensor is displayed, the angle of the attitude sensor is displayed, and the capacity of the power supply is displayed.
The invention provides a fuzzy self-adaptive PID method of a multifunctional intelligent balance trolley, which comprises the following steps:
s1, PID direct control
When the whole car body tilts, the attitude sensor and the Hall encoder analyze and process the acquired data through PID to obtain corresponding control signals to control PWM output, the PWM controls the motor to advance, retreat, leftwards, rightwards and stop, if the car body tilts forwards, the motor is controlled to move forwards to counteract the forward tilting trend of the car body, so that an integral balance effect is achieved, if the car body tilts backwards, the motor is controlled to move backwards to counteract the forward tilting trend of the car body, and balance can be maintained;
s2, vertical control, speed control and direction control realized by PID algorithm
S2.1, vertical control
The condition of maintaining the stable balance and the upright of the trolley is that the magnitude of the inclination angle and the magnitude of the angular velocity of the trolley can be accurately measured, a PID algorithm in the upright control is controlled by using a proportional plus derivative variable (PD), a proportional link P calculates the difference between the inclination angle of the trolley and a mechanical target angle, a derivative link D calculates the current acceleration of the pitch angle of the trolley, and an upright control algorithm:
PD out =K p *E θ (k)+K d *V θ
wherein E is θ (k) Is the difference between the mechanical target angle and the current car tilt angle, V θ The current acceleration of the pitch angle of the trolley;
s2.2 speed control
When the trolley is to incline forwards, the trolley accelerates forwards faster to reach rebalancing, namely the speed control of the trolley is realized through positive feedback, the output is added with the input, the error between the output of the system and the target of the system is increased, wherein the proportional plus integral variable (PI) used in the PID algorithm is used for controlling, the proportional link P calculates the difference between the target speed zero and the current left and right wheel speeds of the trolley, the integral link I calculates the sum of historical trolley speed accumulation, and the speed control algorithm:
wherein E is V (k) The difference between the target speed zero and the current left and right wheel speeds of the trolley,the sum of historical small vehicle speed accumulations;
s2.3 Direction control
The premise of realizing the steering control of the balance trolley is that the balance control and the speed control can realize better balance effect, and the trolley needs to be controlled to turn left, so that the left wheel is slower than the right wheel when finally assigned to the motor, the right wheel is slower than the left wheel in speed, the steering ring in the PID algorithm can be controlled by using the proportion link P generally, and the speed difference of the two wheels is controlled, if the left wheel needs to turn left, the speed of the left wheel is greater than that of the right wheel, and if the right wheel needs to turn right, the speed of the right wheel is greater than that of the left wheel.
PD out =K p *E θ (k)+K d *V θ
Wherein E is θ (k) Is the difference between the mechanical target angle and the current car tilt angle, V θ The current acceleration of the pitch angle of the trolley;
s3, fuzzy PID control
The fuzzy PID control takes an error E and an error change rate EC as the input of the system, carries out a quantization partition on the input data and a formulated rule according to the input deviation and the deviation change rate, and then judges the set to which the input belongs and calculates the corresponding membership degree through fuzzification according to the quantized result. The fuzzy reasoning finds out the corresponding result according to the result of the fuzzification membership degree and the corresponding fuzzy rule table, namely, the membership degree corresponding to the output value corresponding to the fuzzy rule table can be obtained by adopting a gravity center method. Finally, the solution is fuzzy, and the solution of the output value can be calculated by multiplying the membership degree by the corresponding membership value.
(III) beneficial effects
Compared with the prior art, the invention provides the control system of the multifunctional intelligent balance trolley and the fuzzy self-adaptive PID method thereof, which have the following beneficial effects:
1. the control system of the multifunctional intelligent balance trolley and the fuzzy self-adaptive PID method thereof can realize the traditional PID control of the balance trolley, but parameters Kp, ki and Kd of the PID are manually debugged to find out the value of an optimal system, the fuzzy PID control optimizes each parameter of the PID by utilizing a fuzzy logic rule according to the input condition, overcomes the defect that the traditional PID parameter cannot adjust the PID parameter in real time, and optimizes the output of the system.
2. According to the control system of the multifunctional intelligent balance trolley and the fuzzy self-adaptive PID method thereof, for traditional PID control, if the structure or environment of a control object is greatly changed or parameters which are manually set before are controlled, the system is not suitable or even does not work, manual setting is performed again, the fuzzy PID can automatically adjust the parameters, the adaptability is very strong, good control effect can be kept even if the environment and the structure are changed, and the stability output of the system is improved.
3. The control system of the multifunctional intelligent balance trolley and the fuzzy self-adaptive PID method thereof have the advantages of flexible control, strong strain capacity, high efficiency, stable performance, low cost, environmental protection, no pollution and the like on the balance trolley by a fuzzy PID control algorithm.
Drawings
FIG. 1 is a block diagram of a fuzzy adaptive PID control system of a two-wheeled multi-functional intelligent balance car;
FIG. 2 is a motor drive wiring diagram;
FIG. 3 is a wiring diagram of an MPU6050 attitude sensor module;
FIG. 4 is a wiring diagram of a Hall sensor for the left and right wheels;
FIG. 5 is a wiring diagram of a buck module;
FIG. 6 is a wiring diagram of a Bluetooth module HC-06;
FIG. 7 is a wiring diagram of an HY-SRF05 ultrasonic module;
FIG. 8 is an OLED wiring diagram;
FIG. 9 is a schematic signal diagram of a control balance car;
FIG. 10 is a graph of upright control and speed control;
FIG. 11 is a steering control diagram;
FIG. 12 is an input quantization map;
FIG. 13 is a graph of quantized corresponding membership values;
FIG. 14 is a fuzzy PID control diagram;
fig. 15 is a general flowchart of the balance car control.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1-15, the present invention provides the following technical solutions: the control system of the multifunctional intelligent balance trolley comprises a trolley model, an STM32 minimum system, a motor driving module, a Hall sensor module, a gesture detection module, a Bluetooth module, a power supply module, an ultrasonic module and an OLED display screen; the motor driving module drives the motor to normally run, the gesture detection module mainly detects the inclination of the car body, the Hall sensor module detects the running speed of the motor through the encoder, the Bluetooth module remotely controls the front, back, left and right running of the trolley, and the ultrasonic module mainly achieves the ranging obstacle avoidance function of the trolley. The relationship between the components of the system is shown in figure 1 as follows.
The STM32 minimum system comprises a CPU (Central processing Unit) with the model of STM32F103C8T6, when a vehicle body is inclined, an attitude detection module detects the inclination angle, a main controller receives signals of the inclination angle and outputs PWM (pulse width modulation) to a motor drive to control corresponding operation of the motor after processing of a PID (proportion integration differentiation) algorithm, namely, a control signal is output to control the trolley to run in the same direction of inclination, and the movement direction of the trolley is controlled to achieve a balanced state by continuously detecting signals of the inclination angle;
the STM32 minimum system comprises a core board with the model of CORTEX-M3, a CPU with the model of STM32F103C8T6 is placed on the core board, the core board with the model of CORTEX-M3 has smaller volume, the highest working frequency of 72MHz and 48 pins, three general timers and one advanced timer are arranged in the core board, and the core board is provided with 3 serial ports, two IIC/SPI outputs and a UART peripheral device port.
The power supply voltage of the motor driving module is 12V, a chip of the motor driving module selects a chip TB6612FNG, the chip outputs continuous driving current of 1A at the highest per channel, the starting peak current reaches 2A/3A (continuous pulse/single pulse), and 4 motor control modes are as follows: forward rotation, reverse rotation, braking and stopping; PWM supporting frequencies up to 100kHz; a standby state; the on-chip low-voltage detection circuit and the thermal shutdown protection circuit. The wiring diagram of the driving motor is shown in fig. 2.
The attitude sensor is selected as an integrated device MPU6050 for 6-axis motion, namely a 3-axis gyroscope sensor and a 3-axis acceleration sensor, the MPU6050 is driven by an I2C protocol, communication between an STM32 microprocessor and the MPU6050 is realized by a configuration register and acquired data through the I2C protocol, the measured analog quantity is converted into digital quantity and finally transmitted to an STM32 minimum system, but an actual angle value and an actual angular velocity value still need a conversion relation to obtain the actual values of the two, and in order to obtain a more precise vehicle body inclination value, a Kalman filtering algorithm is adopted to effectively eliminate noise interference and random drift errors of the gyroscope and the accelerometer in the measuring process, so that the attitude inclination of the trolley is accurately calculated. The MPU6050 module connection diagram is shown in FIG. 3.
The Hall sensor module is a Hall encoder with a motor, the Hall encoder is a sensor for converting mechanical geometric displacement on an output shaft into pulse or digital quantity through magneto-electric conversion, the sensor is mainly used for detecting the speed of the motor in real time, a timer of an STM32 minimum system is used for measuring the speed, and an encoder A/B is connected to a channel 1 and a channel 2 of the timer and used for feeding back speed information to a microprocessor. The hall sensor wiring diagram is shown in fig. 4.
The power supply module is a voltage reducing module, three 3.7V18650D power batteries are used for supplying power, the driving voltage of the motor driving module is 12V, the driving voltage of the main control and the sensor is 5V, so that voltage reduction is needed to be carried out to meet the power supply use of the whole circuit, the voltage reducing module of the LM2596S chip is selected, the voltage of the module is displayed by a nixie tube, and the voltage is input to be 3.5V-40V and is output in a 3V-35V adjustable mode. The voltage dropping module wiring diagram is shown in fig. 5.
The Bluetooth module is selected as HC-06 and supports Bluetooth 4.0 driving, can be freely used in the latest android, IOS, windows operating system and WeChat applet, has strong compatibility, and can be directly communicated with an upper computer through a USART serial port of STM 32. The wiring diagram of the Bluetooth module HC-06 is shown in fig. 6.
The ultrasonic module is selected as an HY-SRF05 ultrasonic module, the distance is measured by adopting ultrasonic waves based on an ECHO detection principle, the detection distance is 2cm to 450cm, the precision is 3mm, the module has 5 interfaces, four VCCs are used as power supply ends, TRIG is used as trigger signal input, and ECHO is used as ECHO signal output end. The time of the high level of the ECHO output, which is the time of the ultrasonic wave transmission waveform to the return waveform, is calculated by a timer in STM32, and the measurement distance = (ECHO output high level duration × acoustic wave (340 m/S))/2. The HY-SRF05 ultrasonic module wiring diagram is shown in FIG. 7.
The OLED display screen is selected to be a 0.96 inch OLED screen, a chip of SSD1306Z is selected as a screen with the size of 128 x 64, and SPI communication is carried out with STM32 to convey data; 3.3V-5V can work, 5V is selected here, the distance measurement is mainly used for displaying ultrasonic waves, the speed transmitted by the left Hall sensor and the right Hall sensor is displayed, the angle of the attitude sensor is displayed, and the capacity of the power supply is displayed. The OLED wiring diagram is shown in fig. 8.
The invention provides a fuzzy self-adaptive PID method of a multifunctional intelligent balance trolley for solving another technical problem, which comprises the following steps:
s1, PID direct control
When the whole car body tilts, the attitude sensor and the Hall encoder analyze and process the acquired data through PID to obtain corresponding control signals to control PWM output, the PWM controls the motor to advance, retreat, leftwards, rightwards and stop, if the car body tilts forwards, the motor is controlled to move forwards to counteract the forward tilting trend of the car body, so that an integral balance effect is achieved, if the car body tilts backwards, the motor is controlled to move backwards to counteract the forward tilting trend of the car body, and balance can be maintained; as shown in fig. 9.
S2, vertical control, speed control and direction control realized by PID algorithm
S2.1, vertical control
The condition of maintaining the stable balance and the upright of the trolley is that the magnitude of the inclination angle and the magnitude of the angular velocity of the trolley can be accurately measured, a PID algorithm in the upright control is controlled by using a proportional plus derivative variable (PD), a proportional link P calculates the difference between the inclination angle of the trolley and a mechanical target angle, a derivative link D calculates the current acceleration of the pitch angle of the trolley, and an upright control algorithm:
PD out =K p *E θ (k)+K d *V θ
wherein E is θ (k) Is the difference between the mechanical target angle and the current car tilt angle, V θ The current acceleration of the pitch angle of the trolley;
s2.2 speed control
When the trolley is to incline forwards, the trolley accelerates forwards faster to reach rebalancing, namely the speed control of the trolley is realized through positive feedback, the output is added with the input, the error between the output of the system and the target of the system is increased, wherein the proportional plus integral variable (PI) used in the PID algorithm is used for controlling, the proportional link P calculates the difference between the target speed zero and the current left and right wheel speeds of the trolley, the integral link I calculates the sum of historical trolley speed accumulation, and the speed control algorithm:
wherein E is v (k) The difference between the target speed zero and the current left and right wheel speeds of the trolley,the sum of historical small vehicle speed accumulations; the upright control and speed control are shown in fig. 10.
S2.3 Direction control
The premise of realizing the steering control of the balance trolley is that the balance control and the speed control can realize better balance effect, and the trolley needs to be controlled to turn left, so that the left wheel is slower than the right wheel when finally assigned to the motor, the right wheel is slower than the left wheel in speed, the steering ring in the PID algorithm can be controlled by using the proportion link P generally, and the speed difference of the two wheels is controlled, if the left wheel needs to turn left, the speed of the left wheel is greater than that of the right wheel, and if the right wheel needs to turn right, the speed of the right wheel is greater than that of the left wheel.
PD out =K p *E θ (k)+K d *V θ
Wherein E is θ (k) Is the difference between the mechanical target angle and the current car tilt angle, V θ The current acceleration of the pitch angle of the trolley; the steering control is shown in fig. 11.
S3, fuzzy PID control
The fuzzy PID control takes an error E and an error change rate EC as the input of the system, carries out a quantization partition on the input data and a formulated rule according to the input deviation and the deviation change rate, and then judges the set to which the input belongs and calculates the corresponding membership degree through fuzzification according to the quantized result. The fuzzy reasoning finds out the corresponding result according to the result of the fuzzification membership degree and the corresponding fuzzy rule table, namely, the membership degree corresponding to the output value corresponding to the fuzzy rule table can be obtained by adopting a gravity center method. Finally, the solution is fuzzy, and the solution of the output value can be calculated by multiplying the membership degree by the corresponding membership value.
And (3) inputting a quantization process:
the body inclination angle interval-90 to +90 of the balance trolley is so that E is an inclination angle, EC is the change rate of the inclination angle, namely the change difference value of the current angle deviation and the last angle deviation, the value range of EC is-180 to +180, then the basic argument is defined as [ -6, +6], the corresponding value is { -6, -5, -4, -3, -2, -1,0,1,2,3,4,5,6} and the corresponding deviation angle is { -90, -75, -60, -45, -30, -15,0, +15, +30, +45, +60, +75, +90}, the deviation angle mapping is quantized into an argument interval value, in fuzzy control, the input and output variable sizes are described in a fuzzy language form, and the commonly selected 7 language values are { NB, NM, NS, O, PS, PM, PB }, namely { negative large, negative small, zero, positive small, medium and positive large }, and the corresponding argument interval value exactly. As shown in fig. 12.
Blurring:
the fuzzification is a key step of a fuzzification algorithm, firstly, a fuzzy subset of fuzzy language variables is used, then, according to the input quantification result, a certain section in a domain area where E and EC are input can be known, a certain section in the affiliated fuzzy language is judged through the section, and finally, a corresponding membership degree is calculated, so that a membership degree value is a variable in the fuzzification domain and is used for describing the degree that a corresponding input variable belongs to a certain fuzzy space, the membership degree is a value between 0 and 1, and the membership degree is most commonly solved by using a triangular membership degree function. For example, the balance car deviates by +15 degrees, the result after quantization is 1, if a triangular membership function is used between 0 and 2, the membership corresponding to 0 (Z) is 0.5, the membership corresponding to 2 (PS) is 0.5, but they add up to 1, and if the membership belonging to Z is x, the membership belonging to PS is 1-x. As shown in fig. 13.
Fuzzy reasoning:
firstly, the fuzzy reasoning needs to make a fuzzy rule base, and we only set three parameters of Kp, ki and Kd, so that the fuzzy rule base of the 3 variables is built, the fuzzy rule base is generally made according to control requirements and the control purpose, namely, the rule base is made according to the characteristics of a PID controller, the characteristics of the parameters of the proportion link Kp in the PID controller are determined by the response speed of the system in time, and the response speed of the system can be improved by increasing the value of the Kp parameters, and the steady-state deviation is reduced; however, too large a value of Kp can produce a large overshoot, even stabilizing the system remotely, and decreasing Kp can slow the system response, but improve stability.
Therefore, when the Kp value is set, a larger value is selected in the early stage, so that the system rapidly responds to the condition that the Kp value is close to the output value, a smaller value is selected in the middle stage of adjustment, the system is prevented from overshooting, a larger value is selected in the later stage of adjustment to reduce static error, and control accuracy is improved. The fuzzy rule defining Kp according to the description is as follows
For the characteristic of the integral link Ki parameter in the PID controller, which is mainly used for eliminating the steady-state deviation of the system, the system response is generally proportional link action at the initial stage of regulation, the system needs to be fast response to a steady value, the integral link is generally small or even does not participate in regulation, the early stage of Ki is selected to be zero, the integral starts to act slowly at the middle stage of regulation, the integral link at the later stage is selected to enhance regulation, the static error is reduced to zero, and according to the analysis, the Ki fuzzy rule formulated by us is as follows:
the differential regulation effect of the PID controller is mainly aimed at improving dynamic characteristics of inertia of a controlled object, and can give a deceleration signal for early braking in response to a process. The method is helpful for reducing overshoot, overcoming oscillation and enabling the system to be stable; and meanwhile, the response speed of the system is increased, and the adjustment time is shortened, so that the dynamic characteristic of the system is improved. If the differential action is added, the system response is accelerated, the overshoot is reduced, the stability is increased, but disturbance sensitivity is brought, the disturbance inhibition capability is weakened, and if the disturbance inhibition capability is too large, the response process is braked excessively in advance, so that the adjustment time is prolonged; conversely, if too small, the speed reduction in the adjustment process will lag, the overshoot will increase, the system will respond slowly, and the stability will be poor. Therefore, in the early stage of the response process, the proper increase of the differential action can reduce or even avoid overshoot, and in the middle stage of the response process, the change is sensitive, so the differential action is smaller and remains unchanged; in the later stage of the adjustment process, the braking action of the process is weakened, the disturbance inhibition capability is increased, the adjustment time increase caused by the larger initial stage of the adjustment process is compensated, and according to the analysis, the Kd fuzzy rule formulated by the user is as follows:
for example, the balance car deviates from an angle of +15 degrees, the angle change rate is-20, the result of the deviation angle quantization is 1, if a triangular membership function is adopted between 0 and 2, the membership corresponding to 0 (Z) is 0.5, the membership corresponding to 2 (PS) is 0.5, but they are added to 1, the result of the angle change rate quantization is-0.5, if a triangular membership function is adopted between 0 and-2, the membership corresponding to 0 (Z) is 0.75, the membership corresponding to-2 (NS) is 0.25, and if the membership of Z of E is a, the membership belonging to PS is 1-a. And if the membership degree of Z of EC is b, the membership degree of NS is 1-b, then the corresponding result is found out through a rule table, and finally the final determined value is found out through fuzzy resolution.
Deblurring:
for the sensor to acquire E and EC, we can know the membership degree of the sensor in different fuzzy sets and also know the fuzzy rule table, at this time we can use the gravity center method, the gravity center method to solve the fuzzy is to get the final output value of fuzzy reasoning by taking the gravity center of the area formed by the fuzzy membership degree function curve and the abscissa, the formula is as follows:
wherein mu c (z i ) Is the membership of E and EC, z i And (3) representing the abscissa value of the corresponding membership function, obtaining a delta K value after the deblurring operation, obtaining the set parameters Kp, ki and Kd by K=K+delta K, and performing actual execution by a PID controller. The overall fuzzy PID control diagram is shown in FIG. 14.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.
Claims (10)
1. The control system of the multifunctional intelligent balance trolley comprises a trolley model, an STM32 minimum system, a motor driving module, a Hall sensor module, a gesture detection module, a Bluetooth module, a power supply module, an ultrasonic module and an OLED display screen; the method is characterized in that: the motor driving module drives the motor to normally run, the gesture detection module mainly detects the inclination of the car body, the Hall sensor module detects the running speed of the motor through the encoder, the Bluetooth module remotely controls the front, back, left and right running of the trolley, and the ultrasonic module mainly achieves the ranging obstacle avoidance function of the trolley.
2. The control system of the multifunctional intelligent balance trolley according to claim 1, wherein the minimum system of the STM32 comprises a CPU (Central processing Unit) with the model of STM32F103C8T6, when the trolley body is inclined, the gesture detection module detects the inclination angle, the main controller receives the signal of the inclination angle, and outputs PWM (pulse width modulation) to the motor drive to control the corresponding operation of the motor after the processing of a PID (proportion integration differentiation) algorithm, namely, the control signal is output to control the trolley to drive in the same direction of the inclination, and the signal of the inclination angle is continuously detected to control the movement direction of the trolley to achieve a balance state;
the STM32 minimum system comprises a core board with the model of CORTEX-M3, a CPU with the model of STM32F103C8T6 is placed on the core board, the core board with the model of CORTEX-M3 has smaller volume, the highest working frequency of 72MHz and 48 pins, three general timers and one advanced timer are arranged in the core board, and the core board is provided with 3 serial ports, two IIC/SPI outputs and a UART peripheral device port.
3. The control system of the multifunctional intelligent balance car according to claim 1, wherein the power supply voltage of the motor driving module is 12V, the chip selects a chip TB6612FNG, the chip outputs continuous driving current of up to 1A per channel, the peak current is started up to 2A/3A (continuous pulse/single pulse), and 4 motor control modes are as follows: forward rotation, reverse rotation, braking and stopping; PWM supporting frequencies up to 100kHz; a standby state; the on-chip low-voltage detection circuit and the thermal shutdown protection circuit.
4. The control system of the multifunctional intelligent balance car according to claim 1, wherein the attitude sensor is selected as an integrated device MPU6050 for 6-axis motion, namely a 3-axis gyroscope sensor and a 3-axis acceleration sensor, the MPU6050 is driven by an I2C protocol, both a configuration register and acquired data need to be communicated between an STM32 microprocessor and the MPU6050 by the I2C protocol, the measured analog quantity is converted into a digital quantity and finally transmitted to an STM32 minimum system, but a conversion relation is still needed to obtain an actual value of the two, and in order to obtain a more exact car body inclination value, a kalman filtering algorithm can effectively eliminate noise interference and random drift errors of the gyroscope and the accelerometer in the measuring process, and accurately calculate the car attitude inclination.
5. The control system of the multifunctional intelligent balance trolley according to claim 1, wherein the hall sensor module is a hall encoder of the motor, the hall encoder is a sensor for converting mechanical geometric displacement on an output shaft into pulse or digital quantity through magneto-electric conversion, the sensor is mainly used for detecting the speed of the motor in real time, a timer of an STM32 minimum system is used for measuring the speed, and an encoder A/B is connected to a channel 1 and a channel 2 of the timer and used for feeding back speed information to a microprocessor.
6. The control system of the multifunctional intelligent balance trolley according to claim 1, wherein the power supply module is a voltage reducing module, three 3.7V18650D power batteries are used for supplying power, the driving voltage of the motor driving module is 12V, the driving voltage of the main control and the driving voltage of the sensor are 5V, so that voltage reduction is needed to be carried out to meet the power supply use of the whole circuit, the voltage reducing module of the LM2596S chip is selected, and the voltage is displayed by the module with a nixie tube, and the voltage is input to be 3.5V-40V and 3V-35V and is output in an adjustable mode.
7. The control system of the multifunctional intelligent balance trolley according to claim 1, wherein the Bluetooth module is selected as HC-06 and supports Bluetooth 4.0 driving, can be freely used in the latest android, IOS, windows operating system and WeChat applet, has strong compatibility, and can be directly communicated with an upper computer through a USART serial port of STM32, so that the method is simple and the technology is mature.
8. The control system of the multifunctional intelligent balance car according to claim 1, wherein the ultrasonic module is an HY-SRF05 ultrasonic module, the distance is measured by ultrasonic waves based on an ECHO detection principle, the detection distance is 2cm to 450cm, the precision is 3mm, the module has 5 interfaces, four VCCs are used as power supply ends, TRIG is used as trigger signal input, and ECHO is used as ECHO signal output end. The time of the high level of the ECHO output, which is the time of the ultrasonic wave transmission waveform to the return waveform, is calculated by a timer in STM32, and the measurement distance = (ECHO output high level duration × acoustic wave (340 m/S))/2.
9. The control system of the multifunctional intelligent balance trolley according to claim 1, wherein the OLED display screen is selected as a 0.96 inch OLED screen, and an SSD1306Z chip is a 128 x 64 size screen, and is in SPI communication with STM32 for data transmission; 3.3V-5V can work, 5V is selected here, the distance measurement is mainly used for displaying ultrasonic waves, the speed transmitted by the left Hall sensor and the right Hall sensor is displayed, the angle of the attitude sensor is displayed, and the capacity of the power supply is displayed.
10. The fuzzy self-adaptive PID method of the multifunctional intelligent balance trolley is characterized by comprising the following steps of:
s1, PID direct control
When the whole car body tilts, the attitude sensor and the Hall encoder analyze and process the acquired data through PID to obtain corresponding control signals to control PWM output, the PWM controls the motor to advance, retreat, leftwards, rightwards and stop, if the car body tilts forwards, the motor is controlled to move forwards to counteract the forward tilting trend of the car body, so that an integral balance effect is achieved, if the car body tilts backwards, the motor is controlled to move backwards to counteract the forward tilting trend of the car body, and balance can be maintained;
s2, vertical control, speed control and direction control realized by PID algorithm
S2.1, vertical control
The condition of maintaining the stable balance and the upright of the trolley is that the magnitude of the inclination angle and the magnitude of the angular velocity of the trolley can be accurately measured, a PID algorithm in the upright control is controlled by using a proportional plus derivative variable (PD), a proportional link P calculates the difference between the inclination angle of the trolley and a mechanical target angle, a derivative link D calculates the current acceleration of the pitch angle of the trolley, and an upright control algorithm:
PD Out =K p *E θ (k)+K d *V θ
wherein E is θ (k) Is the difference between the mechanical target angle and the current car tilt angle, V θ The current acceleration of the pitch angle of the trolley;
s2.2 speed control
When the trolley is to incline forwards, the trolley accelerates forwards faster to reach rebalancing, namely the speed control of the trolley is realized through positive feedback, the output is added with the input, the error between the output of the system and the target of the system is increased, wherein the proportional plus integral variable (PI) used in the PID algorithm is used for controlling, the proportional link P calculates the difference between the target speed zero and the current left and right wheel speeds of the trolley, the integral link I calculates the sum of historical trolley speed accumulation, and the speed control algorithm:
wherein E is V (k) The difference between the target speed zero and the current left and right wheel speeds of the trolley,the sum of historical small vehicle speed accumulations;
s2.3 Direction control
The premise of realizing the steering control of the balance trolley is that the balance control and the speed control can realize better balance effect, and the trolley needs to be controlled to turn left, so that the left wheel is slower than the right wheel when finally assigned to the motor, the right wheel is slower than the left wheel in speed, the steering ring in the PID algorithm can be controlled by using the proportion link P generally, and the speed difference of the two wheels is controlled, if the left wheel needs to turn left, the speed of the left wheel is greater than that of the right wheel, and if the right wheel needs to turn right, the speed of the right wheel is greater than that of the left wheel.
PD out =K p *E θ (k)+K d *V θ
Wherein E is θ (k) Is the difference between the mechanical target angle and the current car tilt angle, V θ The current acceleration of the pitch angle of the trolley;
s3, fuzzy PID control
The fuzzy PID control takes an error E and an error change rate EC as the input of the system, carries out a quantization partition on the input data and a formulated rule according to the input deviation and the deviation change rate, and then judges the set to which the input belongs and calculates the corresponding membership degree through fuzzification according to the quantized result. The fuzzy reasoning finds out the corresponding result according to the result of the fuzzification membership degree and the corresponding fuzzy rule table, namely, the membership degree corresponding to the output value corresponding to the fuzzy rule table can be obtained by adopting a gravity center method. Finally, the solution is fuzzy, and the solution of the output value can be calculated by multiplying the membership degree by the corresponding membership value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211571201.8A CN116069019A (en) | 2022-12-08 | 2022-12-08 | Control system of multifunctional intelligent balance trolley and fuzzy self-adaptive PID method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211571201.8A CN116069019A (en) | 2022-12-08 | 2022-12-08 | Control system of multifunctional intelligent balance trolley and fuzzy self-adaptive PID method thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116069019A true CN116069019A (en) | 2023-05-05 |
Family
ID=86175904
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211571201.8A Pending CN116069019A (en) | 2022-12-08 | 2022-12-08 | Control system of multifunctional intelligent balance trolley and fuzzy self-adaptive PID method thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116069019A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117590740A (en) * | 2024-01-19 | 2024-02-23 | 艾信智慧医疗科技发展(苏州)有限公司 | Intelligent regulation and control system for medical track trolley |
CN118112921A (en) * | 2024-04-28 | 2024-05-31 | 菏泽学院 | Wheelbarrow balance control method and system based on PID controller |
-
2022
- 2022-12-08 CN CN202211571201.8A patent/CN116069019A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117590740A (en) * | 2024-01-19 | 2024-02-23 | 艾信智慧医疗科技发展(苏州)有限公司 | Intelligent regulation and control system for medical track trolley |
CN117590740B (en) * | 2024-01-19 | 2024-03-22 | 艾信智慧医疗科技发展(苏州)有限公司 | Intelligent regulation and control system for medical track trolley |
CN118112921A (en) * | 2024-04-28 | 2024-05-31 | 菏泽学院 | Wheelbarrow balance control method and system based on PID controller |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116069019A (en) | Control system of multifunctional intelligent balance trolley and fuzzy self-adaptive PID method thereof | |
CN201856757U (en) | Inertial wheel two-wheeled robot stabilizing device | |
CN105334853A (en) | Double-core high-speed four-wheel miniature micro-mouse sprint controller | |
CN101104385A (en) | Safety contron system for electric vehicles | |
CN110109354B (en) | Self-adaptive sliding mode control method for counteractive wheel balance bicycle robot | |
CN109067264A (en) | A kind of balance car system and its control method | |
CN105807689A (en) | Two-wheel self-balance car control system | |
CN104670359A (en) | Double-wheel mini type motorcycle | |
CN219770046U (en) | Self-balancing unmanned bicycle | |
CN207607592U (en) | The adjustable double-wheel self-balancing base apparatus of center of gravity | |
CN102198032A (en) | A controller and control method for a motorised vehicle | |
JP4327566B2 (en) | Traveling body capable of switching between grounding and floating of front wheel and traveling state switching method | |
CN106078744A (en) | A kind of double-wheel self-balancing robot Sliding Mode Adaptive Control system | |
CN104682789A (en) | PID (Proportion Integration Differentiation) controller applied to two-wheeled robots | |
CN106335584A (en) | Double-wheel balance vehicle control system | |
CN111514556B (en) | Motor vehicle control system | |
KR20110082395A (en) | Singled wheeled mobile robot | |
CN109911085A (en) | The adjustable double-wheel self-balancing base apparatus of center of gravity | |
CN110109353B (en) | Fuzzy self-adaptive sliding-mode control system of counteractive wheel balance bicycle robot | |
Jie et al. | Design of upright intelligent vehicle based on camera | |
CN106041934A (en) | Slip form self-adaption control method of two-wheel self-balance robot | |
CN214648784U (en) | Single-rail self-balancing bicycle electric control system based on different working conditions | |
WO2021120739A1 (en) | Laser tracking self-balancing scooter control method | |
You et al. | Design of two-wheel balance car based on STM32 | |
CN112298428A (en) | Control method of balance car, obstacle avoidance method of balance car and following operation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |