The quadcopter came into the field of vision of ordinary people for the first time, probably because a fun and inspirational movie, the small quadcopter in the film, symbolized the goodness and dreams of the young student. Later, the wave of open source hardware at home and abroad made the quadcopter a dazzling star. In fact, the history of quadcopter has been very long. As early as 1907, someone in France had built the first quadcopter helicopter. As the balance control system was not used, the flight stability was very poor. With the development of micro-electromechanical control technology, the stable quadcopter has received extensive attention, and its application prospects are very promising.
1. Introduction to Quadcopter
Quadrocopter is also called quadrotor drone and quadrotor. Referred to as four-axis, four-rotor. The quadcopter is a multi-rotor aircraft. The four propellers of the quadcopter are all simple mechanisms with motors directly connected. The cross-shaped layout allows the aircraft to obtain the force of rotating the fuselage by changing the motor speed, thereby adjusting its attitude. The specific technical details are described in "Basic Motion Principles". Because of its inherent complexity, there has never been a large commercial quadcopter in history.
An unmanned aerial vehicle refers to an aerial vehicle that has a power unit and does not require a professional operator. It uses the propeller to rotate to form an airflow to the ground to offset the mass of the fuselage, and can realize independent flight or remote control flight. Compared with fixed-wing UAVs, the development of rotary-wing UAVs is relatively slow. This is because the control system of rotary-wing UAVs is more complicated, and early technology cannot meet the flight requirements. However, the rotorcraft has the advantages of all airplanes and fixed-wing UAVs. It has the characteristics of low cost, simple structure, no restrictions of large wings, autonomous take-off and descent functions, and low accident costs. The quadcopter is the simplest type of multi-rotor aircraft. Because of its wide application prospects, it quickly attracted the attention of many researchers, especially the UAV control algorithm of universities in the United States and other Western countries. Many results have been achieved in research and navigation. Based on PID control algorithm in my country, certain achievements have been made in attitude control.
Second, the structural components of the quadcopter
Although the quadcopter has different sizes and shapes, the basic principles and structure are still very similar. The following are some common configurations.
1. Four-axis frame
The frame is a cross-shaped support structure. Mini four-axes often use the circuit board as a guest stand. Some DIY masters will have designed and made lightweight and concise stand. If you don't have the processing conditions, you can buy various finished products directly online. It is better to have elastic support legs for the frame to avoid damage to the motor during landing. In addition, if possible, a frame can be added to the propeller to prevent the blade from hurting or being interrupted.
2. Motor and propeller of quadcopter
In order to make the four-axis smaller and lighter, generally the miniature four-axis will choose the coreless motor, each weighing only a few grams. For the dry quadcopter that everyone plays for aerial photography, the brushless motor for model airplanes is used. These motors will be marked with parameters such as kV800 and kvl 000, which indicate the value that the motor idling speed increases for every 1V increase in the input voltage. The model of the motor is generally a number such as 2212, 2018. The first two digits indicate the diameter of the rotor, and the last two digits indicate the height of the rotor. The larger the number, the greater the power of the motor. For the quadcopter for entry-level aerial photography, choose 2212 or a larger motor.
In addition, when buying a motor, there are generally recommended matching propellers. The propellers of the quadcopter are positive and negative propellers and need to be purchased in pairs. The parameters of the propeller are similar to 1045. The first 2 digits represent the diameter of the propeller (linch=25.4mm) and the back 2 digits are the angle of the propeller.
3. Electronic governor of drone
Electronic speed governor is abbreviated as ESC. It is used to control the speed of the motor. 4 motors need to be controlled by 4 ESCs. The traditional brushed DC motor is connected to two wires. The higher the voltage, the faster the rotation. When the power supply is reversed, the rotation is reversed. The brushless motor generally has at least 3 wires, and the ESC constantly switches the current to control the speed. The signal for ESC control is generally PWM, which is set by different duty cycles. An important parameter of the ESC is the amperage, which represents how much power it can support. The ESC used for aerial photography is recommended to use 20 to 30A or more. In addition, when choosing an ESC, it is best to have a BEC output, which is actually a 5V voltage output, which can power the single-chip microcomputer and sensors on the aircraft and reduce the complexity of the circuit.
4. Flight control
Flight control is a collective term for sensors, single-chip computers, remote control receivers and other peripheral circuits. In addition to self-stabilization, general flight control boards also support different functions, such as aerial photography gimbal control, night lights, GPS modules, etc. The hardware of the flight control board mainly includes gyroscope, acceleration sensor and single chip microcomputer. The gyroscope is only used to detect the angular velocity of the aircraft, and the acceleration is used to detect the attitude of the aircraft. After the aircraft is in the sky, it is often affected by air disturbance and propeller vibration, and the attitude angle measured by the acceleration sensor has a huge error. Although the gyroscope measures the angular velocity accurately, it needs to integrate the angular velocity in order to obtain the attitude, which will cause a large cumulative error over time. Therefore, the core software part of the flight control board must have a fusion algorithm to correct errors. It is said that the latest six-axis sensors (such as MPU6050) now have a fusion algorithm.
The battery quadcopter requires a light-weight and high-power power source. Generally, polymer lithium ion batteries are used. The main parameters of Li-po lithium batteries include nominal voltage, battery capacity and discharge capacity. Taking 3S/2000mAh/25C as an example, the voltage of each cell of a lithium battery is about 3.7v, and several lithium batteries are generally connected in series as needed.
6. The remote control of the four-axis drone
Remote control If you plan to remotely control a miniature quadcopter indoors, you can choose an entry-level remote control. Some quadcopters can also be remotely controlled via Bluetooth mobile phones. If you plan to play aerial photography, then you need a professional model airplane remote control. At present, there are many brands and types of remote controls, and the prices range from several hundred to several. Please choose what you need when choosing. It is recommended to use a remote control with more than 4 channels. The more channels, the more functions can be controlled. In addition, the model aircraft remote control is divided into "American hand" and "Japanese hand", which correspond to the left hand control throttle and the right hand control throttle respectively. Generally speaking, normal people are used to using "American hands", and many remote controls already support switching in the settings. The frequency is generally 2 4GHz, which is more mainstream and very stable. As for the remote control distance, the general remote control is more than a few hundred meters, and the advanced remote control can reach several dry meters. But having said that, the quadcopter is basically unable to see its attitude when it is hundreds of meters away, so there is no need to pursue a long remote control distance.
In addition to the handheld remote control, the quadcopter can also be remotely controlled in some other ways. For example, the current urban area within a few hundred meters of the ground is basically covered by mobile phone signals, so you can install a mobile phone to introduce a SIM card on the aircraft, and communicate through GPRS or 3G networks. It is also possible to add a GPS module to the aircraft, so that even without remote control, through the pre-set software, the quadcopter can automatically return home after performing tasks at the designated location.
3. The power principle of the quadcopter solution
1. The flight mode of the quadcopter
The flight modes of the quadcopter mainly include cross mode and x-shaped mode, as shown in Figure 1.
The flying direction in the cross mode is the same as the installation direction of one of the motors, while the forward direction of the quadcopter in the x mode points to the middle of the two motors. Because the cross mode can directly and clearly distinguish the functions of the four motors during the flight of the quadcopter, the control is simple, but the movement flexibility is poor. The x-mode flight mode is complicated, but the action is flexible. The quad-rotor aircraft design of this topic adopts the x mode.
2. Dynamic analysis of quadcopter
The power of the quadcopter comes from the four motors on the wings, which drive the propellers to provide aerodynamic power. Like ordinary fans, the propeller will push the air forward or backward through its streamlined structure when rotating (depending on the direction of rotation. ). For a quadcopter, all four propellers need to push the air downward to generate upward propulsion. For air propellers, when the motor stops in the air, the propeller continues to rotate in the original direction like a windmill. This phenomenon becomes the spin of the propeller. Through the force analysis of the propeller, it can be known that if a propeller rotates clockwise, the propeller will produce a counterclockwise reaction force on the fuselage, causing the fuselage to rotate counterclockwise. If we use four identical propellers to push the propeller air downward, then the rotation of the four motors is the same, the rotational torque generated by the propellers driven by the motors will move in the same direction, and the four shafts will start to spin wildly. Therefore, in order to counteract the spin of the propellers, a pair of adjacent propellers of the quadcopter should be turned in opposite directions so that the reaction forces generated by this pair of propellers cancel each other out.
The quadcopter itself is an underdrive system. When the rotation speed generated by the four motors is equal and the lift is equal to the weight of the quadcopter, the quadcopter will be in a hovering state. When the aircraft is hovering, there can be a combination of 6 degrees of freedom, namely pitch (forward and backward movement), roll (left and right movement), and elevation (up and down movement).
Fourth, the hardware design of the quadcopter
The entire control system of the quadcopter mainly includes a power supply module, a control module, a motor drive module, a sensor module and a communication module, as shown in Figure 2.
The power module mainly provides power to multiple modules, and the voltage provided is mainly divided into three types: 3.3V, 5V, 3.4V-4.2V. Among them, 3.3V is mainly to supply power to the controller and attitude sensor; 5V is mainly to supply power to the communication module, and 3.4V to 4.2V (battery direct output) is mainly to supply power to the motor.
The communication part is mainly four channel signals from the remote control. Commands for pitch, roll, spin and throttle respectively; the sensor module is used as the attitude detection part of the aircraft, which converts the detected angular velocity and angular acceleration signals into angles through the controller, and uses the angle signals as the current attitude of the aircraft, and the remote control part The signal compares the closed-loop control required for the stroke.
The main controller processes the remote control signal received by communication and the attitude signal collected by the sensor, analyzes the data and performs fusion processing, and finally obtains the control value of the motor through the PID algorithm, and the value is finally output in the way of PWM to drive the motor.
5. Software design of quadcopter
The control system software is written in C language, and the microprocessor company provides powerful library functions, so that the design of the entire software system can focus more on algorithms and software architecture. The final design of the hardware system and software system of the four-axis aircraft is to control the motor speed, so the PWM wave that controls the motor speed is the final output of the software system.
The main functions of the software system are to receive and analyze remote control data, read the angular velocity and acceleration data in the attitude sensor and perform data fusion, and the cascade PID algorithm combines the parsed target angle received from the remote control and the current angle after data fusion. Get the PWM wave needed to control the motor.
1. Realization of attitude calculation
The attitude calculation is the core of whether the aircraft can be controlled normally. Its main function is to convert the target attitude (Eulerian angle) obtained from the remote control and the angular velocity and acceleration obtained from the attitude sensor into actual Euler through complementary filtering and quaternion algorithm. Angle, the target value and the final result of the actual calculation are provided to the PID controller, and finally the output value of the motor PWM is obtained. The calculation steps are shown in Figure 3.
2. PID control algorithm
The control algorithm of the quadcopter adopts PID controller as the control algorithm of the system. The PID controller has simple principles, good robustness, wide application range, and easy adjustment of parameters. PID control algorithm is widely used in the field of automation control, and its principle is shown in Figure 4.
Proportional control: It can quickly respond to errors. Once the deviation occurs, the controller will immediately take control to reduce the error. However, the proportional control cannot eliminate the increase in steady-state error KP, which will cause system instability.
Integral control: mainly used to eliminate static error and improve the system's error-free degree. As long as there is an error in the system, the integral controller will continue to accumulate and output the control quantity to eliminate the error. Therefore, as long as there is enough time, the integral control will completely eliminate the error. If the integral action is too strong, the system overshoot will increase, or even The system oscillates.
Differential link: It can reflect the change trend of the deviation signal, and can introduce an effective early correction signal into the system before the deviation signal value becomes too large, which can speed up the dynamic response of the system, reduce the adjustment time, and at the same time reduce Small overshoot, restrain from shaking, thereby improving system performance.
Because the power system of the quadcopter is a non-linear control system, the traditional PID algorithm is not only troublesome for parameter modulation, but also difficult to control. So what this design system adopts is cascade PID control, the output of the first stage is regarded as the input of the second stage. The outer ring adopts an angle ring, and the inner ring adopts an angular velocity ring. The cascade PID algorithm can be used to control the stability of the entire system.