I have a project in mind that utilises a Pi Zero, Unicorn pHAT, and buttons.
Would it be possible to connect 4 buttons to a Zero and Unicorn pHAT that control the power, colour of the LEDs and the brightness like in the example I’ve sketched below?
I guess the main question is how best to solder the buttons to the GPIO, so which pins to use? Would it be better to use a Pico HAT Hacker or just to solder to the bottom of the Zero?
I’ve already completed this project as a lamp that turns on at a certain time of day and runs a script, now I just want to build extra functionality into it without having to change the script every time I would like a different effect.
What I have done in the past is put a Proto Zero on a stacking header between my Pi Zero and the phat. ProtoZero – Pimoroni
Then run my wires from my buttons to it.
The Pi Zero in the picture has a 90 header on it. That was done to get me easier access to its HDMI and USB ports. I could have used a stock header, I just chose not to. It’s my custom Pirate Radio setup. Where my pHat Beat is I don’t have access to its buttons.
Another option is to switch to the Unicorn Hat Mini, it has 4 buttons and a nice 17 x 7 LED matrix. You will have to drill holes in the diffuser to get access to the buttons though. Unicorn HAT Mini – Pimoroni
I have one and had a lot of fun with it. I had the buttons setup for brightness up down and to change the color. And to clear the display and do a proper shutdown, it ran headless.
Another solution, for those who’d prefer not to solder, is a GPIO edge extension, a tiny board that breaks out two sets of GPIO pins at right angles to each other, like this: