How to use Navio2 GPIO free pins?


According to “”, IO17 and IO18 pins on UART are available. i am trying to install a turn-off switch using IO17 as shown below.

In addition, i am using the following python script on RPI4-8GB with navio2 and latest image as shown below to utilizer IO17 for ON/OFF switch.

In the end regardless if the button is physically connected to IO17 via UART or not, running the python script immediately shuts down the RPI. Please help me understand the following below.

  1. what is correct way to utilizes free gpio 17 and gpio 18 that are available on UART?
  2. Are there any setting that needs to changed in navio2 or in GCS (Mission Planner) before these free pins can be used?
  3. Where do i find the documentation on how to use free GPIO pins available on Navio2 UART Connector?
  4. Why does RPI shutdown as result of executing the provided python script?
  5. How do i fix this shutdown problem ?

i look forward to your feedback/answers. Thank you

Hi @asadali4651,

I’d recommend using the PWM outputs for such a purpose. You can operate the servo rail pins the same way as GPIO as described in Navio2 docs.

Hi Dear

i perfectly understand that its a option but i am using those PWN outputs for few other things. i would rather utilize IO17 or IO18 for OFF Switch via UART as its available. i look forward to hear more on this. thanks

Hi Asad,

The number of IO17 GPIO should be 14 instead of 11. You can check the full list of pin numbers in this docs entry.

Please try changing the pin number to 14 in your script.

I tried changing to pin 14 in script and it did not work. it gave me the following error.

in addition, according to you documentation,

You need to specify RELAY_PIN parameter in Full Parameter List in Mission Planner or in Parameters in QGC. Use the following table for this

How do we change our Full Parameter List in Mission Planner to match this?

We would greatly appreciate it if you could please clarify on how we could use these free GPIO pins.

Please and thank you.

I am having similar problem :
I used: (

  1. echo N > /sys/class/gpio/export
    where, N= 500+header_pin_number-1
    -it says this should allow us to control those pins.

  2. pigpio - pigs utility like: (

pigs modes 4 w # set gpio4 as output (write)
pigs modes 17 w # set gpio17 as output (write)
pigs modes 23 r # set gpio23 as input (read)
pigs modes 24 0 # set gpio24 as ALT0
For this, it needs pigpio library installed and some other steps available on internet. However inorder to start running these commands it needs “sudo pigpiod” enabled.

  1. I set pin to output and set it to 1 to see if it worked. Its still not outputting 5V.

–> I am probably missing same thing as you. Those RELAY_PIN stuffs on mission planner.

If anyone could help, that would be awesome. Thanks

i understand your frustration because its not clear anywhere how gpio stuff is setup specially for navio2. i did found a temporary work around for this that might work for you as well. Please follow steps below in sequence

  1. update Wiring Pi to 2.52 using the link below.


  1. use the command “gpio readall” to get an idea of physical pins on pi vs wpi pins.

  1. use the “gpio mode wPi# in/out/alt0” to change mode. for example physical pin 11 on pi corresponds to 0 on wPi so then command will be “gpio mode 0 in”.

  2. you can also change the value(V) using this command “gpio write 0 1” and that should change V = 1 on physical pin 11.

  3. lastly, the link below provides more information on how to use other commands. i hope this helps until emlid/navio2 people can provide some answers.

I appreciate your help. I will try it out.

Hi everyone,

Thanks for your patience!

To set up a RELAY_PIN parameter in the Mission Planner, you should be able to change its Option to the pin number. In this case, you will need to insert 14. More details on relay configurations you can find in Mission Planner docs.

I’m afraid I can’t be of much help with the script specifics. However, you can refer to the Navio2 docs for all information about the relay configuration.

  1. I don’t think you understood what i was asking.
    “To set up a RELAY_PIN parameter in the Mission Planner, you should be able to change its Option to the pin number. In this case, you will need to insert 14.” SHOW ME HOW !

  2. I have gone through the documentation as well as navio2 docs multiple times and it is no where clear how it must be done. This must be an indicator that your docs needs attention.

  3. Forget the script above, is there even a proof/evidence that IO17 & 1O18 are accessible via UART connector like it is said in you docs, Please show test Case. At this point i don’t think you guys even understand your own hardware fully. i have provided/figured out so much technical information on my own and the only answers i get from you are should or could. Please Please and Please take this as negative feedback rather then criticism and i hope i hear some helpful information next time. Thanks

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.