In the realm of unmanned aerial vehicles (UAVs), the quadrotor drone has emerged as a pivotal platform due to its compact size, simple structure, and exceptional maneuverability. As a researcher and developer in this field, I have extensively studied the control challenges posed by quadrotor drones, which exhibit nonlinear, underactuated, and multivariable characteristics. Traditional single-loop PID control algorithms often fall short in addressing these complexities, leading to suboptimal performance in dynamic environments. In this article, I propose and detail an improved dual closed-loop attitude control system designed to enhance the flight stability and anti-jamming capability of quadrotor drones. Through hardware design, mathematical modeling, simulation, and real-world flight tests, I demonstrate the superiority of this approach over conventional methods. The focus is on leveraging advanced control strategies to optimize the quadrotor drone’s response, ensuring robust operation in applications ranging from aerial photography to search-and-rescue missions.
The quadrotor drone, with its six degrees of freedom and only four control inputs, represents a classic underactuated system. This inherent complexity necessitates precise control mechanisms to maintain stability during flight. My work begins with the design of a hardware system that integrates a high-performance microcontroller, inertial measurement units (IMUs), and motor drivers. The core of this system is the BLM103C8T6 microcontroller, based on the ARM Cortex-M3 architecture, which provides sufficient computational power for real-time data processing. The motor drive system utilizes four Hobbywing 20A brushless ESCs, controlled via PWM signals from the microcontroller to regulate rotor speeds. For attitude sensing, I employ the BMI160 IMU (combining a 3-axis accelerometer and 3-axis gyroscope) and the BMP280 barometric pressure sensor, enabling accurate estimation of the quadrotor drone’s orientation and altitude. The hardware framework ensures low-latency data acquisition and control, which is critical for implementing responsive dual closed-loop systems.

