This arduino sketch is a servo controller that stabilizes the pitch-axis of a radio-controlled airplane. It's intended to be used on tail-less aircraft to enhance their otherwise marginal stability. Nonetheless, the controller can work on machines with sufficient passive stability. It can increase the effective static margin and allow the center of mass to be shifted aft. This tends to increase the lift-to-drag ratio of the aircraft.
Pitch stabilization can be accomplished in a variety of ways. These include directly measuring the relative airflow across the aircraft, or measuring changes in the motion and inferring the state of the airflow.
Angle of attack sensor: The attitude of an airplane is mainly determined by the aerodynamic forces acting upon it. For the pitch axis, the torque generated by these forces is primarily a function of the angle of attack. By measuring this angle, one can apply corrective actions that rotate the aircraft towards a particular orientation. Therefore, we can gauge the stability of the aircraft based on how quickly it converges towards said angle, or conversely, its instability if it diverges.
The simplest angle-of-attack sensor is a low-friction potentiometer attached to a weathervane.
As the weathervane will closely follow the local airflow, the deflection of the weathervane is proportional to the angle of attack.
Inertial measurement unit (IMU): One can maintain the attitude of the aircraft by measuring its change in orientation and providing an appropriate correction. In this case, we use the angular velocity from a gyroscope as the proportional term in a PID controller. The integral term becomes the angular deflection and is approximately equal to the angle of attack for small external disturbances. As such, we can approximate the behaviour obtained with an angle of attack sensor without having to use a weathervane.
No matter how the aircraft's state is measured, it is still necessary to use a mechanism to physically rotate the vehicle. The code considers the following designs:
Trailing edge flaps: This is the most common way to control a tail-less airplane. It involves deflecting a hinged section of the aft portion of the wing.
The torque generated by these deflections depends on the airspeed and the chord of the wing. If the wing is wider, the flaps are further aft relative to the center of mass and generate a larger torque. Conversely, a higher airspeed causes the changes in lift for a given flap deflection to increase, and this increases the torque.
Despite their simplicity, trailing edge flaps become increasingly ineffective if the wing has a large aspect ratio (small chord) or if the aircraft flies slowly. This configuration is best suited for high speed flight with stubby wings.
Weight shift: It is also possible to control the pitch axis by moving the lift vector relative to the center of mass. This comes from the very definition of torque:
Rather than changing the force F at a known distance d (as with trailing edge flaps), we change the distance in accord to a known force.
In level flight, the net force upon the aircraft is mainly lift, and it must necessarily counter weight. Hence, changing the distance shifts the weight.
The effectiveness of this control mechanism is proportional to the magnitude of the lift vector. If the lift is large, small deflections are required. However, the deflections become very large as the lift becomes small. This relationship breaks down with zero lift as there is no force to generate a torque. Despite this flaw, weight shift is a valid control mechanism so long as the airplane's wing remains loaded.
Unlike trailing edge flaps, weight shift does not lose effectiveness at low speed. As long as the aircraft is not accelerating downwards, the control effectiveness will remain the same.
Since there are a few variants of the controller depending on the stabilization method, there are different schematics as well.
Nano: There are two versions of the sketch for the arduino nano. Despite this, it should be compatible with similar boards. Each version uses the stabilization concepts discussed above.
- Angle of attack sensor: This schematic assumes a potentiometer is used as the sensor, but any analog sensor will work. A hall sensor is a low-friction alternative of the potentiometer.
- IMU sensor: The code is designed around an MPU-6050 IMU but the general structure will work for any IMU.
DigiSpark ATTiny85: The version of the sketch does not have the option for an IMU. Rather, it serves as a lighter alternative to the nano when using an angle of attack sensor.
The IMU version of the code requires the following libraries:
The ATTiny code requires ATTinyCore to compile.
See these pages for previous projects that inspired this work:
- Airplane with a slightly aft center of mass that is controlled by trailing edge flaps:
- Airplane that is stabilized and controlled by weight shift: