(34) Relay switch

Article directory

foreword

34.1 Relay Pins on Autopilot with IOMCU

34.2 Define Relay Pins via Mission Planner

34.3 Pilot Control Relay

34.4 Mission Control Relay

34.5 Mission Planner Control Relay


foreword

The " relay " is a digital output pin on the autopilot that toggles between 0V and 3.3V or 5V , depending on the autopilot . Similar to a servo, it allows the autopilot to invoke certain actions from other devices on the vehicle. Up to 6 pins can be defined as relays.


34.1 Relay Pins on Autopilot with IOMCU

Autopilots with an IOMCU (the IO coprocessor that provides the "master" PWM output ) can configure their AUX outputs as  GPIOs instead of servo/motor outputs and use them as RELAY outputs.

For example, the Pixhawk defaults to AUX OUT 5 (pin 54 ) and AUX OUT 6 (pin 55 ) as the " first " (or #0 ) and " second " (or #1 ) relays respectively .

By reducing the number of AUX pins used as servo ( Servo ) outputs , the number of available relays can be increased to a maximum of 6 . This can be achieved by reducing  BRD_PWM_COUNT  from 4 to 2 or even 0 .

Note

In firmware 4.2 and later, the method of setting PWM/SERVO/MOTOR output as GPIO function has changed. Instead of using  BRD_PWM_COUNT , set the single  SERVOx_FUNCTION  parameter to " -1 ". If set to " 0 ", it is still a PWM output with no function assigned, and outputs the trim value of this output when the board safety is not activated. If the servo function is " mirrored " to a remote device, such as a DroneCAN or KDECAN ESC, then in order to change the corresponding output pin of the autopilot board to GPIO , but allow  SERVOx_FUNCTION  to still be assigned to the remote device, the SERVO_GPIO_MASK parameter can be used   to assign the board pin as GPIO without affecting the remote device's  SERVOx_FUNCTION  assignment.

Likewise, on other controllers  with only PWM outputs and no IOMCU , setting BRD_PWM_COUNT  to a lower number will free up its higher numbered output for use as a GPIO to control a relay .

34.2 Define Relay Pins via Mission Planner

The first to sixth relay pins are most conveniently set using the Mission Planner's CONFIG/Standard Params list , shown below, after " Finding " the relays. The dropdown box shows the pin names for several different autopilots .

For other boards, you'll need to find their hwdef.dat file here ( here ) and identify the GPIO pin numbers listed next to their output numbers, like this:

In the above case, you can set BRD_PWM_COUNT to 8 , release PWM9 and PWM10 for GPIO use, and then use GPIO pin 58 (that is, PWM output 9 on the board ) as a relay pin. Set  the RELAY_PIN parameter in the Mission Planner Parameters item above using its GPIO number, ignoring the dropdown selection or using the CONFIG/Full Parameter List screen  directly in the parameter itself  .

Note

Any changes to relay pin settings will require a reboot to take effect.

34.3 Pilot Control Relay

The relay can be controlled by an auxiliary switch. Settings can be made through the CONFIG / User Params screen as follows:

Note

This screen allows RC5 to RC14 to be set , but any RC channel ( 1-16 ) can have its RCx_OPTION set to RELAY , provided that channel is not already using the other controls of the CONFIG / Full Parameter List screen.

34.4 Mission Control Relay

Similar to servos, relays can also be activated during missions using the Do-Set-Relay mission command. This   is described on the Copter Mission Command List wiki page.

Note

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

34.5 Mission Planner Control Relay

The Mission Planner allows the user to set the output of any of the first four relay pins to LOW, HIGH, or set LOW and briefly toggle HIGH through the Data screen and the Servo/Relay subwindow using buttons, as shown in the image below:

Guess you like

Origin blog.csdn.net/qq_20016593/article/details/131844392