MAVLINKHUD

Overview

The RELAY parameter group configures the Digital Relay subsystem. Relays are simple On/Off (3.3V/5V digital) switches used to control external hardware that does not require a PWM signal.

ArduPilot supports up to 6 standard relays (and more in some versions) that can be mapped to any GPIO-capable pin on the flight controller.

Key Concepts

1. Relay Assignment (RELAYx_PIN)

Maps a physical pin on the flight controller to a logical relay ID.

  • RELAY1_PIN: The GPIO ID of the first relay (e.g., 50 for AUX 1).
  • Disabled (-1): The relay is not active.

2. Logic Polarity (RELAYx_INVERTED)

Defines whether "On" is High (3.3V) or Low (0V).

  • 0 (Normal): On = High, Off = Low.
  • 1 (Inverted): On = Low, Off = High.

3. Default State (RELAYx_DEFAULT)

Defines the state of the relay immediately after the autopilot boots up.

  • 0: Off.
  • 1: On.
  • 2: No change (Maintain state across reboots if possible).

Parameter Breakdown

  • RELAY_ON: (Legacy/Global) Global command to toggle.
  • RELAY1_FUNCTION: Sets the purpose of the relay (e.g., Relay, Ignition, Brush).

Integration Guide

  1. Select Pin: Identify an AUX pin you wish to use.
  2. GPIO Mask: Ensure that pin is enabled in BRD_PWM_COUNT or GPIO_MASK (depending on firmware).
  3. Config: Set RELAY1_PIN to the pin ID.
  4. Control: Map an RC channel to Relay 1 (RC Option 33) to toggle it with a switch.

Developer Notes

  • Library: libraries/AP_Relay.
  • Capacity: Useful for controlling lights, smoke systems, camera shutters, or high-power battery isolation contactors.

RELAY_ON: Camera relay ON value

Description

This sets whether the relay goes high or low when it triggers. Note that you should also set RELAY_DEFAULT appropriately for your camera.

Values

Value Meaning
0 Low (Ground)
1 High (3.3V or 5V)
  • Default: 1

Description

This parameter configures the electrical signal logic used to trigger a camera via a relay.

  • Usage: Set this to match your camera's shutter release requirement. Most cameras trigger on a transition.
  • Function: When the "Take Photo" command is issued, the assigned relay pin will switch to the level defined here for the duration set in CAM_DURATION.

Source Code

ardupilot/libraries/AP_Camera/AP_Camera_Params.cpp

RELAY10_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY10_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY10_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY10_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY11_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY11_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY11_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY11_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY12_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY12_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY12_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY12_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY13_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY13_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY13_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY13_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY14_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY14_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY14_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY14_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY15_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY15_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY15_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY15_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY16_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY16_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY16_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY16_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY1_DEFAULT

Default 0
Range 0 1

Relay Default State (RELAY1_DEFAULT)

Description

RELAY1_DEFAULT defines the "Power-On" state of the first relay output.

This is important for safety and automation. For example, if Relay 1 is connected to a camera power supply, you might want it to default to ON (1) so the camera starts recording immediately upon power-up. If it is connected to a loud siren or a high-voltage igniter, you would set it to OFF (0) to prevent accidental activation.

  • 0: OFF. The relay starts in the deactivated state.
  • 1: ON. The relay starts in the activated state.

Tuning & Behavior

  • Default: 0.
  • Logic Link: This value is applied immediately when the autopilot initializes.
  • Note: If RELAY1_INVERTED is enabled, the physical output state will be flipped relative to this setting.

RELAY1_FUNCTION

Default 0
Range 0 100

Relay Function (RELAY1_FUNCTION)

Description

RELAY1_FUNCTION defines the "Job" of the first relay output.

Unlike physical PWM outputs which are usually used for motors and servos, Relays are simple digital ON/OFF switches. This parameter tells the autopilot what internal logic should control this switch.

Common Values

  • 0: None. Relay is disabled.
  • 1: Relay. Manual control via MAVLink or auxiliary switch.
  • 2: Ignition. Controlled by the Internal Combustion Engine (ICE) library.
  • 3: Parachute. Triggered when a crash is detected.
  • 4: Camera. Triggered by the camera shutter logic.

Tuning & Behavior

  • Default: 0.
  • Note: If you want to use the relay for a custom purpose (like turning on LED lights via a transmitter switch), set this to 1 (Relay) and assign an RC channel to that relay instance.

RELAY1_INVERTED

Default 0
Range 0 1

Relay Inversion (RELAY1_INVERTED)

Description

RELAY1_INVERTED calibrates the autopilot for your specific relay hardware.

Different relay modules have different "Trigger" requirements. Some turn ON when given a 3.3V signal (Active-High), while others turn ON when the signal is pulled to Ground (Active-Low).

  • 0: Normal. Active-High (Standard).
  • 1: Inverted. Active-Low.

Tuning & Behavior

  • Calibration: If your relay stays ON when you command it OFF (and vice versa), toggle this parameter.

RELAY1_PIN

Default -1
Range -1 103

Relay Pin (RELAY1_PIN)

Description

RELAY1_PIN tells the autopilot which digital connector on the flight controller is wired to the relay hardware.

  • -1: Disabled (No physical pin assigned).
  • 0-103: Physical GPIO pin number.

Tuning & Behavior

  • Setup: Refer to your flight controller's "GPIOs" documentation to find the correct number for the pin you are using.
  • Hardware Constraint: Standard servo outputs on many Pixhawk-style boards cannot be used as relays unless they are first "freed" by setting their SERVOx_FUNCTION to -1.

RELAY2_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY2_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY2_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY2_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY3_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY3_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY3_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY3_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY4_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY4_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY4_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY4_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY5_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY5_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY5_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY5_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY6_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY6_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY6_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY6_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY7_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY7_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY7_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY7_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY8_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY8_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY8_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY8_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.

RELAY9_DEFAULT

Default (float
Range null

Relay default state

Note: This parameter functions identically to RELAY1_DEFAULT.

RELAY9_FUNCTION

Default (float
Range null

Relay function

Note: This parameter functions identically to RELAY1_FUNCTION.

RELAY9_INVERTED

Default false
Range null

Relay invert output signal

Note: This parameter functions identically to RELAY1_INVERTED.

RELAY9_PIN

Default -1
Range null

Relay pin

Note: This parameter functions identically to RELAY1_PIN.