Binding RC button to SERVOn_FUNCTION

I have a SpeedyBee F405 v3 flight controller and I would like to notify another BOARD that the RC button was pressed by wiring the M8 pad of the FC to one of the GPIO inputs.

I tried the following settings in Mission Planner:

  1. Found a non-busy RC channel in Mandatory Hardware → Radio Calibration. Let it be RC8.
  2. Went to Servo Output and set SERVO8_FUNCTION=RCIN8. ( also tried to set RCPassThru)

When I press the RC button, I see two values: 987 (if the RC button isn’t pressed) and 2010 (if the RC button is pressed). However, if I check the voltage on the M8 pad, nothing changes, regardless of the RC button’s position.

What could I do wrong?

Thanks in advance.

you need to set it up as a relay output.

https://ardupilot.org/copter/docs/common-relay.html

1 Like

Thanks.

It works, but seems the doc is a little bit outdated. I don’t see RELAYx_FUNCTION. There is only RELAYx_PIN.

So I set RELAYx_PIN and RC8_OPTION to RELAY2 and the behaviour started to be as expected.

some parameters might not appear until you reload the parameters after enabling the relay.

1 Like

Hmm, I flashed stable version of speedybeev3 firmware ( from here: ArduPilot firmware : /Copter/stable/speedybeef4v3 ) and I stop to see on GPIO57 0 or 1 ( depending on switch button is pressed or not… )

Configuration of RELAY2_PIN:

$ cat params.param | grep -i relay
RELAY1_FUNCTION,0
RELAY2_DEFAULT,1
RELAY2_FUNCTION,1
RELAY2_PIN,57
RELAY3_FUNCTION,0
RELAY4_FUNCTION,0
RELAY5_FUNCTION,0
RELAY6_FUNCTION,0

Set RC8_OPTION to RELAY2 on/off:

$ cat ~/params.param | grep -i RC8
RC8_DZ,0
RC8_MAX,2010
RC8_MIN,987
RC8_OPTION,34
RC8_REVERSED,0
RC8_TRIM,987

Am I missing something?

For some reason, it was also needed to set SERVO8_FUNCTION to -1. After that everything start to work.

The reason is that you have to set that channel to GPIO mode by assigning it -1 function :slight_smile:

1 Like