Relay control in Cockpit

Hello,
i´ve got a relay connected to the navigator and already got the relay config setup.
Im able to control it with mission planner by pressing the relay button.
How do I set Cockpit up so i can toggle it from the interface with an onscreen button?
Thanks in advance for any help!
Simon Perzu

Hi @SimonPe2804,

Is it necessary to do this with an onscreen button?
That’s possible by setting up a relevant Custom Action[1], but is currently slightly awkward because of this bug, which means you would need to use a HTTP request Action rather than the more streamlined interface for MAVLink messages.

If you’re using ArduSub you can trigger relays using the built in joystick button functions (e.g. relay_1_toggle), or for any firmware you could use a Custom Action for a joystick button.

I’m in the process of writing more comprehensive documentation for the Custom Actions, so I can try to include an example that does something similar to this, but it may take a week or so before I get around to it.


  1. Note that MAVLink only supports directly setting the relay value, so you would need to either set up independent buttons for ON/OFF, or create a more complex Action that reads the SERVO_OUTPUT_RAW value for the relevant output pin to determine the current state of the relay (if you want a single button for toggling) ↩︎

2 Likes