Lightweight quadcopter and control method thereof
By combining lightweight design and dual-loop PID algorithm with high-precision sensors, the problems of altitude hold and hovering of quadcopter drones have been solved, achieving high-precision control and safety protection, and improving the maneuverability and crash resistance of drones.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANHUI UNIV
- Filing Date
- 2025-07-10
- Publication Date
- 2026-05-08
AI Technical Summary
Existing quadcopter drones cannot achieve high-precision hovering when altitude is not precise and GPS signal is poor. Furthermore, traditional control solutions are costly, have poor maneuverability, and are prone to damage.
Employing a lightweight design, it utilizes the STM32F1 series main control chip, dual-loop PID algorithm, and safety protection algorithm, combined with the MPU6050 attitude sensor, optical flow sensor, and laser sensor, to achieve precise control of the UAV's attitude, altitude, and position, and to perform a smooth forced landing in the event of signal loss.
It achieves high-precision position and altitude control and optical flow positioning, improving the drone's crash resistance and cost-effectiveness, reducing production costs, and enhancing maneuverability and safety.
Smart Images

Figure CN120803009B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic control technology for aircraft, and in particular to a lightweight quadcopter unmanned aerial vehicle and its control method. Background Technology
[0002] With the widespread application of quadcopter drones in daily life, the control methods of quadcopter aircraft have attracted significant attention in the field of scientific research. Most research institutions and universities directly purchase ready-made quadcopter drone platforms for related experiments, without focusing on the underlying control methods and hardware of these platforms. However, most of the control performance characteristics of drones, such as anti-interference capabilities and positioning accuracy, are determined by the underlying flight control system. Research into the underlying flight control system of drones is of great significance for improving their various performance aspects.
[0003] Currently, drones still face the following technical bottlenecks in altitude and point-to-point control: Traditional altitude-holding control technology has limitations. Existing drones typically use barometers for altitude measurement, but barometers are easily affected by ambient temperature and airflow disturbances, resulting in large altitude-holding errors (usually ±1m or more), which cannot meet the requirements of high-precision applications (such as indoor flight and precise take-off and landing). Outdoor drones mainly rely on GPS positioning, but this is completely ineffective indoors or in environments without GPS signals (such as warehouses or tunnels). In addition, most mainstream control solutions for consumer-grade drones on the market currently use STM32F4 series chips, which are expensive, and the drones themselves are heavy and have low maneuverability, making them extremely vulnerable to damage in a crash. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a lightweight quadcopter drone and its control method, solving the problems of insufficient altitude hold accuracy and inability to achieve fixed-point hovering when GPS signal is poor.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a control method for a lightweight quadcopter drone, the control method including drone attitude control, drone altitude control, and drone position positioning control, comprising the following steps:
[0006] The attitude angle and angular velocity data of the UAV are acquired, and a dual-loop PID algorithm is used to control the attitude of the UAV based on the attitude angle and angular velocity data.
[0007] The system acquires the drone's altitude and velocity data in the altitude direction, and uses a dual-loop PID algorithm to control the drone's altitude based on the altitude and velocity data in the altitude direction.
[0008] The speed data of the UAV in the X-axis and Y-axis directions are acquired, and a single-loop PID algorithm is used to perform closed-loop control on the speed data in the X-axis and Y-axis directions respectively to realize the position fixed-point control of the UAV.
[0009] After achieving control over the drone's attitude, altitude, and position, a protection mechanism is executed based on the drone's signal status using a safety protection algorithm.
[0010] In order to reduce the production cost of drones while improving their crash resistance and maneuverability, this invention is of great significance in developing a lightweight drone based on the lower-priced STM32F1 series main control chip, which can achieve good control performance, maneuverability and safety protection functions.
[0011] Furthermore, the hardware of this invention adopts a lightweight design. A small coreless brushless motor is used as the drive module, and an STM32F103 is used as the main control chip. The flight control PCB adopts a lightweight component design and layout. Combined with a dual-loop PID control algorithm and a drone safety protection algorithm, the drone can be guaranteed to be lightweight, highly maneuverable, and crash-resistant.
[0012] Furthermore, the specific process for achieving attitude control of the UAV includes:
[0013] Acquire four key data points q of the drone through attitude sensor x q y q z q w And based on the four data elements q x q y q z q w Rotating the reference gravity vector to the body coordinate system yields the gravity components along each axis in the body coordinate system, representing the UAV's angular velocity data. The quaternion rotation formula is as follows:
[0014] v x =2(q) x q z -q w q y )
[0015] v y =2(q) w q x +q y q z )
[0016]
[0017] In the formula, v x v y v zThese represent the gravity components projected onto the body coordinate system along each axis.
[0018] The Euler angles, used to characterize the UAV's attitude angles, are calculated based on the formula, quaternion data, and gravity components of each axis. The Euler angle calculation formula is as follows:
[0019] Yaw = arctan(2q) x q y -2q w q z ,2q w 2 +2q x 2 -1)
[0020]
[0021] Roll = arctan(v) y ,v z )
[0022] In the formula, Yaw, Pitch, and Roll represent the yaw angle, pitch angle, and roll angle of the UAV, respectively.
[0023] Based on attitude angle data and angular velocity data, a dual-loop PID algorithm is used to control the UAV angle by using the attitude angle loop as the outer loop. The output of the outer loop is used as the expected input of the angular velocity loop, i.e., the inner loop. The output of the inner loop acts on the motor controller to achieve attitude control of the UAV.
[0024] Furthermore, the specific process for achieving drone altitude control includes:
[0025] An optical flow sensor is used as a laser rangefinder, and the current altitude data of the UAV is obtained through the laser rangefinder.
[0026] Differentiating the altitude data yields the velocity data along the altitude direction, and then applying a mean filter to obtain the final velocity data along the altitude direction. The specific mean filter formula is as follows:
[0027]
[0028] In the formula, v H Refers to the final velocity data in the vertical direction; v i The velocity data refers to the first i frames; n is the total number of frames for the velocity data.
[0029] Based on altitude data and velocity data in the altitude direction, a dual-loop PID control algorithm is used, with the altitude loop as the outer loop and the velocity loop as the inner loop. The output of the outer loop is used as the input of the inner loop, and the output of the inner loop is applied to the UAV's motor controller to achieve altitude control of the UAV.
[0030] Furthermore, the specific process for achieving precise location control of a drone includes:
[0031] An optical flow sensor was selected to acquire the drone's velocity data in the X and Y axes.
[0032] A single-loop PID control is used to perform closed-loop control on the speed data in the X and Y axes respectively. The desired speeds in both the X and Y axes are set to 0. The PID output is applied to the UAV's motor controller to achieve the UAV's position and point control.
[0033] Furthermore, the drone's position-fixing control employs single-loop PID control and undergoes parameter tuning, including:
[0034] First, set the desired speeds of the X and Y axes to 0. Adjust the proportional gain Kp parameter of the drone's X axis and observe the drone's offset in the X-axis direction. Continuously increase the proportional gain Kp parameter until the drone's position coordinates in the X-axis direction remain unchanged and a slight oscillation occurs.
[0035] Then adjust the differential gain Kd parameter until the UAV no longer oscillates in the X-axis direction and its position coordinates remain unchanged. The integral gain Ki parameter can be set to 0.
[0036] Finally, the Y-axis parameters should be the same as the X-axis parameters.
[0037] Furthermore, the control of the UAV's attitude and altitude employs dual-loop PID control with parameter tuning, including tuning of the attitude loop and altitude loop, namely:
[0038] First, debug the attitude loop, including:
[0039] Fix the drone on the test stand and first adjust the pitch angle. Give a small value to the proportional gain Kp, which is the outer loop pitch angle attitude loop, and then adjust the proportional gain Kp of the inner loop.
[0040] Continuously increase the proportional gain Kp of the inner loop until the pitch angle of the drone stabilizes and a slight oscillation occurs. Push the drone by hand, and the drone will resist drag and the pitch angle can quickly return to positive.
[0041] Then, the differential gain Kd parameter is adjusted to stop the UAV from oscillating, and the integral gain Ki parameter is adjusted to eliminate the steady-state error of the UAV's pitch angle.
[0042] Finally, by slightly adjusting the proportional gain Kd and integral gain Ki parameters of the outer loop, the UAV can achieve better stability and smaller steady-state error.
[0043] After adjusting the pitch angle, start adjusting the roll angle. The PID parameters for the roll angle should be the same as those for the pitch angle.
[0044] Finally, adjust the yaw angle. The adjustment method for the yaw angle is the same as that for the pitch angle.
[0045] Furthermore, the adjustment of the attitude loop followed by the adjustment of the altitude loop includes:
[0046] Calculate the takeoff throttle and set the initial throttle at the start of the UAV's PID control as the takeoff throttle;
[0047] First, give the proportional gain Kp parameter of the outer height loop a small value;
[0048] Observe the dynamic response of the UAV in the altitude direction and adjust the proportional gain Kp parameter in the inner loop PID parameters;
[0049] Adjusting the differential gain Kd parameter of the inner loop of the drone ensures the stability of the drone;
[0050] Adjusting the integral gain Ki parameter of the inner loop eliminates steady-state errors in UAV altitude;
[0051] Adjusting the proportional gain Kd and integral gain Ki parameters of the outer loop allows for better control of the drone.
[0052] Furthermore, in the process of implementing a protection mechanism based on the signal status of the UAV using a security protection algorithm, the specific steps include:
[0053] If the drone does not receive a signal from the remote controller for an extended period of time, the flag_Nosignal flag will be automatically set to 1; otherwise, it will be 0.
[0054] The timer interrupt function automatically checks this flag bit at regular intervals. If the flag bit is found to be 1, it is determined that the drone may have lost signal.
[0055] The timer interrupt function starts counting the variable Nosignal_cnt. If the count value is greater than 500, that is, the drone signal has been lost for more than a period of time, it is determined that the drone has lost its signal, and the drone enters the forced landing mode and executes protection measures.
[0056] If the flag_Nosignal flag is found to be 0 during the counting process, it is determined that the drone signal has been restored, and the Nosignal_cnt count value is cleared to 0.
[0057] Based on the above method, an emergency landing of a drone is achieved when the signal is lost. During the emergency landing, all expected angles of the attitude loop are set to 0, the drone is in a horizontal attitude, and the expected altitude data is gradually reduced to 0. The drone gradually descends in a horizontal attitude until it lands safely.
[0058] By employing the above technical solution, the present invention provides a lightweight quadcopter drone and its control method, which has at least the following beneficial effects:
[0059] 1. The control method proposed in this invention can achieve high-precision position and altitude control and UAV optical flow positioning. Simultaneously, a UAV safety protection algorithm is designed, which identifies the UAV's signal status and protects the UAV for a smooth landing after the remote control signal is lost.
[0060] 2. Through a safety protection algorithm, combined with a lightweight and low-cost airframe design, this invention enables the drone to achieve a high level of crash resistance and cost-effectiveness.
[0061] 3. The lightweight quadcopter UAV designed in this invention achieves excellent attitude control, laser altitude hold, and optical flow point hold through a dual-loop PID control algorithm combined with an MPU6050 attitude sensor, optical flow sensor, and laser sensor.
[0062] 4. This invention uses a brushed coreless motor as the drive motor, paired with the corresponding drive circuit of AO3400A, which can greatly reduce the weight of the drone and indirectly, greatly improve the drone's maneuverability.
[0063] 5. The lightweight quadcopter drone flight control hardware proposed in this invention has low cost and a drone safety protection algorithm, giving the drone high cost-effectiveness and safety. Attached Figure Description
[0064] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0065] Figure 1 This is a flowchart illustrating the attitude, altitude, and position-fixed-point control of the UAV in this invention;
[0066] Figure 2 This is a flowchart of the security protection algorithm in this invention;
[0067] Figure 3 This is a schematic diagram of the power supply circuit for the UAV in this invention;
[0068] Figure 4 This is a schematic diagram of the sensor and drive circuit of the UAV in this invention;
[0069] Figure 5 This is the circuit diagram of the minimum system board of the UAV in this invention;
[0070] Figure 6This is a 3D view of the PCB file of the UAV flight control board in this invention;
[0071] Figure 7 This is a schematic diagram of the power supply circuit for the remote control in this invention;
[0072] Figure 8 This is a schematic diagram of the remote sensing and button circuit of the remote controller in this invention;
[0073] Figure 9 This is a 3D view of the remote control PCB file in this invention;
[0074] Figure 10 The images shown are of the actual drone and remote controller used in this invention.
[0075] Figure 11 This is a structural diagram of the lightweight quadcopter drone of the present invention.
[0076] In the diagram: 1. Optical flow sensor; 2. Battery compartment; 3. Flight control circuit board; 4. Coreless motor. Detailed Implementation
[0077] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. This will allow for a full understanding of how the present application uses technical means to solve technical problems and achieve technical effects, and to facilitate its implementation.
[0078] The specific embodiments of this invention are described from both hardware and software perspectives. The hardware portion mainly includes the design of the circuit schematics for the drone and remote controller, as well as the design of the circuit board (PCB). The software portion mainly includes the drone's attitude, altitude, and optical flow positioning control algorithms, algorithm parameter debugging methods, and the drone's anti-loss safety assurance algorithm.
[0079] Example 1
[0080] This embodiment proposes a control method for a lightweight quadcopter drone, enabling high-precision position and altitude hold and optical flow-based point positioning. Simultaneously, a drone safety protection algorithm is designed, which identifies the drone's signal status and ensures a smooth landing upon detection of lost remote control signal. Figure 1 As shown, the control method includes the following steps:
[0081] The attitude angle and angular velocity data of the UAV are acquired, and a dual-loop PID algorithm is used to control the UAV's attitude based on the attitude angle and angular velocity data. The specific process for controlling the UAV's attitude includes:
[0082] Acquire four key data points q of the drone through attitude sensor x qy q z q w And based on the four data elements q x q y q z q w The reference gravity vector (i.e., the direction of gravity in the world coordinate system) is rotated into the body coordinate system to obtain the gravity components of each axis in the body coordinate system, which are used to characterize the angular velocity data of the UAV.
[0083] This embodiment selects the MPU6050 as the attitude sensor and acquires the angular velocity data of Euler angles calculated internally by the MPU6050 via the IIC communication bus as the angular velocity loop feedback data for the UAV. The MPU6050's built-in DMP is used in conjunction with the angular acceleration data and the acceleration data measured by the accelerometer, and Mahony complementary filtering is used to process the data. Finally, the quaternion data q of the UAV is calculated in real time. x q y q z q w The quaternion rotation formula is:
[0084] v x =2(q) x q z -q w q y )
[0085] v y =2(q) w q x +q y q z )
[0086]
[0087] In the formula, v x v y v z These represent the gravity components projected onto the body coordinate system along each axis.
[0088] The Euler angles, used to characterize the UAV's attitude angles, are calculated based on the formula, quaternion data, and gravity components of each axis. The Euler angle calculation formula is as follows:
[0089] Yaw = arctan(2q) x q y -2q w q z ,2q w 2 +2q x 2 -1)
[0090]
[0091] Roll = arctan(v) y ,v z )
[0092] In the formula, Yaw, Pitch, and Roll represent the yaw angle, pitch angle, and roll angle of the UAV, respectively.
[0093] Based on attitude angle data and angular velocity data, a dual-loop PID algorithm is used to control the UAV angle by using the attitude angle loop as the outer loop. The output of the outer loop is used as the expected input of the angular velocity loop, i.e., the inner loop. The output of the inner loop acts on the motor controller to achieve attitude control of the UAV.
[0094] The drone's altitude and velocity data in the vertical direction are acquired, and a dual-loop PID algorithm is used to control the drone's altitude based on these data. This embodiment uses a laser sensor to acquire the drone's altitude and velocity data in the vertical direction, and combines this with a corresponding altitude control algorithm to achieve altitude hold. The specific process for controlling the drone's altitude includes:
[0095] An optical flow sensor is used as the laser rangefinder, and the current altitude data of the UAV is obtained through the laser rangefinder. In this embodiment, an optical flow sensor of model MTF-01P manufactured by MicroSpace Technology Co., Ltd. is used as the laser rangefinder. This sensor has a built-in laser rangefinder module that can achieve laser rangefinder measurement within a range of 0.01m to 12m. The rangefinder data is transmitted to an STM32F103 microcontroller via serial communication. The STM32F130 microcontroller parses the serial data according to the Micolink protocol to obtain the final altitude data.
[0096] Differentiating the altitude data yields the velocity data along the altitude direction, and then applying a mean filter to obtain the final velocity data along the altitude direction. The specific mean filter formula is as follows:
[0097]
[0098] In the formula, v H Refers to the final velocity data in the vertical direction; v i The velocity data refers to the first i frames; n is the total number of frames for the velocity data.
[0099] Based on altitude data and velocity data in the altitude direction, a dual-loop PID control algorithm is used, with the altitude loop as the outer loop and the velocity loop as the inner loop. The output of the outer loop is used as the input of the inner loop, and the output of the inner loop is applied to the UAV's motor controller to achieve altitude control of the UAV.
[0100] Since the transfer function of a drone's altitude with respect to its propeller speed is purely inertial, single-loop PID control is insufficient for effective altitude control. An inner velocity loop is necessary to ensure optimal altitude control. To achieve high-precision altitude control, this invention employs an optical flow sensor as a laser rangefinder instead of a barometer. Laser rangefinders offer significantly higher accuracy than barometers, achieving a ranging accuracy of up to 4cm. Combined with a dual-loop PID algorithm—with the altitude loop as the outer loop and the velocity loop as the inner loop—adjusting the PID parameters ultimately stabilizes the drone's altitude control steady-state error within 5cm.
[0101] The drone's velocity data in the X and Y axes is acquired, and a PID algorithm is applied to the velocity data in both directions for closed-loop control to achieve position-to-point control of the drone. The specific process for achieving position-to-point control of the drone includes:
[0102] An optical flow sensor is selected to acquire the drone's velocity data in the X and Y axes. This embodiment uses an MTF-01P optical flow sensor, which contains an optical flow camera module. The drone's velocity data in the X and Y axes is calculated by comparing the displacement between pixels in images captured at different times. The data is transmitted to an STM32F103 microcontroller via serial communication. The STM32F130 microcontroller parses the serial data according to the Micolink protocol to obtain the final optical flow data.
[0103] A single-loop PID control is used to perform closed-loop control on the velocity data in the X and Y axes, respectively. The desired velocities in both the X and Y axes are set to 0. The PID output is applied to the UAV's motor controller to achieve position-keeping control. This embodiment controls the UAV's velocity in the X and Y axes by selecting an appropriate control algorithm. When the desired velocities in the X and Y axes are set to 0, the UAV's position-keeping function can be achieved.
[0104] In this embodiment, optical flow positioning control employs single-loop PID control. The optical flow sensor calculates the UAV's velocity in the X and Y axes by comparing the displacements between pixels in images captured at different times. Using a PID closed-loop control algorithm, the PID output serves as the input for the desired attitude control angle, thus enabling velocity control of the UAV in the X and Y axes. When the desired velocities in both the X and Y axes are set to 0, the UAV achieves optical flow positioning.
[0105] After achieving the control of the UAV's attitude, altitude, and position, this embodiment requires parameter tuning for the corresponding dual-loop PID control and single-loop PID control. During the tethered experiment, the UAV's system parameters are tuned based on its flight attitude, including but not limited to attitude loop PID parameters, altitude loop PID parameters, and optical flow velocity loop PID parameters.
[0106] For single-loop PID control, parameter tuning is relatively simple. First, set the desired speeds on both the X and Y axes to 0. Adjust the proportional gain Kp parameter on the X-axis of the drone and observe the drone's offset in the X-axis direction. Continuously increase the proportional gain Kp parameter until the drone's position coordinates in the X-axis direction remain constant and exhibit slight oscillations. Then, adjust the derivative gain Kd parameter until the drone no longer oscillates in the X-axis direction and its position coordinates remain constant. Set the integral gain Ki parameter to 0. Finally, set the Y-axis parameters to be the same as the X-axis parameters.
[0107] For dual-loop PID control of attitude and altitude loops, first adjust the attitude loop. Fix the UAV on the test stand and adjust the pitch angle parameter first. Give the proportional gain Kp of the outer loop (the attitude loop for pitch angle) a small value, then adjust the proportional gain Kp of the inner loop, continuously increasing the proportional gain Kp of the inner loop until the UAV's pitch angle stabilizes and exhibits slight oscillations. When pushing the UAV by hand, the UAV should have significant resistance to drag and the pitch angle should quickly return to positive. Then adjust the derivative gain Kd parameter to stop the UAV from oscillating. At this point, the UAV's pitch angle will have a certain steady-state error. Adjust the integral gain Ki parameter to eliminate the steady-state error of the UAV's pitch angle. Finally, slightly adjust the proportional gain Kd and integral gain Ki parameters of the outer loop to give the UAV better stability and a smaller steady-state error. After adjusting the pitch angle, start adjusting the roll angle. The PID parameter for the roll angle can be set to be the same as that for the pitch angle. Finally, adjust the yaw angle, adjusting the yaw angle parameter in the same way as the pitch angle.
[0108] In this embodiment, after the attitude loop is debugged, the PID parameter debugging steps for the altitude loop are as follows:
[0109] Calculate the takeoff throttle and set the initial throttle at the start of the UAV PID control as the takeoff throttle; first, give a small value to the proportional gain Kp parameter of the outer loop altitude control; observe the dynamic response of the UAV in the altitude direction and adjust the proportional gain Kp parameter in the inner loop PID control; adjust the derivative gain Kd parameter of the inner loop of the UAV to ensure the stability of the UAV; adjust the integral gain Ki parameter of the inner loop to eliminate the steady-state error of the UAV altitude; adjust the proportional gain Kd and integral gain Ki parameters of the outer loop to achieve better control performance for the UAV.
[0110] S4. After achieving drone attitude control, drone altitude control, and drone position positioning control, a safety protection algorithm is used to execute a protection mechanism based on the drone's signal status. Since the drone's working environment is in the air and the remote controller's communication distance is limited, a drone safety protection algorithm is needed to ensure that the drone does not get lost or crash. When the algorithm detects a loss of drone signal, it will execute a protection mechanism to allow the drone to land smoothly.
[0111] After implementing the control functions of the drone, a safety protection algorithm for the drone needs to be designed. The flowchart of the drone's safety protection algorithm is as follows: Figure 2 As shown. If the drone does not receive a remote control signal for an extended period, the `flag_Nosignal` flag will automatically be set to 1; otherwise, it will be 0. The timer interrupt function automatically checks this flag at regular intervals. If the flag is found to be 1, it indicates a possible signal loss. The timer interrupt function starts counting the variable `Nosignal_cnt`. If the count value is greater than 500, indicating that the drone signal loss has exceeded a certain period, it is determined that the drone has indeed lost signal, and the drone enters emergency landing mode and implements protective measures. If the `flag_Nosignal` flag is found to be 0 during the counting process, it is determined that the drone signal has recovered, and the `Nosignal_cnt` count value is cleared to 0. Using this method, the drone can make an emergency landing in case of signal loss. During emergency landing, all desired angles in the attitude loop are set to 0, the drone adopts a horizontal attitude, and the desired altitude data gradually decreases to 0. The drone will gradually descend in a horizontal attitude until a safe landing. Through safety protection algorithms, combined with a lightweight and low-cost airframe, the drone achieves a high level of crash resistance and cost-effectiveness.
[0112] In summary, this invention proposes a lightweight quadrotor UAV with high-precision altitude hold and optical flow positioning capabilities, achieved through the design of hardware circuits, UAV control algorithms, and safety protection algorithms. A schematic diagram of the UAV's structure is shown below. Figure 11 As shown, the components include an MTF-01P optical flow sensor 1, a battery compartment 2, a flight control circuit board for the drone 3, and a coreless motor 4 (model 8520). Experimental testing demonstrated that the drone exhibits stable and reliable flight performance. Comprehensive technical parameters are shown in Table 1.
[0113] Table 1 Parameters of Quadrotor UAV
[0114]
[0115]
[0116] This invention, combined with a high-precision optical flow ranging sensor and a dual-loop PID control algorithm, enables high-precision position and altitude determination and optical flow-based point positioning for UAVs. Simultaneously, a UAV safety protection algorithm is designed to identify the UAV's signal status and ensure a smooth landing upon detection of lost remote control signals.
[0117] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0118] Example 2
[0119] Based on the control method proposed in Example 1, this example provides the hardware components of a lightweight quadcopter drone. The hardware components mainly include the design of the circuit schematics for the drone and the remote controller, as well as the design of the circuit board (PCB). Details are as follows:
[0120] Figure 3 This is the power supply circuit for the drone. The upper part of this circuit is a 5V to 3.3V step-down regulator circuit. This part of the circuit uses the AMS1117 chip as the voltage regulator. The AMS1117 is a commonly used low-dropout linear regulator chip designed by AMS Corporation. It is mainly used to convert higher input voltages into stable low-voltage outputs and is widely used in the power management circuits of electronic devices. The 0.1uF and 10uF filter capacitors in the diagram are used to filter out noise in the input and output voltages, ensuring the stability of the input and output voltages. The 0.1uF capacitor mainly suppresses high-frequency disturbances and absorbs switching noise. The 10uF capacitor suppresses low-frequency disturbances.
[0121] The lower part of this power supply circuit is a synchronous boost circuit. Its main function is to boost the lithium battery's supply voltage (3.7V~4.2V) to 5V, thereby powering the 5V-powered sensor devices in the flight control hardware. Additionally, this part of the circuit isolates the lithium battery power supply from the main control circuit, preventing direct damage to the main control chip in the main control circuit if the lithium battery power supply fails, such as a short circuit. The boost chip used in this circuit is the PW5100. The PW5100 is a high-efficiency, low-power synchronous boost DC-DC converter chip manufactured by Wuxi Pingxin Micro Semiconductor Technology Co., Ltd., with a power conversion efficiency of up to 95%. According to the official chip datasheet, the peripheral circuitry paired with this chip is as follows... Figure 1The 10uH inductor and 22uF output capacitor in the lower part of the circuit can boost the lithium battery supply voltage and stabilize it at 5V.
[0122] Figure 4 This section describes the sensor and drive circuitry for the drone. It includes the MPU6050 attitude sensor circuit, the HC06 Bluetooth module circuit, and the drive circuitry. Capacitors C6, C7, and C8 in the MPU6050 attitude sensor circuit filter out noise interference from the input power supply, ensuring a stable power supply voltage for the MPU6050 chip. R9 and R10 are pull-up resistors for the IIC communication pins SDA and SCL. These pull-up resistors pull SDA and SCL to a high level through an external power supply (such as VCC) when the bus is idle (no device drive), preventing the bus from being in a high-impedance state (unknown state).
[0123] The HC06 Bluetooth module circuit consists of the HC06 Bluetooth chip and corresponding peripheral circuits. The HC-06 Bluetooth module is a serial port transparent wireless communication module based on the Bluetooth 2.0+EDR standard, widely used in short-range data transmission scenarios, especially suitable for embedded systems and microcontroller projects. Its theoretical communication distance is 10m, and its operating voltage is 3.3V~6V. It uses a serial communication protocol, communicating through two serial port pins, RX and TX. The RX and TX pins are connected to the PA9 and PA10 pins of the microcontroller, respectively. LED2 is a Bluetooth indicator light used to reflect the Bluetooth working status. A solid light indicates a successful Bluetooth connection, while a flashing light indicates the Bluetooth module is waiting for a connection.
[0124] The drive circuit consists of an AO3400A driver chip, a Schottky diode IN5819, and corresponding peripheral circuitry. The AO3400A is an N-channel MOSFET with a continuous drain current of 5.8A and a threshold voltage of 1.4V–2.2V, sufficient to meet the drive requirements of the 8520 brushed coreless motor. The resistors in the circuit divide and limit the 3.3V input voltage to the control pin, ensuring that the MOSFET's gate voltage meets the threshold voltage condition when the control pin is high, thus guaranteeing MOSFET conduction. The IN5819 prevents the induced current generated by motor reversal from burning out the MOSFET.
[0125] After determining the power supply, sensors, and drive circuits for the drone, the minimum system board circuit also needs to be determined. Because the STM32F103 microcontroller chip cannot run directly, it requires peripheral circuits such as a crystal oscillator circuit, reset circuit, and download circuit to support its operation. The schematic diagram of the drone's minimum system board circuit is shown below. Figure 5As shown in the diagram, the microcontroller used is the STM32F103, which has a 72MHz main frequency and includes many peripheral resources such as timers, serial ports, IIC communication, and GPIO. The chip price is less than 10 yuan, making it significantly cheaper than the STM32F4 series chips. The reset circuit in the diagram utilizes the charging and cutting-off properties of a capacitor to achieve button reset and power-on reset functions. The crystal oscillator circuit uses an 8MHz quartz crystal as the crystal element to provide the crystal signal. U11 and U12 are oscillation capacitors used for resonance matching, phase compensation, amplitude limiting, and noise suppression. The download circuit uses the SW wiring method, utilizing SWIO as the data transmission pin and SWCLK as the clock signal pin, thus enabling the microcontroller to download programs via the ST-Link programmer.
[0126] After completing all the circuit schematic design work for the drone flight controller board, EDA software is used to draw the schematic. After the schematic is drawn, a DRC (Digital Control Registry) check is performed. If the DRC check is successful, the schematic is converted to a PCB. Further steps involve board outline design, component placement, component routing, and copper pouring on the PCB. Again, after the DRC check passes, the final 3D view of the drone flight controller board PCB file is obtained, as shown below. Figure 6 As shown.
[0127] It is important to note and emphasize that due to the high current characteristics of the coreless motor, the power supply current of the drone can reach 8A during operation. Therefore, the power supply traces need to be sufficiently wide during PCB routing. However, conventional routing methods cannot support such large trace widths. Therefore, copper pouring is used for the power supply traces. The power supply trace network is separately copper-poured and set to a 90° grid fill pattern. This ensures the high current can pass through the power supply traces, while the 90° grid copper pour also provides good heat dissipation and resistance to thermal deformation for the circuit board.
[0128] After the drone flight control circuit board is designed, the remote control circuit board needs to be designed. Figure 7This is the schematic diagram of the power supply circuit for the remote control. The power supply circuit mainly consists of a linear regulator RT9013 and its peripheral circuitry. The RT9013 is a high-performance, low-dropout linear regulator from Richtek Technology, with an input voltage range of 2.2V to 5.5V, allowing the lithium battery power supply voltage to be used directly as the input voltage. Its output voltage can be selected from 1.8V, 2.3V, and 3.3V, and its rated output current is 500mA, sufficient to meet the power supply current requirements of the remote control circuit. LED1 is a power indicator light used to display the power supply status. SW13 is a circuit switch used to control the input power voltage. This circuit can stabilize the lithium battery power supply voltage (3.7V to 4.2V) at 3.3V, thereby powering other circuits in the remote control.
[0129] Figure 8 This is the remote control's sensing and button circuit. Its main function is to provide joystick and function signals to operate the drone and achieve corresponding functions. The sensing circuit mainly consists of two potentiometers, REM1 and REM2. REM1 is a throttle potentiometer, providing the drone's throttle and desired yaw angle signals. REM2 is a direction potentiometer, providing the drone's pitch and roll angle signals. The potentiometer's output pins are connected to PA0-PA3 pins of the STM32 microcontroller. The microcontroller uses an A / D converter to convert the potentiometer's analog signals into digital signals for processing. The button circuit consists of 10 button modules (SW1-SW10). The microcontroller detects whether a button is pressed to implement different button functions for the drone. These include adjusting PID parameters, fine-tuning the drone's attitude, and fine-tuning the hover throttle. The button circuit greatly facilitates the later debugging of the drone's PID parameters, allowing for remote wireless parameter adjustment via the remote control, instead of repeatedly burning the program.
[0130] The minimum system circuit of the remote controller is the same as that of the drone flight control system, consisting of an STM32F103 microcontroller and corresponding reset and crystal oscillator circuits. After completing the design of the remote controller circuit schematic, EDA software is used to draw the schematic. After drawing the schematic, a DRC (Digital Control Registry) check is performed. If the DRC check is successful, the schematic is converted to a PCB layout. Further steps involve board outline design, component placement, component routing, and copper pouring on the PCB. Similarly, after the DRC check passes, the final 3D view of the remote controller PCB file is obtained, as shown below. Figure 9 As shown in the image. Finally, the necessary components were purchased and soldered onto the drone's flight control board and remote controller circuit board. After soldering, the drone motors, shell, and flight control board were assembled, resulting in the final drone and remote controller images, as shown in the image. Figure 10As shown in the image. Measurements show that the drone, including the battery, weighs only about 85g, achieving the lightweight design goal.
[0131] This invention employs a brushed coreless motor as the drive motor, coupled with an AO3400A-based MOSFET drive circuit and a lightweight flight controller PCB design, significantly reducing the weight of the drone. Combined with a high-precision optical flow ranging sensor and a dual-loop PID control algorithm, it achieves high-precision position and altitude hold and optical flow positioning for the drone. Furthermore, a drone safety protection algorithm is designed to identify the drone's signal status and ensure a smooth landing upon detection of lost remote control signal.
[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. Since the above embodiments are substantially similar to the method embodiments, they are described relatively simply; relevant parts can be referred to the descriptions of the method embodiments.
[0133] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A control method for a lightweight quadcopter unmanned aerial vehicle, characterized in that, The control method includes drone attitude control, drone altitude control, and drone position positioning control, and includes the following steps: The attitude angle and angular velocity data of the UAV are acquired, and a dual-loop PID algorithm is used to control the attitude of the UAV based on the attitude angle and angular velocity data. The system acquires the drone's altitude and velocity data in the altitude direction, and uses a dual-loop PID algorithm to control the drone's altitude based on the altitude and velocity data in the altitude direction. The speed data of the UAV in the X-axis and Y-axis directions are acquired, and a single-loop PID algorithm is used to perform closed-loop control on the speed data in the X-axis and Y-axis directions respectively to realize the position fixed-point control of the UAV. After achieving control of the drone's attitude, altitude, and position, a protection mechanism is executed based on the drone's signal status according to the safety protection algorithm. The control of the UAV's attitude and altitude adopts dual-loop PID control with parameter tuning, including tuning of the attitude loop and altitude loop, namely: First, debug the attitude loop, including: Fix the drone on the test stand and first adjust the pitch angle. Give the proportional gain Kp, which is the outer pitch angle attitude loop, a minimum value, and then adjust the proportional gain Kp of the inner loop. Continuously increase the proportional gain Kp of the inner loop until the pitch angle of the drone stabilizes and a slight oscillation occurs. Push the drone by hand, and the drone will resist drag and the pitch angle can quickly return to positive. Then, the differential gain Kd parameter is adjusted to stop the UAV from oscillating, and the integral gain Ki parameter is adjusted to eliminate the steady-state error of the UAV's pitch angle. Finally, by slightly adjusting the proportional gain Kd and integral gain Ki parameters of the outer loop, the UAV can achieve better stability and smaller steady-state error. After adjusting the pitch angle, start adjusting the roll angle. The PID parameters for the roll angle should be the same as those for the pitch angle. Finally, adjust the yaw angle. The adjustment method for the yaw angle is the same as that for the pitch angle. The adjustment of the attitude loop followed by the adjustment of the altitude loop includes: Calculate the takeoff throttle and set the initial throttle at the start of the UAV's PID control as the takeoff throttle; First, set a minimum value for the proportional gain Kp parameter of the outer height loop; Observe the dynamic response of the UAV in the altitude direction and adjust the proportional gain Kp parameter in the inner loop PID parameters; Adjusting the differential gain Kd parameter of the inner loop of the drone ensures the stability of the drone; Adjusting the integral gain Ki parameter of the inner loop eliminates steady-state errors in UAV altitude; Adjusting the proportional gain Kd and integral gain Ki parameters of the outer loop allows for better control of the drone.
2. The control method according to claim 1, characterized in that, The specific process for controlling the attitude of a drone includes: Acquire four key data points of the drone through attitude sensor and based on four data elements Rotating the reference gravity vector to the body coordinate system yields the gravity components along each axis in the body coordinate system, representing the UAV's angular velocity data. The quaternion rotation formula is as follows: ; In the formula, These represent the gravity components projected onto the body coordinate system along each axis. The Euler angles, used to characterize the UAV's attitude angles, are calculated based on the formula, quaternion data, and gravity components of each axis. The Euler angle calculation formula is as follows: ; In the formula, These represent the yaw angle, pitch angle, and roll angle of the drone, respectively. Based on attitude angle data and angular velocity data, a dual-loop PID algorithm is used to control the UAV angle by using the attitude angle loop as the outer loop. The output of the outer loop is used as the expected input of the angular velocity loop, i.e., the inner loop. The output of the inner loop acts on the motor controller to achieve attitude control of the UAV.
3. The control method according to claim 1, characterized in that, The specific process for controlling the altitude of a drone includes: An optical flow sensor is used as a laser rangefinder, and the current altitude data of the UAV is obtained through the laser rangefinder. Differentiating the altitude data yields the velocity data along the altitude direction, and then applying a mean filter to obtain the final velocity data along the altitude direction. The specific mean filter formula is as follows: ; In the formula, This refers to the final velocity data in the vertical direction; finger front Shooting speed data; This is the total frame of speed data; Based on altitude data and velocity data in the altitude direction, a dual-loop PID control algorithm is used, with the altitude loop as the outer loop and the velocity loop as the inner loop. The output of the outer loop is used as the input of the inner loop, and the output of the inner loop is applied to the UAV's motor controller to achieve altitude control of the UAV.
4. The control method according to claim 1, characterized in that, The specific process for achieving precise location control of a drone includes: An optical flow sensor was selected to acquire the drone's velocity data in the X and Y axes. A single-loop PID control is used to perform closed-loop control on the speed data in the X and Y axes respectively. The desired speeds in both the X and Y axes are set to 0. The PID output is applied to the UAV's motor controller to achieve the UAV's position and point control.
5. The control method according to claim 1 or 4, characterized in that, The drone's position control employs single-loop PID control with parameter tuning, including: First, set the desired speeds of the X and Y axes to 0. Adjust the proportional gain Kp parameter of the drone's X axis and observe the drone's offset in the X-axis direction. Continuously increase the proportional gain Kp parameter until the drone's position coordinates in the X-axis direction remain unchanged and a slight oscillation occurs. Then adjust the differential gain Kd parameter until the UAV no longer oscillates in the X-axis direction and its position coordinates remain unchanged. The integral gain Ki parameter can be set to 0. Finally, the Y-axis parameters should be the same as the X-axis parameters.
6. The control method according to claim 1, characterized in that, In the process of implementing a protection mechanism based on the signal status of the drone using a security protection algorithm, the specific steps include: If the drone does not receive a signal from the remote controller for an extended period of time, the flag_Nosignal flag will be automatically set to 1; otherwise, it will be 0. The timer interrupt function automatically checks this flag bit at regular intervals. If the flag bit is found to be 1, it is determined that the drone may have lost signal. The timer interrupt function starts counting the variable Nosignal_cnt. If the count value is greater than 500, that is, the drone signal has been lost for more than a period of time, it is determined that the drone has lost its signal, and the drone enters the forced landing mode and executes protection measures. If the flag_Nosignal flag is found to be 0 during the counting process, it is determined that the drone signal has been restored, and the Nosignal_cnt count value is cleared to 0. Based on the above method, an emergency landing of a drone is achieved when the signal is lost. During the emergency landing, all expected angles of the attitude loop are set to 0, the drone is in a horizontal attitude, and the expected altitude data is gradually reduced to 0. The drone gradually descends in a horizontal attitude until it lands safely.
7. A lightweight quadcopter unmanned aerial vehicle, utilizing the control method described in any one of claims 1-6, characterized in that, The lightweight quadcopter drone is controlled in terms of attitude, altitude, and position. After the remote control signal of the drone is lost, it enters a forced landing mode and implements protective measures until it lands safely.