Four-axis aircraft design Report

Source: Internet
Author: User
Tags asin

A report on the application of SCM in practical training design
(Four-axis aircraft)

Department: Department of Electrical Information Engineering
Class: (2014) Communication Technology Class 1
Name: Peng
Instructor: Shi


Summary

In order to meet the design requirements of the four-axis aircraft, the control system and algorithm based on the microcontroller are designed. Firstly, the comparison and demonstration of each unit circuit scheme are carried out, and the hardware design scheme is determined. The four-axis aircraft employs 4 brushless motor-driven aircraft connected to a rigid cross-cross structure, based on the CONTEXT-M3 CPU core of arm, around the new context-m3 CPU internal core evolution of STMicroelectronics stm32f103 high-capacity microcontroller as the control core, operating frequency up to 72MHz, the standard operating voltage of 3.3V, suitable for all types of consumer electronics and industrial applications, the controller is a 32-bit low-power microcontroller, to help reduce system power consumption, Reduce the construction cost of the total system. Using ESC drive Brushless motor, and has the characteristics of simple control, large power, with 5V power output and so on. With the MPU-6050 integrated 3-axis gyroscope, 3-axis accelerator, and a Digital motion processing (dmp:digital motion Processor) hardware acceleration engine that connects other card accelerators, magnetic sensors, or other sensors via a second i²c port, The system uses MPU-6050 internal DMP to calculate the four-dollar number, through the formula converted to Euler angle, through the Cascade PID calculation of the PWM increment, real-time adjustment of the four-axis aircraft attitude, Cascade PID has simple debugging, high efficiency, good stability and so on. Rely on Bluetooth, nrf24l module and four-axis aircraft for data exchange.


Keywords: four-axis aircraft, mpu-6050,stm32f103, Cascade PID, Euler angle, DMP, four elements

Directory
Directory
One, System scheme demonstration 4
1.1 demonstration and selection of Attitude Module 4
1.2 Demonstration and selection of power supply Module 4
1.3 Demonstration and choice of Flight mode 5
1.4 The demonstration and selection of the Brushless motor driver Module 5
1.5 microcontroller selection 6
1.6 Selection of remote control Method 6
Second, system theory analysis and calculation 7
2.1 Analysis of Cascade PID control algorithm 7
2.1.1 Cascade PID Theory Analysis 7
2.1.2 Cascade PID Tuning Method 7
2.1.3 Cascade PID block Diagram 8
2.2 theory and calculation of Euler's Angle 8
2.2.1 Theoretical Analysis 8
2.2.24 Yuan calculate the theoretical analysis of Euler's Angle 9
2.2.34 Yuan calculates the programming of Euler's Angle
2.2.4 Hardware Acceleration engine (DMP) theoretical analysis of the
2.3 four-axis aircraft and flight structure analysis of the
2.3.1 Structure Form 13
2.3.2 Working principle
Three, the circuit and the programming of the
3.1 circuit design of the
3.1.1 System General block diagram
3.1.2 MPU6050 circuit schematic diagram of
3.1.3 Motor drive System block diagram 3.1.4 Power Module 3.1.5 microcontroller minimum system circuit design
3.1.6 ESC connection schematic diagram of
3.2 program Design
3.2.1 Program function description and design ideas
3.2.2 Program flowchart Test plan and test results in
4.1 test solution 4.2 test results and analysis of
4.2.1 Analysis and conclusion of the Test
v. Summary of the special week
Vi., reference materials
Vi. appendices: +

First, the system scheme demonstration
The system is mainly composed of single-chip microcomputer control module, Attitude acquisition module, Power module, motor drive module, brushless motor, frame and anti-collision ring, etc., using "+" type flight mode, the following respectively demonstrate the choice of these modules.
Demonstration and selection of 1.1 attitude module
Scenario One: MPU6050 three-axis gyroscope. The MPU6050 triaxial gyroscope is a measurement device that can measure acceleration, movement trajectory and position in six different directions at the same time. Single axis, you can only determine the amount of One direction, then a three-axis gyro can replace three single-axis gyro. It has now become the development trend of laser gyro, with a good reliability, simple structure is not complex, light weight and small size and so on, but its output data need a large number of floating-point budget to ensure high accuracy, this will affect the microcontroller to the final attitude control response rate, the advantage is to change the chip data, application mature, The price is cheap, is a very suitable for beginners to get started chip.

