Design and Implementation of Speed Control System of Smart Car

Disclaimer: This article is reprinted and the content is not original. The source will be stated at the end of the article. There is no intention of offense. It is only for the convenience of temporary review. Infringement must be deleted!

Introduction In the smart car competition, the speed control cannot use pure PID. Instead, the "multi-mode" speed control algorithm that can smoothly switch among multiple modes such as full acceleration, emergency braking and closed-loop control can be used in order to adapt to different roads. The situation quickly and accurately changes the vehicle speed to achieve stable cornering. The system hardware design is in accordance with the competition requirements. The smart car speed control system designed in this paper uses Freescale MC9S12DG128 single-chip microcomputer as the core, and forms the smart car speed closed-loop control system together with the vehicle speed detection module, DC motor drive module, and power supply module. MCU based on track information

introduction

In the smart car competition, the speed control can not use pure PID, but the "multi-mode" speed control algorithm that can smoothly switch among multiple modes such as full acceleration, emergency braking and closed-loop control can be used according to different road conditions. Change the vehicle speed quickly and accurately to achieve stable cornering.

System hardware design

According to the competition requirements, the smart car speed control system designed in this paper uses Freescale MC9S12DG128 single-chip microcomputer as the core, and forms the smart car speed closed-loop control system together with the vehicle speed detection module, DC motor drive module, and power supply module. The single-chip microcomputer uses a reasonable control algorithm to control the vehicle speed according to the track information. The vehicle speed detection uses a photoelectric encoder installed on the rear axle of the car model. The DC motor drive uses an H bridge circuit composed of four MOS tubes as shown in Figure 1. , The power module supplies power to the microcontroller, photoelectric encoder and drive motor.

System modeling

For the design of a control system for actual objects, the first thing to do is to model the actuator and the system, and calibrate the input and output of the system. In order to design a suitable controller for the vehicle speed control system, the speed system must be ordered and normalized. In this regard, respectively designed acceleration and deceleration model testing experiments. The motor speed is measured by a photoelectric encoder installed on the rear axle of the car model. The gear ratio of the encoder gear to the driving wheel is 33/76, and each pulse output from the encoder corresponds to the movement of the smart car by 1.205mm. The car model can adjust the speed by adjusting the duty cycle of the PWM wave added to the motor. The PWM module on the single-chip microcomputer can be 8-bit or 16-bit. In order to improve the accuracy of speed control, the motor speed control module uses 16-bit PWM. Its duty cycle adjustment range is from 0 to 65535, corresponding to the motor armature voltage from 0% to 100% battery voltage.

Place the car model on a long straight track, apply different voltages to the drive motor in an open loop method, and record the speed value of the car model after the speed has stabilized. Then the curve of fitting the measured armature voltage to the vehicle speed is shown in Figure 2. From Figure 1, the smart car acceleration model can be approximated as a linear model.

According to the experimental data, the zero point and gain of the vehicle speed actuator system can be determined. The relationship between vehicle speed V and duty cycle PWM_Ratio is as follows:

V = PWM_Ratio×402 + 22000 (1)

Among them: the value range of PWM_Ratio is 0-65535

There are three methods for car model deceleration: free deceleration, dynamic braking and reverse braking. Free deceleration power comes from frictional resistance, which is basically considered constant. Energy consumption braking is the consumption of energy to the internal resistance of the motor. The braking force decreases as the vehicle speed decreases, and the acceleration can also be reduced faster through control. Reverse braking is achieved by reverse voltage application, and the braking force is related to the reverse voltage applied.

