DO-SET-RELAY - Quadcopter (fc - pixhawk)

Hi drone enthusiasts! At the moment I am trying to make a drone watering plant. I was able to make a flight plan and a container for water. I first try if I can use a dc water pump connected to an arduino with pixhawk’s auxout 5 and by controlling manualy, with the code done in arduino when I set the relay_pin high, the water pump is functioning. The problem is when using do-set-relay. During the flight, I can’t see a water being dispersed by the drone, meaning it’s not turning high. What might be the problem?

How have you wired it up? Have you reduced BRD_PWM_COUNT?

I connected the signal and grnd of auxout5 to the digital input pin of arduino. I didn’t reduce the brd_pwm_count

you will need to reduce BRD_PWM_COUNT to four or less, it might be four by default, I cant remember.

When it’s 4, do I still have to reduce it? and why?

Pixharks had 6 aux outs, you want to use 5 for relay so you can only have 1 - 4 as pwm so board BRD_PWM_COUNT at 4, or less if you have other stuff on different pins.

If its four already the next thing to look at is the relay parameters. What do you have set?

default_relay = no
Relay_pin = aux5

it’s all working when doing it manually, like when I switch ch7 to high, it will sprinkle some water but when In auto mode, seems that it’s not working already. By the way I’m using a do-set-relay command

ah, if its wotking with a channel option then the error must be in the do_set_relay command, what paramiters are you giving it?

here’s the flight plan

For Do_Set_relay

relay_number = 0 (auxout5)
state = 1 (on)

try with relay number = 1, it may not be zero indexed

but it says in the ardupilot documentation, if I want to use the first relay, choose zero

hum, where? I had a look and what I could find suggested it should be one, you could try it anyway

Okay @iampete I’ll try it tomorrow on my testing

Oh I found it here tho

I have this working on the bench on Aux5 out with the following:
DO_SET_RELAY (1,1) to turn on (1,0) to turn off

I created the mission commands to turn on the relay, delay for a few seconds, then turn off the relay and I’m getting 3.3V toggling on AUX5 output.

Thanks man! I’ll try it later