Scenario Two: Fiber optic gyroscope. Fiber optic gyroscope is a sensitive element based on the optical fiber coil, the light emitted by the laser diode in two directions along the optical fiber transmission. The change of the optical transmission path determines the angular displacement of the sensitive element. The fiber optic gyroscope has long life, large dynamic range, instantaneous start-up, simple structure, small size, light weight, but high cost.

Scenario Three: ahrs module. The ahrs module includes modules such as MPU6050 (integrated 3-axis gyroscope and 3-axis accelerometer), hmc5883l (3-axis geomagnetic sensor), and BPM180 barometric altimeter. And the ahrs module has carried out some data processing, through the serial port direct output of the aircraft's current posture state, reduce the single-chip microcomputer attitude calculation of the running time consumption, and further improve the microcontroller attitude control, but the module is an integrated module, the price is higher, not suitable for beginners to learn the QFN package welding.

In combination with the above three options, we have chosen option one.

1.2 Demonstration and selection of power supply module
The motor power of the aircraft is provided directly by the 12 volt special-purpose lithium battery, and we use the ESC for 12V, with 5V power supply output, the STM32 MCU operating voltage is 3.3V, so the system needs to do a voltage conversion, in order to control the core power supply, its quality directly determines the stability of the system.

Scenario One: The ME6219 series is a high-precision, low-noise, ultra-fast response low-voltage linear regulator manufactured in the CMOS process. This series of voltage regulators built-in fixed reference voltage source, error correction circuit, current limiting circuit, phase compensation circuit and low internal resistance MOSFET, to achieve high ripple rejection, low output noise, ultra-fast low dropout performance. High precision output voltage.
Scenario Two: AMS1117. The AMS1117 series of regulators are available in adjustable versions with a wide range of fixed voltage versions designed to provide 1A output current and operate with a low dropout voltage of up to 1V. At maximum output current, the dropout voltage of the AMS1117 device is guaranteed to be no more than 1.3V and gradually decreases with the decrease in load current. AMS1117 's on-chip trimming adjusts the reference voltage to 1.5% of the error, and the current limit is adjusted to minimize the pressure caused by overloading the regulator and the power supply circuit. However, it can provide less current and is prone to heat in high current operating conditions.

In combination of the above two scenarios, select Scenario Two.

1.3 Demonstration and choice of flight mode
Program 1:10 Word flight mode. The four-axis four motors are arranged in a cross-stitch manner, which should be adjusted diagonally, and we are mainly used to test the algorithm. Advantages: The cross-flight mode is simple to debug, it is very suitable for beginners to master the four-axis aircraft flight algorithm, disadvantage: it has limited flexibility and adjustable.

Scenario Two: X-line flight mode. Four-axis four motor in the way of X-word arrangement, adjust the time should be adjacent to two adjustment, flexibility and high adjustability. X-mode flight is very free and flexible, a variety of rotation, can be flying, can also make a lot of difficult movements, but the way the parameters are more difficult to debug, not suitable for beginners to use.

In combination with the above two schemes, option one is selected.
Demonstration and selection of 1.4 Brushless Motor Drive module
Plan one: their own production of brushless motor drive circuit, this difficulty, easy to fry machine, not suitable for beginners to use, but their own production drive module can further learn analog circuit.

Scenario Two: The use of ESC module, the module application has been very mature, and its own production of electrical adjustment, with simple control, with 5V power output, you can save 5V power supply design, simplify the circuit structure, reduce the circuit occupied area, stability is very high, flexible control, very suitable for beginners to use.

In combination of the above two scenarios, option two is selected.


1.5 single-chip computer selection
Scenario One: The use of domestic STC15W4K61S4 series single-chip microcomputer, the single-chip microcomputer 8-bit microcontroller, low cost, can work in 1T mode, the highest internal oscillation frequency of 30MHZ, can eliminate the minimum system design, do not need external crystal oscillator and reset circuit, can eliminate the workload of circuit design. However, the single-chip microcomputer processing efficiency is low, the operating speed is slow, not suitable for the attitude calculation and data fusion calculation of a considerable amount of applications.

Scenario Two: The use of St company's STM32F103 series SCM, the microcontroller using arm context-m3 core, the microcontroller is 32-bit, the maximum operating frequency of 72MHZ, with fast processing speed, high efficiency, suitable for industrial control. The single-chip microcomputer data, the use of St company Integrated Library development with simple development, short development cycle, high efficiency, is very suitable for four-axis aircraft control core.

