Relay on navigator and blueboat

I am not certain to understand if and how relays can be controlled on blueboat and navigator.
I have ardurover and ardusub vehicule running with pixhawks and the relay integration was complicated. Changing brbpwmcount / weird numbering of aux output vs writing on the board etc. But It do work at the end. I tough it was more straigthforward on the navigator and blueos but I can’t make it work! What is it I do wrong?

I run latest stable ardurover 4.5.2 and BlueOS 1.2.5. I want to use button 10 of my joystick to toggle the relay on/off and can connect the relay to any navogator pin. For now let say pin 16.

What I did:
In the blueOS I set channel 16 to GPIO, then I moved to QGC.

In QGC, I set
Relay1_default to 0;
Relay1_function to 1; → 1 supposed to stand for “relay”
relay1_pin to 16.

In QGC, I set the RC16 and RC10 option to relay on/off. Not sure if this is related to the joystick (button 10) or the navigator (pin 16). So I put both as relay.

In QGC, since I assigned pin 16 to GPIO in bllueOS, the servo16 function is now “unknown:-1”

In QGC, joystick tab, I try to set the joystick button 10 to “toggle relay” but this function is not available. Does setting RC10 option to relay is enough?

I also can’t find the BRD_PWM_COUNT.

Finally, should I put 5v on the navigator rail to have power for the pin? At the moment there is no power on the rail. I know this is needed for the Pixhawk. Is it the same? Note that I only use the Signal pin and wan’t it to toggle between 0 and 3.3v. I don,t use this to power the relay.

At the moment I just measure the signal pin voltage connected to my multimeter. I can’t obtain 3,3v.

thank you

Hi @Charles -
Sorry for the confusion! I’ve tested with these parameters and ArduRover 4.5.2 successfully:

Relay2_Funciton: Relay
Relay2_Pin: 5 (corresponds to navigator ESC output #5)
Relay2_Default: on/off as user prefers
Servo2_Function should be set to -1 (disabled)

In your case, setting Servo1_Function to -1 may be the key? The Servo# goes with the Relay#, not the pin#…

Hi @tony-white

I will try this this morning.

Servo 1 and servo 3 are allocated to throttle left and right on default blueboat. Does this mean that relay 1 and 3 cannot be used in this config? Then should I put the motor on navigator pins > 6 to gain full access to servo 1 … servo6 function (thus relay 1… relay6)?

Also what is the solution to toggle the relay with the joytick? In ardusub the function “toggle relay on/off” can be allocated to a joystick button. In ardurover this option is not available (or I don’t find it). Can I manually enter a number in the button parameter to have this option?

thank you for the help:)

Hi @Charles -
That’s correct - you’d need to use Servo 2, 4, 5, 6, etc. as Servo 1 and Servo 3 are used to control the vehicle.
Unfortunately, QGroundControl doesn’t support ArduRover relay control via joystick or otherwise. You can use Mission Planner though!

1 Like

Ok it work using relay2 but like you say there is no way to control it with the joystick and QGC.
My relay also don’t trigger even when the pin is high. It do trigger with a pixhawk so I guess the navigator output is marginaly lower.
On my pixhawk boogieboard, I can control the exact same relay and I use QGC. The difference is that I use a Radio and I probably set the RC to control the trigger instead of QGC.

So now I have to start from scratch again and need your help a bit further :slight_smile:

I have a PWM relay. When you send it > 1600us it trigger and when you send it < 1400us it turn off.
I would like to configure 2 buttons on my joystick to send >1600 and < 1400 and control the on/oof state of the relay. Again in ardurover there is not much function that look like this. I am thinking of using the gimbal up and down fonction and adjust the trim/min/max of individual button to 1100 and 1900. Do you think this can work? Can you point me toward the best function to use to do this?

This PWM relay

I’m yet to properly test this, but custom MAVLink commands as joystick functions is a documented feature of QGC, so it may be possible to do what you want by setting up relevant DO_SET_RELAY / DO_SET_SERVO functions for the outputs you want. It at least seems worth a try :slight_smile:

Hi @EliotBR , because of this:

I have to find another solution. Thus using the pwm relay should work but I am not able to manipulate the servo to output high and low PWM with ardurover available functions. I can only set the using trim and then I have a constant output. On ardusub we can manipulate the camera gimbal using buttons and set the trim of those buttons to set the gimbal action range. I was thinking of doing this in ardurover but I fail to use mountilt / mount pan / mountroll, mount up / down etc. The function are available but I can’t make them work.

any suggestions on how to do it will be great!

The navigator web assistant migth solve my case?
I can read here that the web assistant can work with nodered and there is example of this available. So I can probably use a dashboard button to trigger a relay or set PWM output of any channel to a desired value correct?

In this link webassistant topic we can see a screen shot of the web assistant interface. In the bottom rigth corner it is written : Attention… web assistant use own driver. strongly recommend to stop the autpilot to used.
If I only use limited command from node-red → assistant, like describe above, can I still use ardurover feature or it will crash?

