Mission Planner Relay Control

Hi,

Im unable to control a relay connected to AUXPIN 7 in servo/relay tab. (Pixhawk 6c)
Coil pins one goes to signal and the other to GND.
relay1_function 1
relay1_pin 56
relay1_default On
My output: RCOut: PWM:1-8 DS600:10-14 PWM:15-16
I tried another option just in case only the first 6 aux work for relays by moving the DS600 to 5-8 and use AUX 2 for the relay but nothing changed.
Also tried to set servo15_function as GPIO but not work.
I have tested the relay independently by connecting coil pins one to GND and one to 5V, I was able to hear clicking sound.
anything I miss !!

I think you have most of the correct parameters, but there is not enough current supplied on the GPIO pins to actually drive most relay coils (and the output is 3v3, not 5v). You should set SERVO15_FUNCTION to -1 in addition to (not in lieu of) the rest of the relay parameters. Once the parameters are correctly set, you risk damaging the GPIO pin by attempting to directly drive a relay coil, so use caution there.

You should use a solid state relay, RC relay (that operates on RC signals), or a logic-based relay board designed for use with microcontrollers. Let me know if you need specific examples of that hardware.

1 Like

I was not aware of that actually, Iā€™m using TE Connectivity OJE-SS-105HM. Could you provide me with some examples of those you mentioned.
Thanks

According to its datasheet, the coil draws 450mA, which will almost certainly damage your autopilot. Thatā€™s about an order of magnitude more than the max current you should ever expect out of any GPIO pin.

Here is a cheap solid state relay (I canā€™t vouch for its quality, but itā€™s the first compatible example I found)

Iā€™ve been using the 8 channel version of this board for several years without failure.

And here is an RC-based relay that is fairly high quality. I use them in several projects. You donā€™t have to set them up as relays at all - just drive them with a 2-position RC switch (SERVOx_FUNCTION=RCINx - or similar, depending on use case).

1 Like

I reviewed the TE relay datasheet and found that the coil power is rated at 450mW. For a 5V relay, this results in a current draw of approximately 90mA. Could you clarify where the 450mA current figure you mentioned is coming from? Iā€™m looking to understand this better and would appreciate your guidance on this.
https://www.te.com/en/product-2-1419128-9.datasheet.pdf

It was just a glance. If the nominal draw is 90mA, thatā€™s still about 4x what you ought to be drawing on any given GPIO pin.

90mA at 5V equates to 136mA at 3v3. You donā€™t want to do thatā€¦

We are going to beef up the documentation to include a warning about direct coil connections to GPIO.

1 Like

Pending PR to update the docs with a warning regarding GPIO current limits. Per the STM32 datasheet, you really ought to limit any given pin to 8mA, though you might get away with up to 20mA. There is also a max current draw across all IO pins of ~150mA, so thereā€™s not much headroom.

1 Like