Liaoning Province Electric Competition Award-winning Works - Firefighting Flying Vehicle[Copy link]
1 System Solution
1.1 Demonstration and Selection of Master Control
Solution 2: Use STM32 microcontroller, which has analog, communication, timing and control peripherals and rich functions, but its motion control related functions are not as strong as the microcontroller provided by the official competition.
Comparing the above two solutions, this system adopts Solution 1.
1.2 Demonstration and Selection of Driver
Solution 2: BTN7971. It is a half-bridge driver chip, which requires two chips to drive a motor. The current can reach up to 43A. Its internal resistance is very small, heat dissipation is good, and practicality is good.
1.3 Demonstration and selection of control system
Scheme 2: Adopt cascade PID algorithm, calculate according to the functional relationship of proportion P, integral I, differential D, and then output the calculation result to the control end. The PID algorithm is simple, easy to understand, and has high control accuracy, which can meet the control requirements of this system.
Comprehensively comparing the above two schemes, this system adopts scheme 2.
Solution 1: Use bmp085 pressure sensor to measure atmospheric pressure and convert it to altitude. Subtract the altitude value at takeoff from the current altitude measurement value to get the height of the aircraft from the ground. However, the flight altitude of this competition is relatively low, the chip price is relatively expensive, the error is large, and debugging is relatively difficult.
Combining the above two solutions, choose Solution 2.
The system is mainly based on TI's TM4C1294XL microcontroller. In terms of the control of the quadcopter, MPU6050 is used as an angle sensor to measure the relevant attitude angle of the quadcopter during flight, and cascade PID is used for adjustment, so that the quadcopter can complete the stable flight of the relevant attitude. In terms of positioning height, we use ultrasonic ranging sensors to measure the height of the quadcopter and make corresponding adjustments to enable the aircraft to complete the measurement of fixed height. In terms of identifying flames, we use the camera OV7725 plus an optical flow sensor to identify the location of the target through corresponding features. The figure below is a specific system program flowchart.
We use the OV7725 camera, which can recognize multiple colors. Due to the large amount of data, the acquisition speed will be slow, about 17ms, so there will be a certain lag. When designing parameters, attention should be paid to the response speed of the system. And it is also necessary to pay attention to the overshoot of the system. Too large a P value will speed up the response speed, but it will also increase the overshoot of the system and cause the system to oscillate at a low frequency. Because the power of the system is provided by the motor, a larger D value is required to stabilize the control and reduce the overshoot, but too high a D value will cause the system to oscillate at a high frequency, making the system unstable. More suitable P and D parameters can make the system have a faster response speed and a smaller overshoot, but the system will still have a certain static error. For this static error, a smaller I value can be used to overcome it, but too large an I value will cause the system to oscillate. Therefore, when setting the PID parameters, a suitable P should be selected with a larger D and a smaller I.
2.2 Analysis of the control algorithm
This system uses the PID algorithm to control the input PWM value of the four motors. After the four motors start working, the camera acquisition module continuously collects the current state of the car and compares it with the previous state, thereby changing the input PWM value of the four motors to achieve following. The PID algorithm controller consists of position proportion P, position error integral I and position differential D.
Proportional P: Proportional adjustment of position. The larger the proportion, the faster the adjustment speed. However, it should not be too large, otherwise the motor may become unstable due to sudden changes in working state.
Integral I: Eliminate steady-state error of the system. Adding integral adjustment can reduce system stability and slow down dynamic response. This system pursues faster and more stable control of the quadcopter, so the system has very little need for integral adjustment. That is, it ensures that the system will not be affected when it is not needed.
Unipolar PID: When you know the current state and the expected state of the system, how to adjust the system from the current state to the expected state is a problem. Here we can use PID for adjustment. PID is divided into position type and incremental type.
Cascade PID is two PIDs connected in series, divided into inner loop and outer loop PID. Here, we use inner loop PID control and outer loop PID control. The input of unipolar PID is the expected angle, and the feedback is angle data. In cascade PID, the input feedback of the outer loop is also angle data, and the input feedback of the inner loop is angular velocity data. The figure below is a specific structural schematic diagram. Figure 1.2 Cascade PID program diagram
Figure 1.2 Cascade PID program diagram
3.1 Circuit design
[attach]413624 [/attach]
The block diagram of the MCU subsystem is shown in Figure 3.2
[p=21, null, Use multimeter, oscilloscope and other instruments to check the hardware circuit board to ensure that there is no problem with the circuit board and that the power supply and output of each module are normal. Use keil compiler software to perform software simulation test. During debugging, the download line is connected to the microcontroller so that multiple variables in the control algorithm can be observed in real time when the program is executed. 4.2 Test conditions and instruments Ensure that the simulation circuit is exactly the same as the hardware circuit and the system schematic diagram, and ensure that the hardware circuit is welded normally without cold welding. Ensure that the output voltage of the power chip in the circuit is the designed voltage.5pt]The following figure is the corresponding program flowchart.
[p=21, null, Use multimeter, oscilloscope and other instruments to check the hardware circuit board to ensure that there is no problem with the circuit board and that the power supply and output of each module are normal. Use keil compiler software to perform software simulation test. During debugging, the download line is connected to the microcontroller so that multiple variables in the control algorithm can be observed in real time when the program is executed. 4.2 Test conditions and instruments Ensure that the simulation circuit is exactly the same as the hardware circuit and the system schematic diagram, and ensure that the hardware circuit is welded normally without cold welding. Ensure that the output voltage of the power chip in the circuit is the designed voltage.5pt]The following figure is the corresponding program flowchart.
[p=21, null, Use multimeter, oscilloscope and other instruments to check the hardware circuit board to ensure that there is no problem with the circuit board and that the power supply and output of each module are normal. Use keil compiler software to perform software simulation test. During debugging, the download line is connected to the microcontroller so that multiple variables in the control algorithm can be observed in real time when the program is executed. 4.2 Test conditions and instruments Ensure that the simulation circuit is exactly the same as the hardware circuit and the system schematic diagram, and ensure that the hardware circuit is welded normally without cold welding. Ensure that the output voltage of the power chip in the circuit is the designed voltage.