Off switch for Phat DAC


#1

I have a Phat Dac fitted on my Raspberry Pi Zero W. I am running Moode Audio player v4.4. All works nicely. My question is whether I can add an on/off switch to this combo? What I’ve read indicates that I can add on/off functionality by using a momentary switch off the GPIO 21 and GND connections, but the Phat Dac occupies all of the GPIO. (I could solder leads onto the GPIO of the Pi Zero on the underside of the GPIO header.) Will any of that affect the Phat DAC?


#2

Hello, I use the pimoroni OnOff -shim ,i soldered it right to the pi zero’s gpio pins .because i dont need the zero for anything else …


#3

Another option is to put a Proto Zero with a stacking header on it between your Pi a pHat will get you access to all the GPIO pins. Then wire you shutdown button to that.



#4

You can do a shutdown from a GPIO pin via some python code. I do it on several of my Pi’s. You can pretty well use any GPIO pin you want, one thats not already in use. This will not remove the power to your Pi though. And won’t turn it back on again when pressed a second time.
With a model 3B 3B+ and 3A+ grounding GPIO 3 physical pin 5 will boot up your Pi. And with a config.txt edit it will let you do a shutdown. I don’t think this works on a Pi Zero though, older 2B’s etc. Same deal here though, does not remove the power to your Pi, it just sits idle like it would if you did the shutdown from Raspbian and left it powered up.
Jacks option will remove the power from the Pi though.


#6

Thank you all for the assistance. It does look like GPIO pin 21 is not used by the Phat Dac, so I might be able to rig up an on/off button with a momentary tactile switch. To be certain, per alpha’s post, I ought first confirm that a Pi Zero will shutdown fully sans Phat Dac, albeit going the GPIO pin 21 route. (I haven’t confirmed that the GND pin is not used by the Phat Dac. I don’t expect that it would matter if it did.)


#7

It won’t matter if the ground is used by another device, its a common connection same as the +5V and 3.3V pins.
BCM 21 is used by the pHat DAC, physical GPIO pin number 40.
Physical pin 21 isn’t though, which is BCM 9
Pinout is here,


#8

Ack, I missed that! Thank you for linking the pin out. My reference is this posting:

Seems I could use a pin other than physical pin 40 with modifications to the script. I don’t need a reset feature; just want a safe fully powered off button.


#9

It can be any pin you want, I used BCM5 physical PIN 29.
It looks like he picked that pin because it has a ground pin directly opposite it. That makes it easy to plug his cable in. I think thats why the Pi Foundation picked BCM 3 pin 5, pin 6 is a ground.