Due to the limited tire grip, tire skidding will occur when the braking force exceeds a certain value. Once slip occurs, the braking distance will become longer and the turning radius will become larger. If the braking force can always be controlled at the critical slip point, the shortest braking distance can be obtained. Among the three deceleration methods, only reverse braking can give different reverse braking forces according to different vehicle speeds, allowing the vehicle speed to drop at the maximum slope. Therefore, the highest non-slip braking voltage has been determined through a large number of experiments, and the highest non-slip scratch duty cycle is about 55,000. Because there are differences in different tracks, there is a margin when programming. Vibration is used as a sign to identify whether the car model is slipping when braking. You can divide several typical vehicle speeds, let the car model increase to the preset speed on the straight, and then use a set of reverse voltages for reverse braking, observe and record the highest non-slip braking voltage. In this way, a corresponding maximum braking voltage is obtained for each typical vehicle speed. After comparing the maximum non-slip reverse connection voltage with the vehicle speed, it is found that the maximum non-slip reverse connection voltage is proportional to the vehicle speed. Consider the DC motor model. When an external voltage is applied to the motor armature, the motor rotor begins to rotate, generating a back EMF, and this voltage is proportional to the vehicle speed. When the back EMF generated on the rotor is equal to the applied voltage, the motor speed reaches a steady state. Therefore, the voltage remaining after the reverse braking voltage minus the back EMF generated by the motor is used for deceleration. When the car model is about to decelerate, the back EMF of the rotor can be calculated by the current vehicle speed, and then a reverse brake voltage is superimposed on this basis and sent to the actuator.

The forward resistance of the car model is mainly divided into ground sliding friction and wind resistance, and the quality of the car model remains constant during the driving process. In the case of low vehicle speed, the wind resistance can also be regarded as a constant value. Combining the above experimental data and reasoning, it can be known that the main part of the vehicle speed model is the first-order inertia link.

Speed ​​control strategy

After analysis, the track is roughly divided into straights, corners of 90 degrees and above, and S-shaped curves. In order to maximize the speed on different roads, the key question is how to judge the road conditions. The following is Judgment conditions and passing strategies for several roads.

● Judgment conditions and passing strategies for straights

When the trolley detects a black line within the detection range of the middle three photoelectric cells, it is considered that the trolley is driving on a straight road. If the conditions of the straight road are met, the trolley will accelerate until it reaches a larger value and meets the braking conditions. If the black line is detected for dozens of consecutive cycles, it means that the car is driving on a long straight and needs to brake when turning.

   直道最高限速度是赛车从长直道入弯时不冲出弯道的最高速度,小车行驶时不能高于这个速度。当然,刹车越及时,越灵敏,则直道上速度就可以越大。实验得到约为55000(对应PWM的占空比)。

The minimum speed that needs to be braked is the maximum speed at which the car can enter a curve from a long straight and can pass the curve smoothly without braking. When the instantaneous speed of the car is higher than this speed, the brake is activated, otherwise, the brake is not used. The experiment measured that the maximum speed of a long straight into a turn does not exceed 50000 (corresponding to the duty cycle of PWM).

● Corner judgment conditions and passing strategy

When the car does not meet the conditions of a straight road, it drives on a curve. Because of the different radius of curvature and angle of the curve, it is divided into 90 degrees and above 90 degrees and S-shaped curves. When the car is driving in a curve, only one side of the sensor continuously detects the black line, and then the size of the curve angle is determined according to the length of time the sensors on both sides detect the black line; if the car is driving on an S-shaped curve, the sensor The detected value will continuously change within the horizontal deviation range. In short, on a curve, drive at the maximum speed of the curve.

The maximum speed of the curve is the speed that allows the car to accelerate on the curve until it exits the track. When the speed of the car on the curve is less than the maximum speed of the curve, the duty cycle of the PWM signal must be adjusted to make the car gradually accelerate. The experiment measured that the maximum speed of all corners does not exceed 32000 (corresponding to the PWM duty cycle).

● Cross line recognition

According to the rules of the game, there are crossover lines, but because it is crossed at right angles, it is only necessary to keep the original direction and speed of travel when multiple sensors detect the black line.

Guess you like

Origin blog.csdn.net/weixin_39354151/article/details/100564575