- Home >> Solution >> Electronics >> video games
Quadcopter Program
Quadcopters first entered the eyes of ordinary people, probably because of an interesting and inspirational movie. The small quadcopter in the film symbolized the hobbies and dreams of the young student. Later, the wave of open source hardware at home and abroad made the quadcopter a household name and a dazzling star. In fact, the history of quadcopters has been very long. As early as 1907, someone in France had already manufactured the first quadrotor helicopter. Because the balance control system was not used, the flight stability was very poor. In recent years, it has benefited from With the development of micro-electromechanical control technology, the stable quadcopter has received extensive attention, and its application prospects are very promising.
1. Introduction of quadcopter
Quadcopter is also called four-rotor UAV, four-rotor aircraft. Referred to as four-axis, four-rotor. A quadcopter is a multi-rotor aircraft. The four propellers of the quadcopter are simple mechanisms directly connected to the motors. The cross-shaped layout allows the aircraft to obtain the force of rotating the fuselage by changing the motor speed, thereby adjusting its own attitude. 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 aircraft that has a power plant and does not require professional operators. It uses the propeller to rotate to form an airflow to the ground to offset the mass of the fuselage, which can realize independent flight or remote control flight. Compared with fixed-wing drones, the development of rotary-wing unmanned aerial vehicles is relatively slow, because the control system of rotary-wing unmanned aerial vehicles is more complicated, and the early technology cannot meet the flight requirements. However, the gyroplane has the advantages of all aircraft and fixed-wing UAVs. It has low cost, simple structure, no limitation of large wings, autonomous take-off and descent functions, and low accident costs. Quadcopter is the simplest structure of multi-rotor aircraft. Due to its wide application prospect, it soon attracted the attention of many researchers, especially the control algorithm of UAV in universities mainly in the United States and other Western countries. A lot of achievements have been made in research and navigation. Based on the PID control algorithm in my country, certain achievements have been made in attitude control.
2. Structural components of quadcopter
Although quadcopters come in different sizes and shapes, the basic principles and structures are still very similar. The following are some common configurations.
1. Four-axis rack
The rack is a cross-shaped support structure. Micro-quadrons often directly use circuit boards as brackets. Some DIY masters will design and make light and simple brackets. If you don’t have the processing conditions, you can also buy various finished products directly on the Internet. The rack should preferably have elastic support legs to avoid damage to the motor during landing. In addition, if possible, add a frame to the propeller to prevent the blade from hurting people or being broken.
2. The motor and propeller of the quadcopter
In order to make the four-axis smaller and lighter, generally speaking, the miniature four-axis will choose a hollow cup motor, each weighing only a few grams. And the quartet-weight quadcopter that everyone plays aerial photography uses a brushless motor dedicated to model aircraft. These motors will be marked with parameters such as kV800 and kvl 000, indicating that the value of the motor idling speed will increase for every 1V increase in the input voltage. The model of the motor is generally a number such as 2212 or 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 a quadcopter for entry-level aerial photography, choose 2212 or a slightly larger motor.
In addition, when purchasing a motor, there is usually a recommended matching propeller. The propellers of the quadcopter are positive and negative propellers, which need to be purchased in pairs. The parameters of the paddle are similar to 1045, the first 2 digits represent the diameter of the paddle (linch=25.4mm) and the latter 2 digits are the angle of the paddle.
3. The electronic governor of the UAV
The electronic speed controller is called ESC for short, and it is used to control the speed of the motor. 4 motors need to be controlled by 4 ESCs. The traditional DC brushed motor is connected to two wires, the higher the voltage, the faster the rotation, and the reverse rotation of the power supply is reversed. The brushless motor generally has at least 3 wires, and the speed is controlled by the ESC to continuously switch the current. The signal controlled by the ESC is generally PWM, which is set by different duty cycle times. 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 more than 20 to 30A. In addition, when choosing an ESC, it is best to have a BEC output. In fact, it is a 5V voltage output, which can supply power to the microcontroller and sensors on the aircraft, reducing the complexity of the circuit.
4. Flight control
Flight control is a general term for sensors, microcontrollers, 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 navigation lights, GPS modules, etc. The hardware of the flight control board mainly includes gyroscopes, acceleration sensors and single-chip microcomputers. Among them, the gyro 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. The attitude angle measured by the acceleration sensor has a very large error. Although the gyroscope is accurate in measuring the angular velocity, it needs to integrate the angular velocity to obtain the attitude, and there will be a large cumulative error after a long 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 sensor (such as MPU6050) has a fusion algorithm.
5. Battery
A battery quadcopter requires the use of a lightweight, powerful power source. Polymer lithium-ion batteries are generally used. The main parameters of Li-po lithium battery include nominal voltage, battery capacity and discharge capacity. Taking 3S/2000mAh/25C as an example, the voltage of each unit of the lithium battery is about 3.7v. Generally, several lithium batteries are connected in series according to the needs.
6. The remote control of the four-axis drone
Remote control If you plan to control the micro quadcopter indoors, you can choose an entry-level remote control, and some quadcopters can also be controlled by Bluetooth mobile phones. If you plan to play aerial photography, then you need a professional model remote control. At present, there are many brands and types of remote controls, and the price ranges from a few hundred to several thousand. When choosing, please choose what you need. It is recommended to use a remote control with more than 4 channels. The more channels, the more functions that can be controlled. In addition, the model aircraft remote control is divided into "American hand" and "Japanese hand", corresponding to the left hand to control the throttle and the right hand to control the throttle respectively. Generally speaking, normal people are used to using the "American hand", and there are many remote controls that already support switching in the settings. The frequency is generally 2-4GHz, which is more mainstream and 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 thousand meters. But having said that, the attitude of the quadcopter is basically invisible 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, within a few hundred meters of the ground in urban areas, mobile phone signals are basically covered, so a mobile phone SIM card can be installed on the aircraft to 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 to the designated place after performing a mission.
3.The power principle of the quadcopter scheme
1. The flight mode of the quadcopter
The flight modes of the quadcopter mainly include the cross mode and the x-shaped mode, as shown in Figure 1.
The flying direction in the cross mode is consistent with 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. Since the cross mode can directly and clearly distinguish the functions of the four motors during the flight of the quadcopter, the manipulation is simple, but the movement flexibility is poor. The x-mode flight pattern is complicated, but the action is flexible. The design of the quadrotor aircraft in this project 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 air power. Like ordinary fans, when the propellers rotate, they will push the air forward or backward through their own streamlined structure (depending on the direction of rotation ). For a quadcopter, all four propellers need to push the air down to generate upward propulsion. For the air propeller, when the motor stops in the air, the propeller continues to rotate in the original direction like a windmill, and this phenomenon is called the spin of the propeller. According to the force analysis of the propeller, if a certain propeller rotates clockwise, the propeller will generate 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 four motors will turn in the same direction, and the rotational torque generated by the propellers driven by the motors will move in the same direction, and the four-axis will start to rotate crazily. Therefore, in order to counteract the spin of the propeller, a pair of adjacent propellers of the quadcopter should be turned in opposite directions, so that the reaction forces produced by the pair of propellers can cancel each other out.
The quadcopter itself is an underactuated system. When the speeds generated by the four motors are equal and the lift is equal to the weight of the quadcopter itself, the quadcopter will be in a hovering state. When the aircraft is in the hovering state, there can be a combination of degrees of freedom in 6 directions, namely pitch (forward and backward movement), roll (left and right movement), and lift (up and down movement).
4. Hardware design of 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 supply module mainly provides power supply for 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 (directly output from the battery) is mainly to supply power to the motor.
Among them, the communication part is mainly four channel signals from the remote control. Pitch, roll, spin and throttle commands respectively; the sensor module is used as the attitude detection part of the aircraft, and the detected angular velocity and angular acceleration signals are converted into angles through the controller, and the angle signals are used as the current attitude of the aircraft, and the remote control part The signal comparison travel required for closed-loop control.
The main controller processes the remote control signal received by communication and the attitude signal collected by the sensor, performs fusion processing after data analysis, and finally obtains the control value of the motor through the PID algorithm, and the value is finally output in the form 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 quadcopter is for controlling the motor speed, so the PWM wave controlling the motor speed is the final output of the software system.
The main functions of the software system are to receive and analyze the 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 analyzed 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
Attitude resolution is the core of whether the aircraft can be controlled normally. Its main function is to convert the target attitude (Euler angle) obtained from the remote controller 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 solution steps are shown in Figure 3.
2. PID control algorithm
The control algorithm of the quadcopter adopts the PID controller as the control algorithm of the system. The PID controller has the characteristics of simple principle, good robustness, wide application range, and easy adjustment of parameters. The PID control algorithm is widely used in the field of automatic control, and its principle is shown in Figure 4.
Proportional control: It can quickly respond to errors. Once a deviation occurs, the controller will immediately take control to reduce the error, but the proportional control cannot eliminate the increase of the steady-state error KP, which will cause system instability.
Integral control: mainly used to eliminate the static error and improve the error-free degree of the system. As long as there is an error in the system, the integral controller will continue to accumulate and output the control value to eliminate the error. Therefore, as long as there is enough time, the integral control will be able to completely eliminate the error. If the integral function is too strong, the overshoot of the system will increase, or even The system is shaking.
Differentiation link: It can reflect the variation trend of the deviation signal, and can introduce an effective early correction signal into the system before the deviation signal value becomes too large, so as to speed up the dynamic response speed of the system, reduce the adjustment time, and at the same time reduce the Small overshoot, restrain vibration, thus improve system performance.
Because the power system of the quadcopter is a nonlinear control system, the traditional PID algorithm is not only troublesome in parameter modulation, but also difficult to control. So this design system adopts cascaded PID control, that is, the output of the first level is taken as the input of the second level. The outer ring uses an angle ring, the inner ring uses an angular velocity ring, and the cascaded PID algorithm can well control the stability of the entire system.
6. Summary
The above is the dynamic analysis of the quadrotor aircraft, the demand analysis and selection of each module of the hardware, and the interpretation and analysis of the overall framework of the software and the core algorithm introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. Among them, in the hardware design, the selection of each module, the circuit design and the shape of the board are the most error-prone.
If you have electronic function development needs for quadcopter drones and quadcopters, you can trust us. We have rich experience in custom development of electronic products, and can evaluate the development cycle and material price as soon as possible. We are a number of chip agents at home and abroad, including MCU, voice IC, Bluetooth IC and modules, wifi modules. Our development capabilities cover PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development and other hardware and software design. It can also undertake the research and development of smart electronic products, household appliances scheme design, beauty equipment development, Internet of Things application development, smart home scheme design, TWS scheme development, Bluetooth audio development, children's toy scheme development, and electronic education product development.
- TOP