How to connect 5 buttons to Explorer Hat PRO


We have a project where we need to connect 5 buttons to the Explorer Hat PRO.

(simple push buttons that are either connected or not.)

4 of them we have connected to the input pins and they work like champs. what is the easiest place to connect the 5th one to? (I know I could make my own pull-ups or pull-downs and use the analog inputs but I am wondering if there is a simpler way.)

Thanks in advance,



If you use the Pi’s onboard pull-up then you can connect a button between any of the 3v3-only pins and ground. Granted the best choice is probably the “PWM” pin which corresponds to BCM18 on the Pi.


How do I access the BCM18? I am guessing I look through the explorer hat source code to see how the other ones work. Do I have to do anything special to turn on the onboard pull-up for BCM18?

Thanks in advance,



Under the hood, Explorer HAT uses the RPi.GPIO library which is pretty well explained here -

You’ll be using something a bit like this:

import RPi.GPIO as GPIO
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
button = GPIO.input(18)  # Read button value

You may want to investigate RPi.GPIO’s interrupt functionality for handling a button press, though.