A micro Four-rotor flight controller is designed by using the inertial sensor MPU6050 and STM32 microcontroller. The attitude of the aircraft is controlled by double closed-loop PID.
The system is stable and has strong anti-jamming ability. Micro-quadruple-rotor aircraft not only has the advantages of small size, simple structure and low cost, but also can take off and land vertically and hover at fixed points in narrow space.
It can adapt to various complex environments and has broad application prospects. However, the Four-rotor aircraft is a typical non-linear, strong coupling, multi-variable underactuated system, and is vulnerable to external interference factors in the flight process, making the design of flight control system become particularly difficult. Therefore, this paper uses STM32 processor as the core controller, combined with MPU6050 gyroscope accelerometer and 2.4G wireless communication module, designs a double closed-loop PID control algorithm to realize the stable flight of micro Four-rotor aircraft.
The overall structure of the four rotor aircraft is shown in Figure 1, which is composed of the main controller module, battery pack power supply module, wireless communication module, power output module and sensor module. The controller sends flight instructions to the aircraft by remote control. After receiving flight instructions, thermostatic element the flight controller STM32F103C8T6 collects real-time information of gyroscope, accelerometer chip MPU6050 and GPS chip through IIC bus.
After filtering algorithm, flight attitude is calculated, and PWM of four motors is calculated by closed-loop PI algorithm.
Duty ratio, the attitude control of aircraft is realized by controlling the speed of four motors. The aircraft chooses STM32F103C8T6 of ST as its main control chip.
The chip uses Cortex-M3 core with the highest main frequency of 72MHz, built-in 64KB program memory, 20KB data memory, three universal timers, one advanced timer, two 12-bit 10-channel ADCs, 32 universal IO ports, and supports bus interfaces such as SPI, IIC, UART, USB, CAN, etc.
。 To meet the requirements of flight control system. The sensor of gyroscope and accelerometer adopts MPU6050. The chip integrates three-axis gyroscope and three-axis accelerometer.
The measuring range of gyroscope is ( 250 dps, 500 dps, 1000 dps, 2000 dps), and the measuring range of accelerometer is ( 2 g, 4 g, 8 g, 16 g).
IIC bus and main control chip are used to communicate. The whole flight control algorithm includes flight attitude calculation and attitude control. Attitude calculation is based on the gyroscope and accelerometer of MPU6050 to obtain the angular velocity and acceleration of three-axis rotation, respectively, and to solve the orientation and attitude of Four-rotor aircraft. The digital motion processing (DMP) unit is integrated in MPU6050.
Kalman filter is used to fuse six-axis data to generate quaternion. The master chip reads the quaternion directly from the data buffer of MPU6050 through IIC bus, and converts the quaternion into Euler angle [2-3] by formula (1) to obtain the current attitude of the aircraft. Four-rotor aircraft will inevitably be subject to external interference during flight. Therefore, the double closed-loop cascade control algorithm is used to adjust and control the flight attitude of the aircraft and improve the anti-jamming ability of the system. The control block diagram is shown in Fig. 2.
The inner loop controls the angular velocity of the aircraft by PID and the outer loop controls the attitude angle of the aircraft by PID. The object of the micro Four-rotor aircraft is shown in Fig. 3. The hardware of the micro Four-rotor aircraft is composed of STM32F103C8T6 and MPU 6050 chips with high performance, and its structure is simple and reliable. In the software, the DMP function of MPU6050 chip is used to read the attitude of the aircraft directly and control the attitude of the aircraft with double closed-loop PID to obtain more stable flight attitude control.