In combination of the above two scenarios, option two is selected.
1.6 Selection of the remote control mode
Scheme one: The use of Bluetooth control four-axis aircraft, because Bluetooth control is simple, very convenient and mobile phone and PC connection, easy to control. and using anonymous four-axis aircraft anonymous host computer and four-axis connection can analyze four-axis data, PID settings and control of the game controller four-axis, very suitable for beginners, and do four-axis algorithm verification test.
Scenario Two: The use of NRF24L01 module, the module operating frequency band of 2.4GHz, transmission distance, using SPI and MCU communication, can achieve up to 1-kilometer long-distance control, but must make their own remote controls, suitable for four-axis algorithm after the successful commissioning of the four-axis control, this is the future production goals.
Scenario Three: The use of the more popular multi-channel remote control, the internal 2.4 module and MCU composition, the direct output of ppm pulse width, single-chip microcomputer only capture the pulse width can be controlled four-axis, the remote control has been product-based, easy to use, stable and efficient, and do not need to write their own communication protocols. But the remote control is expensive and there is no money to support it.
Combined with the above three programmes, option one was selected.
Second, system theory analysis and calculation
Analysis of 2.1 Cascade PID control algorithm
Analysis of 2.1.1 Cascade PID theory
Roll and pit axes calculate the PID output according to the above formula, but the yaw axis is very special, because the yaw angle normal direction is just parallel to the earth gravity, the angle of this direction cannot be measured directly by the accelerometer, need to add an electronic compass to replace the accelerometer. If we do not use the compass, we can simply pass the angular velocity integral to measure the yaw angle, the disadvantage is because there is integral drift in the integration link, the yaw angle over time will be more and more deviation. We do not use the compass and there is no proportional term, only use the differential link to control. Cascade PID: Double closed-loop PID algorithm using angle p and angular velocity pid------> Angle error is expected to be input into the angular velocity controller (angular differential is the angle velocity)
For this system, the whole Cascade PID Controller is composed of angle control and angular velocity control cascade. In the Cascade PID algorithm, the angular velocity inner ring occupies a very important position. After analyzing the physical model of four-rotor flight, it can be known that one of the physical manifestations of instability is unstable angular velocity. Therefore, if we can directly control the angular velocity of the system, the dynamic characteristics and stability of the system will be improved, and the inner ring of angular velocity is often called the stabilization link. The effect of the angle outer ring is reflected in the precise control of the attitude angle of the four-axis aircraft.
Outer ring: Input is angle, output is angular velocity
Inner ring: Input is angular speed, output is PWM increment
The use of Cascade PID is divided into: angle ring control pid ring, and angular speed control ring stability ring. The central melody is the Angle Ring (outer ring) and the secondary is the angular velocity ring (inner ring).
The parameter setting principle is first inside and outside, so the PID of the outer ring is set to 0 when setting the inner ring
The so-called outer ring is just a p in effect, that is, the proportion in action, p is the correction, the larger the more easily make the plane concussion.
The characteristic of concussion is: the frequency is small, the amplitude is big.
Analysis of 2.1.2 Cascade PID Tuning method
Debugging the system is divided into 6 steps:
The first step: the internal and external ring PID is 0, the appropriate increase in the inner ring of p, adjust p to four-axis from the face-to-face natural rotation to face down to feel the resistance, and no jitter, jitter should be reduced p, when the p is reduced to no jitter or slight jitter can be.
The second step: let the inner ring D slowly increase, to your hand can obviously feel the rotation of the four axes to create the resistance of the rejection force, D can suppress the oscillation of p, but D too large will lead to high-frequency oscillation, adjust D to the system without oscillation and can suppress the outside force.
The third step: give the inner ring a little bit I, note that the integral of I to start after the throttle, throttle off on the clear 0, and must have integral limit. I recommend the smaller the better, I take the 0.01,i will cause the system oscillation.
Halve the inner ring p to 50-70 times the inner ring, and lower the d of the inner ring according to the high frequency oscillation generated by the system until the high frequency oscillation is eliminated.
Give the outer ring a little I, with 3.

Fourth step: According to the actual situation to optimize the adjustment of parameters, the adjustment process should pay attention to distinguish the role of each parameter, always remember that P is the recovery force, the large will be low-frequency oscillation, D is a restraining force, a large high-frequency oscillation, I is the static difference elimination force, the smaller the better, the larger will produce oscillation.

2.1.3 Cascade PID Block diagram
Fig. 1 schematic diagram of Cascade PID control
Theory and calculation of 2.2 Euler's angle
Theoretical analysis of Euler angle of 2.2.1
In the 3D model, the most common method of rotation is four and Euler angles, which has the advantage of saving storage space and convenient interpolation compared with matrix. In this paper, we mainly summarize the conversion of two expressions, the 3D Cartesian coordinate system is used in the calculation formula:

