Relay Switch

A “Relay” is an digital output pin on the autopilot that can be switched between 0 volts and either 3.3V or 5V, depending on the autopilot. Similar to a servo it allows the autopilot to invoke some action from another device on the vehicle. Up to 6 pins can be defined as relays.

Relay pins on IOMCU equipped autopilots

Autopilots having an IOMCU (IO co-processor providing the “MAIN” PWM outputs) can have their AUX outputs configured as GPIOs instead of Servo/Motor outputs and used as RELAY outputs.

For example, the Pixhawk default defines set up AUX OUT 5 (pin 54) and AUX OUT 6 (pin 55) as the “First” (or #0) and “Second” (or #1) Relays respectively.


The number of available Relays can be increased to a maximum of 6 by reducing the number of AUX pins used as Servo outputs. This can be accomplished by reducing the BRD_PWM_COUNT from 4 to 2 or 0.

Likewise, on other controllers which have only PWM outputs and no IOMCU, setting BRD_PWM_COUNT to a lower number will free up their higher numbered outputs for use as GPIOs for controlling relays.

Defining the relay pins through the Mission Planner

The First ~ Sixth relay pins can be setup most easily using the Mission Planner’s CONFIG/Standard Params list as shown below after “Find”ing the term relay. Pin designations for several different autopilots are shown in the drop-down box.


For other boards, you will need to find its hwdef.dat file here and determine the GPIO pin number listed beside its output number, as shown below:


In the above case, you could set the BRD_PWM_COUNT down to 8, freeing PWM9 and PWM10 for GPIO use, then use GPIO pin 58 (which is PWM output 9 on the board) for a relay pin. Use its GPIO number to set RELAY_PIN parameter in the above Mission Planner parameter entry ignoring the drop-down selections or, directly in the parameter itself, using the CONFIG/Full Parameter List screen.


any change to relay pin setup requires a reboot to take effect.

Pilot control of the relay

The relays can be controlled with the auxiliary switches. These can be set using the CONFIG/User Params screen as shown below:



This screen allows setting RC5 thru RC14, but any RC channel (1-16) can have its RCx_OPTION set as a RELAY, if its not already being used as another control function using the CONFIG/Full Parameter List screen.

Mission control of the relay

Similar to a servo, the Relays can be activated during a mission using the Do-Set-Relay mission command. This is described on the Copter Mission Command List wiki page.


In MAVLink the relays are numbered 0-5 instead of 1-6, so RELAY 0 is the first relay

Mission Planner control of the relay

Mission Planner allows the user to use buttons to set any of the first four relay pin’s outputs low, high or set it low and briefly toggle it high using the DATA screen and the Servo/Relay sub-window, as show below: