[FIXED] Normally open momentary switch and on/off command

Momentary On-Off Switch.pngI have build a Volumio player and have attached an normally open momentary switch to pins 5 (GPIO3) and 7 (GPIO4) and 6 (GND). I can switch Volumio on by pushing the switch. I installed the GPIO buttons plugin and enabled GPIO4 to shutdown Volumio.
A friend told me to use 2 diodes so there’ll be no connection betweeen the two GPIO pins.

3 Likes

This is awesome. Thanks for posting that and the instructions for assigning the button for shutdown. I added it to my system last night with a pair of LED status lamps running off the 3.3v supply and GPIO14 to show power and when the system is booted up and running. It works perfectly.

2 Likes

What diodes did you use? I don’t yet understand the different types.

EDIT:…If you are not using a HAT of any kind that requires GPIO3 …

You only need GPIO3 to turn on and off.

GPIO3 control for turning on is part of the rpi’s firmware.
Use the GPIO buttons plugin and set shutdown to GPIO3.

This is how I have mine setup and from standby ( red light on) press the button it powers up and boots volumio then press it again while in volumio it will shut down…so on and so forth

2 Likes

I hadn’t seen your reply but of course that would work. Excellent post.

I wonder: using GPIO3 you have no problems with audio DACs?
All DACs use GPIO3

1 Like

Thats a valid point.
Not using a HAT DAC myself. I use a USB DAC, So not experienced any problems.
Perhaps others using a HAT DAC can comment

I’m using a HiFi Berry and through some experimentation on a new streamer and I can confirm that using GPIO3 for on/off will not work with a DAC HAT. As soon as you assign #3 for Enable Shutdown in GPIO Buttons, it conflicts with the DAC and no music will play. Assign it to another pin and it works fine again (reboot required).

EDIT: I’ve tested on Volumio 2 and Volumio 3 with the same results.

Yeah …Massive oversight on my part. Not using a DAC HAT myself and honestly didn’t consider it.
Thanks for the input though I’ll edit my original post.