Defines the rotation angle around the z-axis, y-axis, and x-axis, respectively, as the heading Angle (YAW), the pitch angle (Pitch), and the Tait-bryan angle, respectively.
Rolling angle (roll).


The dynamic definition of Euler's angle, which is formed by the Euler angle as 3 consecutive rotations, has 12 methods of definition according to the different rotation axes and their order selection. Here we mainly analyze the air order Euler angle, the air order Euler angle is defined in accordance with the order of z-y-x Z axis rotation represents the course angle (YAW), rotation around the Y axis represents the pitch (Pitch), rotation around the x-axis represents the roll angle.

2.2. The theoretical analysis of Euler's angle calculated with 24-dollar number
One or four definition of the number of dollars

=1
A four-dollar number can be constructed by rotating the axis and the angle of rotation around the axis:




This is the angle that rotates around the axis of rotation, the component of the axis of rotation in X, Y, and Z (thus determining the axis of rotation).
Second, Euler angle to four yuan conversion

Three or four yuan to Euler angle conversion

As a result of arctan and arcsin, this does not cover all orientations (the range of values for the corners has been met), so atan2 is needed instead of arctan.

Iv. use in other coordinate systems
In other coordinate systems, the above formula should be adjusted according to the definition of the axis. As in Direct3D, the x-axis of the Cartesian coordinate system changes to the z-axis, the y-axis to the x-axis, and the z-axis to the y-axis (regardless of direction).

