Hello and welcome to our community! Is this your first visit?

Camera Stabilization

This page is a chapter in 'Introduction to additional features'

Camera Stabilization

Camera Stabilization History

Original release with AeroQuad 2.1 written by CupOfTea, modified by Mikro.
A discussion by developers of how this came about may be found here and here.

General Information

To include support for the Camera Stabilization, you will need a camera mount on your copter with one, two, or three servos that move the camera around the copter's roll, pitch and yaw axes. These servos are in turn plugged into the appropriate pins on the FC for power and control. Although it may be used for many things, the primary use of this stabilization is to “lock” a camera's Field of View (FOV) at a particular point in space, and while the copter attempts to maintain its position in the wind, whether in “hold” mode or free flight, the camera
mount tilts in whatever way necessary to make up for copter's movement.

Most camera systems that provide articulation of the FOV do so by providing “pan” (left-right) and “tilt” (up-down). With a forward-looking camera mount, this would respectively translate to the yaw and pitch axes of a copter. However, since what is typically attempted is to keep the camera still while hovering, the camera mount usually provides correction for slight changes in the pitch and roll, leaving the operator to manually compensate for yaw. This is often due to camera mounts that provide automatic yaw correction usually end up with the landing gear or
batteries in the FOV. In some camera mounts, only pitch correction is provided. Whether you use one, two, or three axis correction is only a function of how many servos you connect to the flight computer, although some platform shields may have limited support for servos.

This module provides direct control over r/c type servos. These servos come in two flavors, analog and digital. Analog servos rely on a series of pulses from the FC that vary from 1 to 2 milliseconds in length, with 1.5 being the midpoint. The width of the pulse is directly proportional to the position of the servo arm. These pulses are typically sent at a rate of 50 Hz for analog servos, but may be sent faster to digital ones. This implementation assumes analog servos are being used.


The easiest way to activate camera stabilization is to use the AeroQuad Uploader and select the appropriate options there.

An alternative way is to upload the code manually. In UserConfiguration.h, find the lines that have “Camera Stabilization” in them as shown:

// *******************************************************************************************************************************
// Camera Stabilization
// Servo output goes to D11(pitch), D12(roll), D13(yaw) on AeroQuad v1.8 shield
// If using v2.0 Shield place jumper between:
// D12 to D33 for roll, connect servo to SERVO1
// D11 to D34 for pitch, connect servo to SERVO2
// D13 to D35 for yaw, connect servo to SERVO3
// Please note that you will need to have battery connected to power on servos with v2.0 shield
// *******************************************************************************************************************************
//#define CameraControl
Note the comment pertaining to pin assignments for the servo signal lines. Jumpers for users of the v2.0 Mega shield can be used to support the servo connectors on that shield. (See Hardware section below.) To include support for Camera Stabilization, uncomment (remove the //) in front of the last line above so it reads:

#define CameraControl
This causes the compiler to include the necessary Camera Stabilization support. Further configuration can be easily done using the Configurator. Navigate to the "Camera Stabilization" screen in the upper-right flyout where you change all camera stabilization settings.

Parameter NameDefault valueTypical value rangeExplanation
Mode10-10 = off, 1 = on, 2 = debug (only for development)
Center Pitch15001400-1600sets the center position for Pitch servo
Center Roll15001400-1600sets the center position for Roll servo
Center Yaw15001400-1600sets the center position for Yaw servo
Scale Pitch Angle1273.2+/- 200-1200sets the speed how fast the pitch servo will respond to changes in pitch angle (negative numbers will reverse servo direction)
Scale Roll Angle636.6+/- 200-1200sets the speed how fast the roll servo will respond to changes in roll angle (negative numbers will reverse servo direction)
Scale Yaw Angle318.3+/- 200-1200sets the speed how fast the yaw servo will respond to changes in yaw angle (negative numbers will reverse servo direction)
Servo Min Pitch10001000-1200sets the minimum position of the pitch servo
Servo Min Roll10001000-1200sets the minimum position of the roll servo
Servo Min Yaw10001000-1200sets the minimum position of the yaw servo
Servo Max Pitch20001800-2000sets the maximum position of the pitch servo
Servo Max Roll20001800-2000sets the maximum position of the roll servo
Servo Max Yaw20001800-2000sets the maximum position of the yaw servo

To tune your camera gimbal, set mode to 1, and then change the Center pitch/roll/yaw until you're happy with how level it is (remember to do this with a well calibrated craft). Next is the scaling - pick up the craft and rotate it along all axes. If one of the axes doesn't move much, increase the scale for that axis. If one axis moves too much, decrease the scale. Ideally, the camera should stay level at all craft angles - set your scaling to reflect this. It's not uncommon to have scaling above 500, so if it seems like the servo just won't budge, keep bumping the scale up! Finally, you don't want to strain your servos or hit things with the gimbal, so set the servo min/maxes. A good rule of thumb is +/- 500 from where you set the center for that axis, and then just tweak from there to get the range of motion your gimbal is capable of.


AeroQuad32 board

AeroQuad32 v2

On the AeroQuad32 v2 board, there are already pins including power supply for camera servos provided. These can be found in the lower right corner of the board marked as "Camera". Connect the pitch servo to pin "1", the roll servo to pin "2", and the yaw servo to pin "3" - white/yellow is signal, red is 5V, black/brown is ground. Power to the servo(s) is then provided from BECs of ESC No. 2.

AeroQuad32 v1

On the AeroQuad32 v1 board, there are already pins for camera servos provided. You may then connect the pitch servo signal to SVR1, the roll servo signal to SVR2, and the yaw servo signal to SVR3. Power to the servo(s) needs to be provided from an external source, e.g. the BECs of the ESCs.

By default, camera stabilization servo updates run at 50Hz, but several users have tested this at 100Hz with good results. This speed increase is not currently in the code (as of Nov. 4, 2012), but can easily be done by moving the camera stabilization function calls from the 50Hz tasks to the 100Hz tasks in AeroQuad.ino.

AeroQuad Shield v2.1

On the AeroQuad shield v2.1 in particular, there are already pins for camera servos provided (marked as CAMERA). You may then plug in the pitch servo connector to CAM1, the roll servo to CAM2, and the yaw servo to CAM3.

AeroQuad Shield v2.0

On the AeroQuad shield v2.0 in particular, there are already pins for servos provided, but to use these you must place a jumper on the shield between pins D11 and D34, D12 and D33, and D13 and D35 as labeled on the Arduino board. These pins are passed up to the shield and may be jumpered there. You may then plug in the roll servo connector to SERVO1, the pitch servo to SERVO2, and the yaw servo to SERVO3.

Camera Mounts

Like most R/C servos, the center of travel for each servo arm should be set up to position the camera mount to point at the center of the camera's desired FOV. Below you see some pictures of a camera mount for a GoPro HD with stabilization along the pitch and roll axis.

Additional information

This page has been seen 39,550 times.

    • Created by on
      Last updated by on