Attitude estimation is a fundamental aspect of quadrotor drone control. To compute the drone’s orientation in real-time, I adopt a quaternion-based PI complementary filter algorithm. This method fuses data from the gyroscope and accelerometer to mitigate the effects of sensor noise and drift. The quadrotor drone’s attitude is defined by roll ($\phi$), pitch ($\theta$), and yaw ($\psi$) angles, referenced between the body frame ($GXYZ$) and the geographic frame ($OXYZ$). The direction cosine matrix derived from quaternions relates these frames as follows:
$$ C_G^O = \begin{bmatrix} 1-2(q_2^2 + q_3^2) & 2(q_1q_2 – q_0q_3) & 2(q_1q_3 + q_0q_2) \\ 2(q_1q_2 + q_0q_3) & 1-2(q_1^2 + q_3^2) & 2(q_2q_3 – q_0q_1) \\ 2(q_1q_3 – q_0q_2) & 2(q_2q_3 + q_0q_1) & 1-2(q_1^2 + q_2^2) \end{bmatrix} $$
where $q_0, q_1, q_2, q_3$ are the quaternion components satisfying $q_0^2 + q_1^2 + q_2^2 + q_3^2 = 1$. The gravity vector in the body frame, derived from accelerometer readings ($a_x, a_y, a_z$), is compared with the estimated vector from gyroscope integration ($g_x, g_y, g_z$). The error is computed via the cross-product:
$$ \begin{bmatrix} e_x \\ e_y \\ e_z \end{bmatrix} = \begin{bmatrix} g_z a_y – g_y a_z \\ g_x a_z – g_z a_x \\ g_y a_x – g_x a_y \end{bmatrix} $$
This error is then used in a PI compensation scheme to correct gyroscope biases:
$$ \begin{bmatrix} R_x \\ R_y \\ R_z \end{bmatrix} = \begin{bmatrix} R_x + k_p e_x + k_i \sum_{i=1}^n e_x \\ R_y + k_p e_y + k_i \sum_{i=1}^n e_y \\ R_z + k_p e_z + k_i \sum_{i=1}^n e_z \end{bmatrix} $$
The quaternion is updated using the first-order Runge-Kutta method, and the Euler angles are extracted via inverse trigonometric functions. This approach ensures accurate and stable attitude estimation for the quadrotor drone, even in the presence of vibrations and environmental disturbances.
To design an effective control system, I establish a dynamic model of the quadrotor drone. Assuming the drone is a rigid body with symmetric mass distribution, the equations of motion are derived from Newton-Euler principles. The forces and torques generated by the four rotors are modeled, with each rotor producing a thrust $F_i$ and located at a distance $L$ from the center of mass. The control inputs are defined as:
$$ \begin{bmatrix} U_1 \\ U_2 \\ U_3 \\ U_4 \end{bmatrix} = \begin{bmatrix} F_1 + F_2 + F_3 + F_4 \\ F_4 – F_2 \\ F_3 – F_1 \\ F_1 – F_2 + F_3 – F_4 \end{bmatrix} $$
where $U_1$ controls vertical motion, $U_2$ and $U_3$ control roll and pitch, and $U_4$ controls yaw. The translational and rotational dynamics are expressed as:
$$ \begin{aligned} \ddot{x} &= \frac{U_1}{m} (\sin\phi \sin\psi + \cos\phi \cos\psi \sin\theta) \\ \ddot{y} &= \frac{U_1}{m} (-\sin\phi \cos\psi + \cos\phi \sin\psi \sin\theta) \\ \ddot{z} &= \frac{U_1 \cos\phi \cos\theta – mg}{m} \\ \ddot{\phi} &= \frac{L U_2}{I_x}, \quad \ddot{\theta} = \frac{L U_3}{I_y}, \quad \ddot{\psi} = \frac{L U_4}{I_z} \end{aligned} $$
Here, $m$ is the mass, $g$ is gravity, and $I_x, I_y, I_z$ are moments of inertia. For control design, I linearize the model around hover conditions and incorporate motor dynamics as a first-order lag. The combined transfer function for each channel of the quadrotor drone is:
$$ G(s) = \frac{k}{s(\tau s + 1)} \cdot \frac{1}{I} $$
where $k$ is the motor gain, $\tau$ is the time constant, and $I$ represents the respective moment of inertia. Based on the parameters of my quadrotor drone prototype, I derive specific transfer functions, as summarized in the table below.
| Channel | Transfer Function |
|---|---|
| Roll Angle ($\phi$) | $$ G_1(s) = \frac{66.2}{0.15s^2 + s} $$ |
| Pitch Angle ($\theta$) | $$ G_2(s) = \frac{66.2}{0.15s^2 + s} $$ |
| Yaw Angle ($\psi$) | $$ G_3(s) = \frac{33.3}{0.15s^2 + s} $$ |
| Roll Rate ($\dot{\phi}$) | $$ G_4(s) = \frac{66.2s}{0.15s^2 + s} $$ |
| Pitch Rate ($\dot{\theta}$) | $$ G_5(s) = \frac{66.2s}{0.15s^2 + s} $$ |
| Yaw Rate ($\dot{\psi}$) | $$ G_6(s) = \frac{33.3s}{0.15s^2 + s} $$ |
The parameters of my quadrotor drone are listed in the following table, which are essential for simulation and tuning.
| Parameter | Value |
|---|---|
| Mass ($m$) | 1.25 kg |
| Arm Length ($L$) | 0.225 m |
| Motor Gain ($k$) | 0.45 |
| Time Constant ($\tau$) | 0.15 s |
| Moment of Inertia ($I_x$) | 0.0068 kg·m² |
| Moment of Inertia ($I_y$) | 0.0068 kg·m² |
| Moment of Inertia ($I_z$) | 0.0135 kg·m² |
Building on this model, I develop a dual closed-loop control system for the quadrotor drone. This system features an outer loop for angle PID control and an inner loop for angular rate PID control. The inner loop rapidly compensates for disturbances and dynamics variations, while the outer loop ensures accurate attitude tracking. The block diagram of this dual closed-loop system is implemented in Simulink for simulation. Compared to a single-loop PID controller, the dual-loop approach reduces sensitivity to parameter variations and enhances robustness. The control law for each axis can be expressed as:
$$ U_{\text{outer}} = K_{p,\theta} e_\theta + K_{i,\theta} \int e_\theta \, dt + K_{d,\theta} \dot{e}_\theta $$
$$ U_{\text{inner}} = K_{p,\omega} e_\omega + K_{d,\omega} \dot{e}_\omega $$
where $e_\theta$ is the angle error, $e_\omega$ is the angular rate error, and $K$ terms are PID gains tuned for the quadrotor drone. This cascaded structure allows for independent optimization of response speed and stability.
To validate the dual closed-loop system, I conduct comparative simulations in MATLAB/Simulink. The step response and step disturbance rejection are evaluated for both single-loop and dual-loop controllers. For a step input at $t=0$, the dual closed-loop system exhibits faster rise time, lower overshoot, and shorter settling time. For instance, the roll angle response shows a significant improvement: the dual-loop controller reduces overshoot by approximately 30% compared to the single-loop controller. When a step disturbance of magnitude 1 is applied at $t=0.7$ s, the dual closed-loop quadrotor drone recovers to the setpoint within 0.2 s, whereas the single-loop system takes over 0.5 s with larger oscillations. These simulations underscore the enhanced anti-jamming capability of the dual closed-loop approach, making the quadrotor drone more resilient to external perturbations such as wind gusts or payload shifts.
The software implementation for the quadrotor drone is designed around a real-time operating system on the BLM103C8T6 microcontroller. The control algorithm executes at 500 Hz, ensuring timely updates of attitude estimates and control signals. The workflow includes initialization of peripherals, sensor calibration, and a main loop that reads IMU data, computes attitude via the complementary filter, and executes the dual closed-loop PID control. The output PWM signals are generated to drive the ESCs, adjusting rotor speeds to achieve desired attitudes. For flight testing, I deploy the control software on a custom-built quadrotor drone frame equipped with the described hardware. Comparative flights are conducted using both single-loop and dual-loop controllers under identical conditions. Data logged during hover maneuvers reveal that the dual closed-loop system maintains attitude errors within ±0.5 degrees, while the single-loop system exhibits errors up to ±2 degrees. The quadrotor drone with dual closed-loop control also demonstrates smoother trajectory tracking and better resistance to manual disturbances during flight.
In conclusion, the dual closed-loop attitude control system represents a significant advancement for quadrotor drone stability and performance. Through rigorous modeling, simulation, and experimental validation, I have shown that this system outperforms traditional single-loop PID control in terms of response speed, accuracy, and anti-jamming ability. The integration of an inner angular rate loop effectively decouples the dynamics, allowing for more robust operation in unpredictable environments. Future work may explore adaptive tuning of PID gains or the incorporation of advanced control techniques like model predictive control for further enhancement. As quadrotor drones continue to evolve for diverse applications, the dual closed-loop framework provides a reliable foundation for achieving precise and stable flight, ultimately expanding the capabilities of these versatile aerial platforms.
The success of this control strategy hinges on meticulous parameter tuning and hardware integration. For practitioners, I recommend iterative tuning starting from the inner loop to ensure fast rate stabilization before optimizing the outer loop for attitude accuracy. Additionally, sensor fusion algorithms should be calibrated to minimize noise, as accurate attitude estimation is critical for any quadrotor drone control system. With these considerations, the dual closed-loop approach can be adapted to various quadrotor drone configurations, from miniaturized drones for indoor navigation to larger platforms for industrial inspections. The robustness of this system makes it suitable for real-world scenarios where environmental disturbances are inevitable, thereby pushing the boundaries of what quadrotor drones can achieve in autonomous operations.