2.2.34-dollar calculation of the design of Euler's angle
float q0 = 1, q1 = 0, q2 = 0, q3 = 0; Defining four elements
void Imu_update (void)
{
float norm;
Float GX = Mpu6500_gyro.x*gyro_gr,gy = MPU6500_GYRO.Y*GYRO_GR,GZ = unit conversion between mpu6500_gyro.z*gyro_gr;//angles
float ax = Acc_avg.x,ay = Acc_avg.y,az = acc_avg.z;
float q0q0 = q0 * Q0;
float q0q1 = q0 * Q1;
float Q0Q2 = q0 * Q2;
float Q1Q1 = Q1 * Q1;
float Q1Q3 = Q1 * Q3;
float q2q2 = q2* Q2;
float q2q3 = q2*q3;
float q3q3 = q3*q3;
Float VX, vy, VZ;
Float ex, EY, EZ;
Floatq0_yawq0_yaw = Q0_yaw * Q0_YAW;
Floatq1_yawq1_yaw = Q1_yaw * Q1_YAW;
Floatq2_yawq2_yaw = Q2_yaw * Q2_YAW;
Floatq3_yawq3_yaw = Q3_yaw * Q3_YAW;
Floatq1_yawq2_yaw = Q1_yaw * Q2_YAW;
Floatq0_yawq3_yaw = Q0_yaw * Q3_YAW;

Yaw axis calculation ******************************

Differential equations for yaw axis four elements
Q0_yaw = Q0_yaw + (-q1_yaw * Gx-q2_yaw * Gy-q3_yaw * gz) * sample_half_t;
Q1_yaw = Q1_yaw + (Q0_yaw * GX + q2_yaw * Gz-q3_yaw * gy) * sample_half_t;
Q2_yaw = Q2_yaw + (Q0_yaw * Gy-q1_yaw * GZ + q3_yaw * GX) * sample_half_t;
Q3_yaw = Q3_yaw + (Q0_yaw * gz + q1_yaw * Gy-q2_yaw * GX) * sample_half_t;
Normalized Yaw axis four yuan
Norm = sqrt (Q0_yawq0_yaw + q1_yawq1_yaw + Q2_yawq2_yaw + q3_yawq3_yaw);
Q0_yaw = Q0_yaw/norm;
Q1_yaw = Q1_yaw/norm;
Q2_yaw = Q2_yaw/norm;
Q3_yaw = Q3_yaw/norm;
if (ax * ay * az== 0)
return;
Normalized Accelerometer values
Norm = sqrt (ax * ax + ay * ay + az * az);
Ax = ax/norm;
ay = ay/norm;
AZ = az/norm;
Estimating gravity direction and flow/change
VX = 2 * (Q1Q3-Q0Q2);
VY = 2 * (q0q1 + q2q3);
VZ = q0q0-q1q1-q2q2 + q3q3;
The difference between the outer product of the vector and the subtraction is the error
ex = (AY * vz-az * vy);
EY = (AZ * vx-ax * vz);
EZ = (AX * vy-ay * VX);
PI Calculation of error
Ex_int = Ex_int + ex * IMU_KI;
Ey_int = ey_int + ey * IMU_KI;
Ez_int = Ez_int + ez * IMU_KI;

Calibration Gyroscope
GX = GX + IMU_KP * ex + ex_int;
GY = gy + imu_kp * ey + ey_int;
GZ = GZ + IMU_KP * ez + ez_int;

The differential equation of four elements
Q0 = q0 + (-Q1 * gx-q2*gy-q3*gz) *sample_half_t;
Q1 = Q1 + (Q0*GX + q2*gz-q3*gy) *sample_half_t;
Q2 = q2 + (Q0*gy-q1*gz + q3*gx) *sample_half_t;
Q3 = Q3 + (Q0*gz + q1*gy-q2*gx) *sample_half_t;

Normalized pitch, roll axis four yuan
Norm = sqrt (q0q0 + q1q1 + q2q2 + q3q3);
q0 = Q0/norm;
q1 = q1/norm;
q2 = Q2/norm;
Q3 = Q3/norm;

Solving Euler angles
angle.x = atan2 (2 * q2q3 + 2 * q0q1,-2 * q1q1-2 * Q2Q2 + 1) * 57.3F;
ANGLE.Y = ASIN ( -2 * q1q3 + 2 * q0q2) * 57.3F;
Angle.z = atan2 (2 * q1_yawq2_yaw + 2 * q0_yawq3_yaw,-2 * q2_yawq2_yaw-2 * Q3_yawq3_yaw + 1) * 57.3F;
}
Program Description: The program is provided by the open source quad-axis BlackHole1.
2.2.4 Hardware acceleration Engine (DMP) theory analysis
The MPU-6050 incorporates a 3-axis gyroscope, 3-axis accelerator, and Digital motion processing (dmp:digital motion Processor) hardware acceleration engine, the most powerful feature of which is its use of the MPU6050 integrated internal acceleration engine, Avoid the above using MPU6050 raw data, through a variety of algorithms to obtain a stable four, and we use the official DMP driver directly read out the value of four yuan, save a lot of work, in the use of four-dollar formula to calculate a stable, effective Euler angle. However, because the geomagnetic compensation is not used, the yaw angle (YAW) will produce an error over time.
Some of the procedures for calculating Euler angles are as follows:
q0 = quat[0]/q30;//q30 format converted to floating-point number
Q1 = quat[1]/q30;
Q2 = quat[2]/q30;
Q3 = quat[3]/q30;
Calculate pitch angle/roll angle/Heading angle
*pitch = ASIN ( -2 * Q1 * q3 + 2 * q0* Q2) * 57.3;//pitch
*roll = atan2 (2 * Q2 * q3 + 2 * q0 * Q1,-2 * Q1 * q1-2 * q2* Q2 + 1) * 57.3;//Roll
*yaw = atan2 (q1*q2 + q0*q3), q0*q0+q1*q1-q2*q2-q3*q3) * 57.3;//yaw
2.3 Four-axis aircraft and flight structure analysis
2.3.1 Structural Form
The rotor symmetrical distribution in the body of the front and back, left and right four directions, four rotors in the same height plane, and four rotary
The structure and radius of the wings are the same, four of the motors are symmetrically mounted on the aircraft's support side, and the middle space of the bracket is placed
Computer and external equipment


Figure 44 Axis Structure diagram
2.3.2 Working principle
Four-rotor aircraft by adjusting the speed of four motor to change the rotor speed, to achieve the change in lift, so as to control the fly
The posture and position of the line. The four-rotor is a vertical lift with six degrees of freedom, but only four input forces, while
There are six status outputs, so it is an under-driven system.
Four-axis aircraft motor 1 and motor 3 counterclockwise rotation, motor 2 and motor 4 clockwise rotation,
Therefore, when the aircraft balance flight, the gyro effect and aerodynamic torque effect are offset. In, the motor 1 and the motor 3 counterclockwise rotation, the motor 2 and the motor 4 clockwise rotation, the specified along the x-axis positive direction movement is called forward motion, ↑ the arrow indicates this motor speed increase, ↓ said the motor speed decreased.



In, the motor 1 and the motor 3 counterclockwise rotation, the motor 2 and the motor 4 clockwise rotation, the specified along the x-axis positive direction movement is called forward motion, the arrow above the motion plane of the rotor to indicate that the motor speed is increased, below indicates that the motor speed decreased.
(1) Vertical movement: At the same time increase the output power of four motor, rotor speed increase so that the total tensile strength, when the total tensile force is sufficient to overcome the weight of the machine, the four-rotor aircraft will rise vertically from the ground; conversely, while reducing the output power of four motors, the four-rotor aircraft will descend vertically until the balance is reached Vertical movement of the shaft. When the external disturbance amount is zero, the aircraft will remain hovering when the lift generated by the rotor equals the weight of the aircraft.
(2) Pitching motion: In the figure (b), the motor 1 of the speed rise, the motor 3 of the rotational speed decreased (change the size should be equal), motor 2, motor 4 speed remains unchanged. Because of the lift of the rotor 1, the lift of the rotor 3 is reduced, the resulting unbalance torque to rotate the fuselage around the y axis, in the same way, when the motor 1 speed down, the motor 3 of the speed rise, the fuselage will rotate around the y axis to another direction to achieve the aircraft's pitching movement.
(3) Rolling motion: The same principle as the figure B, in Figure C, change the motor 2 and the Motor 4 speed, keep the motor 1 and motor 3 speed unchanged, you can make the fuselage around the x-axis rotation (forward and reverse), to achieve the roll motion of the aircraft.
(4) Yaw motion: The rotor rotation process due to air resistance will be formed in reverse direction with the reverse torque, in order to overcome the impact of anti-torque, four rotors can be two positive rotation, two reversal, and the diagonal of the various rotors rotation
The same direction. The size of the counter-torque is related to the rotor speed, and when the four motors rotate at the same speed, the reverse torque generated by four rotors
Balance, the four-rotor aircraft does not rotate, when the four motor speed is not exactly the same, unbalanced anti-torque will cause the four-rotor aircraft rotation. In Figure D, when the motor 1 and the motor 3 speed rise, the motor 2 and the motor 4
When the rotational speed decreases, the rotor 1 and the rotor 3 on the fuselage of the reverse torque is greater than the rotor 2 and the rotor 4 against the fuselage of the reverse torque, the fuselage will be in the role of surplus counter torque around the z-axis rotation, to achieve the yaw movement of the aircraft, steering Motor 1, Motor 3 turn opposite.
(5) Before and after the movement: in order to achieve the aircraft in the horizontal plane before and after the movement, must be in the horizontal plane to exert some force on the aircraft. In Figure E, increase the motor 3 rpm, so that the tension increases, correspondingly reduce the motor 1 rpm, so that the tensile force is reduced, while maintaining the other two motor speed unchanged, the reverse torque is still to maintain a balance. According to the theory of Figure B, the aircraft first has a certain degree of tilt, so that the rotor force to produce a horizontal component, so that the aircraft can achieve the forward-flying motion. Flying backwards is just the opposite of flying forward. (in Figure B, figure C, the aircraft will produce pitch, tumbling motion along with the X, Y axis of the horizontal movement.) )
(6) Inclination movement: in Figure F, because of the symmetry of the structure, the inclination to fly is the same as before and after the movement.

Third, circuit and program design
3.1 Design of the circuit
3.1.1 System General block diagram
The overall system diagram is shown in Figure 2.

Figure 5 Overall system diagram
3.1.2 MPU6050 circuit schematic diagram

Figure 7 MPU6050 sub-system circuit
3.1.3 Motor Drive System block diagram


Fig. 8 Block diagram of Motor drive subsystem

3.1.4 Power supply Module
The power supply consists of the filter part and the voltage regulation part. Here 5V power directly uses the output of the 5V power supply, here just 5V power supply through the ASM1117 output a stable 3.3V power supply.



Figure 9 Power supply sub-system circuit

Design of minimum system circuit for 3.1.5 single chip microcomputer


Figure 10 Single-chip microcomputer minimum system circuit

