Relays on Navigator

Greetings,
We are trying to add some auxiliary functions on one of our BlueBoats. We wish to be able to turn on/off auxiliary lights and sirens via the joystick controller. I have setup relays and used external switches on other ardupilot boards (pixhawk cube series) with success. The switches I used to use (turnigy receiver control switch) are not available. I was trying to use a 1 channel relay switch (Amazon.com: 1 Channel Relay Shield Module, 10PCS DC 5V Indicator Light LED Module for Arduino R3 MEGA 2560 1280 ARM PIC AVR STM32 Raspberry Pi MCU DSP Official Boards Shield (10PCS) : Electronics), but it is not activating the relay, I can hear it trying to work, and the light changes on the relay board. I was trying to find the Navigator GPIO pins and came across this:


Does anyone have any ideas when relays will be available to work on the Navigator? Does anyone have any electronic switches they have used sucessfully with the Navigator? We have a couple extra ones of these I am going to try next (https://www.amazon.com/gp/product/B09XKCD8HS/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1). Thanks!.

Cheers,
Ian

Hi @FairweatherIT -
The first relays you link require way to much drive current for the Navigator to drive! You should have better luck with the second link, as they are solid state. Ive used this option successfully with the Navigator! You’ll need to configure the control channel so it outputs 0 to 3.3V when triggered - see here for more details.

1 Like

Thanks Tony, I had used the other relays with a Raspberry pi on some other projects, so I had them in the shop. We are wiring up the second kind to see how that goes. Thanks for the link…

Cheers,
Ian

Greetings Tony,

Have you tried this using the rover firmware? The switch we have in the shop is exactly like the one you linked to. I tried to follow the instructions in the other thread, but the switch would not work on our Navigator running Rover Stable 4.2.3. There are not options for the relay_1_toggle in the Joystick settings. When I change the firmware to the latest sub version 4.1.1 I can follow the instructions with the exact same setup, and I can get the light to work. I pulled a Turnigy switch off of an old rover in the shop (pixhawk cube black) (before doing so checked to see that it worked), and connected this to the Navigator (back in Rover FW) and I could not get it to turn on lights either. Do you have any recommendations for getting this to work in the Rover firmware?

Cheers,

Ian

Hi @FairweatherIT - just jumping in with some clarifications :slight_smile:

I just checked the source code, and it seems that support for using the Navigator’s pins as relay outputs was only added in the latest stable (4.4.0). I’ve added that to the guide note.

ArduRover doesn’t use the same type of joystick control as ArduSub, so instead of using the autopilot’s internally registered button functions (via the MANUAL_CONTROL MAVLink message) it’s necessary to send DO_SET_RELAY commands.[1]

Cockpit does not yet have support for generic MAVLink commands, but it is planned. As far as I’m aware QGroundControl doesn’t support that kind of vehicle control, but from the ArduRover docs it seems that MissionPlanner does.


  1. ArduSub will likely end up moving in a similar direction (because in principle an autopilot shouldn’t need to know about or store the specifics of a given input method/device), but for now things are the way they are. ↩︎

1 Like

Thanks Eliot! Where do you download the Rover 4.4.0 for the navigator? In blue OS the version the highest stable is 4.2.3

Lower down we have a Beta 4.3 and a Dev version.

On the ArduPilot Firmware download page there is a version 4.4 but there is no version for the Navigator.

What version do you recommend to get relays working on the Navigator?

I really like the Toggle feature (relay_1_toggle) in sub so you do not need to use 2 buttons to turn on/off a switch (light, laser, siren). Is there anyway to make this available in the rover firmware, or put in a request for future versions?

Greetings, I checked this AM and it looks like the Rover 4.4.0 is availible to install on the Navigator in BlueOS. When I run the upgrade and reboot, the firmware says unknown and vehicle says unknown and I cannot connect to QGC or MP by default…

When I downgrade back to 4.2.3 the info shows correctly and I can connect to QGC and MP immediatly…

I tried some other tricks, like installing a different vehicle firmware (sub) and then back to Rover, but I get the above screen when installing Rover 4.4.0…Thanks.

Just a FYI, I picked up some of these pololu RC realys and they can be controlled by the Navigator, but requires the use of 2 buttons. One to turn on (pwm 1900) and one to turn off (pwm 900). I would love to get the momentary option that is available on the Sub firmware so only one button could be used.

1 Like

Noting that QGC does actually support this, through its custom MAVLink commands functionality.

Cockpit also supports this now through its Actions system, with the extra versatility of being able to implement relative functions (like a “toggle” functionality) by reading the current value and commanding a corresponding state. In addition, the data lake system allows implementing momentary commands by triggering Actions in response to the joystick button being pressed and released :slight_smile:

Greetings Eliot, Thanks for the info! I will definitely give it a try!

No worries Ian :slight_smile:

There are some improved Cockpit docs on the way which should clarify some of how that works, so it might be worth waiting for those if you’re not in a rush.

This is also a conceptually simple, yet useful functionality that combines multiple Cockpit features, so I’ll see if I can make an instructive example out of it in the next week or two. That said, in the absence of dedicated instructions for this specific use-case this example should cover most of the main relevant info :slight_smile:

1 Like

Autopilot Relay Setup

  1. In BlueOS, configure a relay pin in the autopilot parameters by

    1. setting RELAY1_FUNCTION to Relay
    2. setting SERVO4_FUNCTION to GPIO (-1)
    3. rebooting the autopilot
      • required if the relay function was previously set to None, so it can load the relevant configuration options
    4. setting RELAY1_PIN to 4
      • must match the SERVOn_FUNCTION n value


Basic Relay ON/OFF Control

  1. Go to Settings / Actions and set up two separate custom MAVLink message Actions, for on and off MAV_CMD_DO_SET_RELAY commands (using the COMMAND_LONG message type)

    • Relays in MAVLink are 0-indexed, so Relay 1 is controlled by 0 in parameter 1
    • The desired state is in parameter 2, and should be 0 for off, and 1 for on


  2. Test the Actions

    • You can press the play buttons in the Actions menu
    • It may be helpful to set up a plotter widget, with SERVO_OUTPUT_RAW/servo4_raw (or whichever pin you’re using) to see the relay state in real time, especially if you don’t have hardware connected to it
    • If the Actions aren’t working as expected, you may need to edit them to make sure the parameters are set correctly
      • There is a known bug that can mean they don’t get configured correctly when first created

  3. Connect the Actions to your interface(s) of choice

Relay Toggle Control

  1. Go to Tools / Data-Lake via the sidebar menu, and create a new compound variable (top right, “Add compound variable”) to invert the reported pin output

    • 0 and 1 can be inverted with an exclusive-OR (xor: ^) operation with 1
    • MAVLink commands only accept numerical values, so we need the Number type (not boolean)

  2. Create a new DO_SET_RELAY custom MAVLink Action (like in the ON/OFF Control section), but this time set parameter 2 using the new compound variable, so it always inverts the currently reported value

  3. Test the Action, and connect it to interfaces as detailed above.

Momentary Relay Control

:light_bulb: Momentary control is currently only possible with joystick buttons, not on-screen ones.

  1. Go to Tools / Data-Lake and add a new variable, to represent the joystick button state

    • Buttons are boolean
    • Set the initial value to 0, because buttons normally start un-pressed

  2. Go to Settings / Actions and create a new custom MAVLink Action, using your variable as the output value

  3. Add a link to the Action, so it triggers automatically when the variable value changes


  4. Go to Settings / Joystick and connect a joystick button to control your data-lake variable

  5. Confirm the functionality is working as expected

Momentary PWM toggling

  1. In BlueOS, configure the relevant SERVOn_FUNCTION to Disabled (0), so it can be used for custom functionality

    • I’ll assume this was done with n=5 (for controlling pin 5)
  2. In Cockpit, go to Tools / Data-Lake and add a new variable, to represent the joystick button state

  3. Now add a compound variable, to convert the joystick button state to the desired PWM values

  4. Copy (or remember) the variable ID
    Screenshot 2025-08-07 at 11.26.02 pm

  5. Go to Settings / Actions and add a custom MAVLink message action, using the MAV_CMD_DO_SET_SERVO command

    • Specify the output channel you want to control (e.g. 5 for pin 5)
    • Use the compound variable for the commanded value

  6. Set up an automated trigger for the Action when the variable changes value

  7. Go to Settings / Joystick and map a button function to control the base variable

  8. Close the joystick configurator, and test to make sure the functionality works as intended

    • It may help to set up a plotter widget, with SERVO_OUTPUT_RAW/servo5_raw (or whichever pin you’re using) to see the PWM state in real time, especially if you don’t have hardware connected to it
4 Likes