Hi @Charles -
When you install the navigator web assistant, it completely disables the Autopilot, as only one process can access the associated hardware at a time! So while you can indeed control relays this way, you won’t have any of the navigation functionality provided by ArduRover…

We’re working hard to add joystick triggered servo/relay functionality in soon, in the meantime I’m investigating using LUA scripts to trigger relay/servo actions based on waypoints or QGC mission planning as an alternative. Thanks for your patience!

I’ve now confirmed QGC’s custom MAVLink command functionality, and written a post about how to set it up. You can set up a couple of commands for high and low servo PWM values, that you can then trigger with your joystick or with on-screen buttons :slight_smile:

The ArduSub firmware defines several unique joystick button functions that aren’t available in other firmwares. They could potentially be replicable with a lua script that monitors the MANUAL_CONTROL message button values (which we’re considering providing at some point), but for many functions it’s sufficient to just send direct MAVLink messages, which as mentioned can be done with QGC already :slight_smile:

Thank you @EliotBR, this custom mavlink command will certainly help me with the relay and I will try it. Unfortunately since it requires to save the json file to the appropriate folder and activate the custom file to access the button using QGC, I am not sure it will be a solution for my client who expect a plug and play solution. Thus I am thinking of using a hybrid of your solution and send the custom mavlink command you suggest directly to the navigator using a switch in Node-red dashboard. Then the client just toggle the switch and it send the command directly.
At the moment, I have a flow that receive, parse and chart select mavlink message using websockets but I am not sure of how to send mavlink back to the navigator.
Are you aware of a node red flow that do this?
My flow is based on Patrick electric flow this:EDIT new working link. flows.zip (1.7 KB) but this listen to incoming data and do not send messages back. It use websocket and mavlinkrest api : listen to “ws://192.168.2.2/mavlink2rest/ws/mavlink”

Specifically to mavlink, can we just send a mavlink message and it will append to the already existing message or we need to integrate the custom message in the big picture before we send it? Can it be independant from the normal stream between QGC and the navigator? Maybe it’s not possible to send mavlink command to the navigator while it’s connected to QGC?

You already help me a lot so I feel a bit cheap to ask more. I am sorry about this but I think this will help others to. I can manage the node red part (Switch /dashboard / Message content) as long as I get a mavlink message out solution. Maybe it is simple has using the websocket out node and that it? like this node-red flow? Or I need to cope with heartbeat and other stuff?

[
    {
        "id": "5f66aa5a545ce5d3",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "88497041af723776",
        "type": "inject",
        "z": "5f66aa5a545ce5d3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[{\"label\":\"Servo5 HIGH\",\"description\":\"Sets servo 5 to a high PWM value\",\"mavCmd\":183,\"param1\":5,\"param2\":1900}]",
        "payloadType": "json",
        "x": 170,
        "y": 120,
        "wires": [
            [
                "118a8970f2b98e1b"
            ]
        ]
    },
    {
        "id": "118a8970f2b98e1b",
        "type": "websocket out",
        "z": "5f66aa5a545ce5d3",
        "name": "",
        "server": "",
        "client": "ac577b82b5080edf",
        "x": 420,
        "y": 120,
        "wires": []
    },
    {
        "id": "ac577b82b5080edf",
        "type": "websocket-client",
        "path": "ws://192.168.2.2/mavlink2rest/ws/mavlink",
        "tls": "",
        "wholemsg": "false",
        "hb": "0",
        "subprotocol": ""
    }
]

There is so many way to go to Rome :slight_smile:

Hi @Charles -
I’m a bit confused that your customer would find the solution Eliot provided as not plug and play, where the alternative you propose requires equal technical configuration and therefore also doesn’t seem to be plug and play?
You may want to investigate using LUA scripts for your application…

Hi, well let my try to clear it up :slight_smile:
I have put together a GHG mapping drone. The client need 3 things. 1. Routes planning for the drone. Solution → QGC
2. Live GHG data visualization. → I made it using a ESP32 controller connected to Node-red. Now I see GHG live on charts.
3. Recording data from the sonar, GPS and GHG alltogether. → Also made this using node-red.

When my client connect to the drone he open the Dashboard. From there he can monitor the data and with a button, store them on a txt. file. It would be logic and easy to add one button in the same dashboard for starting the GHG system. For this I use a relay 0-3.3v or a PWM relay requiring the servo to be at 1900 to open.

Node-red allow to read all the mavlink message from the rover. This work fine. I don’t understand enough Mavlink to send the simple command back to the pilot to ex: set servo_n to 1900 pwm.

The solution involving adding custom file on a computer is fine for me. Not sure it will be great for research lab with students rotation and different laptop config (win, mac etc). I prefer a solution in the drone itself to avoid all this.

The gripper in QGC 4.3.0 did the trick. 2 buttons are required to toggle the PWM relay.

That being said, I am still very interested into a simple json mavlink command that could be implemented in Node-red to comunicate back to the drone.