Schematic diagram of 3.1.6 ESC connection
Fig. 11 schematic diagram of ESC connection
3.2 Design of the program
Function description and design idea of 3.2.1 Program
1. Program Function description
According to the requirements of the Software section is divided into three parts, the first part of the brushless motor drive, the use of STM32 single-chip internal timer multi-channel PWM output function, to achieve brushless motor drive; The second part is the MPU6050 module data receiving part, Using STM32 MCU internal serial USART1 and Bluetooth module communication, using STM32 simulation IIC interface and MPU6050 for data transmission; The third part is the attitude control part, according to the difference between the Euler angle and the target Euler angle received, the Cascade PID control algorithm is used. The PWM adjustment amount of the corresponding motor is calculated, and the timing PWM output is set to make the attitude balance of the aircraft. The extension part is the use of IAP in the application of programming, first to the SWD download a bootloader program to the STM32, in the use of Bluetooth wireless Chengxi upgrade, so that the complexity of the modified program and burned to write to the microcontroller complex operation.
2, program design ideas
The design of the program combined with the characteristics of the STM32 microcontroller, the main realization of the idea is: single-chip computer power, the use of key mode to unlock the ESC, then use the timer to set the motor PWM period, serial port initialization, in the serial Interrupt service function continuously receive the data sent by MPU6050 module, Here we transplanted TI single-chip computer using MPU6050 internal dmp to calculate Euler angle, read Euler angle directly, eliminate the software data fusion calculation, improve program efficiency. At the end of initialization, set the target posture, enter the loop function, continuously detect whether the MPU6050 data is accepted, and once the effective attitude data is received, the attitude control function is entered. In the attitude control function, using the current four-axis aircraft roll (tumbling) and pitch (pitch), yaw (yaw) data, combined with the Cascade PID control algorithm, to solve the different attitude, the use of aerodynamic principle, the need for each brushless motor to integrate the adjustment of the control motor, This constantly accepts attitude data, calculates the data, adjusts the output, and makes the four-axis flying vehicle stable.

3.2.2 Program Flowchart


Figure 12 Program Flowchart


Iv. test Plan and test results
4.1 Test Plan
1. Hardware test
First, the circuit power to check, with a multimeter to check to ensure that the power after error, and then burn write a test minimum system is working properly program.
Use sub-module to test whether the peripheral circuit is working properly.
2. Software simulation test
Before debugging the program, the oscilloscope is used to observe the STM32 single-chip PWM output, and the program simulates the flight method of the aircraft, through its simulation to test the stability of the PWM.
MPU6050 Module (6-axis attitude meter) with the computer anonymous four-axis serial debugging assistant for data viewing, easy to debug.
3, hardware and software joint adjustment
Through the microcontroller programming, imitate the PWM, adjust the period and duty cycle of the ESC, and measure whether the motor can be driven to take off, through multiple tests, to find out when the aircraft take off the PWM value.
The MPU6050 module (6-axis attitude meter) allows the four-axis spacecraft to take off stably and hover over the air, and then test the four-axis spacecraft forward and backward; final landing test.
4.2 Test results and analysis
4.2.1 Test Analysis and conclusion
According to the above test data, the following conclusions can be drawn:
Using STM32 as the control core through IIC and MPU6050 data transmission, using Bluetooth and the PC on the anonymous four-axis debugging assistant for data analysis, remote control and other debugging operations. This design has completed a remote control four-axis aircraft balance off the ground, but because we use the MPU6050 6-axis sensor, yaw shaft processing is inappropriate, will produce drift over time, difficult to control. It is necessary to improve the algorithm of yaw axis in the later stage, and a 9-axis sensor should be used in the next generation works.
Finally, the control method is to use the anonymous four-axis host computer, through the Bluetooth mode and four-axis spacecraft data exchange. Due to the NRF24L01 module has not been debugged, has not yet reached the requirements of outdoor flight.

V. Summary OF SPECIAL Week

