Signalling Pi Zero with Unicorn pHAT


I have a Pi Zero W with a Unicorn pHAT. I’ll probably be powering the Zero via standard USB power adapter.

I’d like to be able to tap a single keyboard-style switch to start (for example) ‘sudo ./’.

I’m guessing I’ll need to add in a resistor and handle the signal via GPIO, but I don’t know how to wire this in alongside the Unicorn pHAT.

Any ideas?


You have a couple of options.

One is to solder wires straight to a couple of pins on the Pi Zero W or the pHAT and then connect a momentary button to the other end. Unicorn pHAT uses only pin 18, so you could potentially use any of the other pins, e.g. pin 17 or 23, for your button.

The other is to use our Pico HAT Hack3r, which you’d solder to the Pi’s pins, then attach a male header to it, giving you complete access to all of the pins. You could then use some jumper jerky to connect you button up.

You wouldn’t need a pull resistor either, because you can use the Pi’s built-in pull-up/down resistors, which you can set in software.


A button shim may work,
Or if you want to use your own button a proto zero could be sandwiched in the middle with a stacking header. It will also give you full access to all the GPIO pins. I went that route on my Pirate Radio. I soldered on a 90 degree male header (for the buttons) and wired that to the GPIO pins. Then used male jumpers to connect to my buttons. That lets me unplug things if I have to. The Pico hat hacker sandy suggested will save you some space though. I had lots of room to spare stacking wise.

If you need help with the python code I can help with that, just post back. ;)


Ah yes, of course! Button SHIM would be a neat solution!


I use alot of extened headers (along with a pico hacker/proto/blank PCB type boards as well) for my soldering. Once I breadboard & perfect function of a project I solder it to either a 2x13, 2x40, or 1 or 2 1x20 headers the wiring on the pi end with a sort of blank proto/pcb if buttons resistors or such are needed, then run the wires to whatever type header fits the connecting hardware.
the hacker boards are nice as the move the GPIO aside so you still can build it to accept hats/phats ontop and run your new harness (and circuit) off the edge of the Pi.
I like all I have to do is plug the project in to pickup where I left off. I also enjoy soldering so I find this fun.


Two proto hats stacked on top of each other and a Proto board with the extra bits on it. The proto board has a male header on the back side that plugs into one of the proto hats.
I have an original black hat hack3r, and two mini black hat hackers on the go. I have plans to get the new zero sized board the pHat stack.

I have one Pi dedicated to bread boarding.