GPIO Button Adapter

I was looking for a clean and easy way to add buttons to a Pi Zero with pHAT. Feeling a bit adventurous, I used Eagle to design my own basic board …

I’m a beginner when it comes to Eagle, so I dragged in six buttons and a 2×20 header and started making the connections, keeping things as simple as possible:

  • pin 6: GND
  • pin 29: GPIO 5 (button 1)
  • pin 31: GPIO 6 (button 2)
  • pin 32: GPIO 12 (button 3)
  • pin 33: GPIO 13 (button 4)
  • pin 36: GPIO 16 (button 5)
  • pin 37: GPIO 26 (button 6)

When a button is pressed, the GPIO gets connected to ground. Assuming the use of internal pull-up resistors, the GPIO are HIGH when idle, LOW when the button is pressed.

Once finished, the design was sent to Seeed’s PCB service, and two weeks later the boards arrived.

Six tall push buttons were soldered on the board and the seven pins used by the little board were soldered to the Pi’s GPIO header, ensuring proper contact was made.

Because the board is only 1mm thick, a pHAT can still easily be mounted on top. The use of standoffs is recommended to make sure all parts are properly fastened.

To test the buttons worked as expected, I attached a Scroll pHAT HD and wrote a little test program displaying which button was pressed.

The result was the following:

Hooray!

Do you find this useful or not? Let me know in the comments!

8 thoughts on “GPIO Button Adapter”

  1. Simple. Minimalist. Elegant. I just love that!

    Great idea you’ve had, I’d definitely have some use for this.

    Do you plan to release the final files so we can order some from a PCB service?

    1. Hi Alex, thanks!

      Honestly, I didn’t try it yet. But the way I wrote the callback function, I believe everything will be executed sequentially, so the last button to trigger the callback, will have its value displayed on the pHAT.

Leave a Reply

Your email address will not be published. Required fields are marked *