First talk about the four-axis aircraft yearning, in recent years, unmanned aerial vehicle fire, even Wang Feng proposal are used by the domestic DJI, the major technology companies also began to launch their own UAV products, for a drone, I did not know it at the beginning, just full of infinite yearning, I thought I was going to take it off. There are a lot of aerodynamics and mathematical modeling problems that I can't imagine, and it's too hard for me. But you do not try to know if you can, so began to search for four-axis aircraft on Baidu data, just beginning to understand, saw the Netizen God himself on the four-axis aircraft understanding. I also began to step in deeply into the four-axis full of infinite curiosity. Read countless blogs, read countless papers, but also the collection of a number of well-known four-axis forum. I am also gradually clear about what I should do to prepare. In fact, as long as they feel that they can complete the design task, it is bold to do, do not always stay in want to do, but to pay action, bold to try, even if their final failure, you will reap a lot of, these days in learning Linux operating system, In fact, the first UNIX operating system is a failure of the big project, but it is a person to the failure of the thing into the now very successful things.
At first, my plan was to do a small four-axis verification algorithm to find a sense of accomplishment. Because for a beginner, the difficulty of the senior axis is too big, the cost is high, perhaps spent a lot of money and no results, so it is necessary to start learning PCB board production, so a start to learn Guo Tianxiang teacher recorded an Altium designer video, to tell the truth. My microcontroller a lot of knowledge is from the Guo Tianxiang 10 days to conquer the single-chip computer above, it is fortunate to be able to learn again he recorded a PCB circuit board production of a video, speak very thin. For me, the English version of the three has not been a person, the use of English software is also handy. Probably learned more than half a month of time, self-thought can start, but also need to be CAD to draw the contour of the PCB, later learned that the teacher has a DJI UAV frame, so there is no start on the small four-axis design, but the design of the flight Control Board. There were a lot of people who told me not to design a flight control, difficulty is too big, or to sell a flight control board, buy a remote control on their own assembly, but how to learn even if their own failure, I also want to design flight control Board, when I get the original UAV KK Flight Control Board, how this flight control board so simple. Single-chip microcomputer, gyroscope, all kinds of interfaces, even the power supply is not connected. Only one AMS1117 power chip, later learned that the ESC can output 5V power supply, so I can save 12V to 5V of power circuit design, is a wedding game Ah! From the schematic, start with the STM32 minimum system and connect to the peripheral circuit. To the final PCB design, can be described as a strong circuit board design, after the PCB inspection a lot of times, sent to the manufacturers to start proofing, I also test MPU6050 on the development Board, including to learn what is x, Y, z Three direction of acceleration, and X, Y, z three direction angular velocity, This constitutes a 6-axis stereoscopic model. Also began to learn Kalman filtering and complementary filtering, the use of anonymous four-axis host computer to observe the changes in the data curve before and after the filter, but prepared so much, also learned the use of four yuan to calculate the Euler angle, but the algorithm I do not know very well, but I know how to use. Also learned in an open-source electronic forum can take advantage of the MPU6050 internal (dmp:digital Motion Processor) hardware acceleration engine, can eliminate the filtering and complex four data fusion calculation, it is to increase the efficiency of software execution, Finally, I was surprised to find that DMP can be automatically calibrated. It's too powerful.
After receiving the circuit of the proofing will come, began to weld the circuit board, which is my first welding SMD components, which also have a high degree of difficulty QFN package, fortunately I am more witty, have difficulty looking for Niang, yes, saw a QFN welding video, I also began the circuit board of the difficult stage. Finally, after a circuit board was discarded, I finally finished all the soldering and commissioning of the circuit board. Is the Vietnam War more Yong, do not know the most rare or the transplant problem of the algorithm.
In the brushless motor drive, and MPU6050 and Bluetooth and PC machine above the anonymous four-axis upper computer communication protocol to understand, began to learn the Cascade PID, previously participated in the 2015 National undergraduate Electronic Design competition learned a single-level PID algorithm, but this use is a cascade PID, but also a new concept. The learning process is not explained in one way or the other. Can be described as a long trek, and finally the overall commissioning. When I debug the PID parameters, I usually use Bluetooth to accept the PC data, modify the value of the PID variable, to achieve wireless, continuous modification parameters. In many days and nights, did not give up, finally can let the aircraft leave the ground, but the stability is not very good, because there is no geomagnetic sensor, so the use of the angular velocity of the z-axis data to calculate, resulting in yaw (heading angle) has more and more errors over time, Cause four-axis aircraft will be in the external interference under the rotation, resulting in the inability to stabilize the flight, the problem due to the relationship between time, has not been resolved, and the NRF24L01 module has not been debugged, the use of Bluetooth control. This production is full of harvest, but also a trace of the success of silk. Lay the groundwork for the next design. No one is a mouthful to eat fat, so verified my motto: to pay, do not give up, even if it is failure, it is a harvest. Come on!

In the end, thank you for my support and guidance Jinan teacher and Shiyun teacher! Salute

Vi. references

"1" anonymous four-axis open source code, the upper computer. ANO-MR-F1-140104 Classic PID
"2" Guo Tianxiang dxp Design Tutorial
"3" "Brushless brushless DC motor of the electric design of the whole strategy" by:timegate ink Kite
"4" The principle of Kalman filter and integrated navigation Qin Yongyuan
"5" "STM32F1 Development Guide-Library function version _v3.1" Liu June-hot Atom produced
"6" Open source Electronic network www.openv.com provides technical guidance.
"7" Electronic enthusiast network http://www.elecfans.com/four-axis aircraft forum to provide technical reference


Vi. Appendices:

Four-axis aircraft design Report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.