Shutdown/Restart Pushbutton

Raspberry Pi related support

Shutdown/Restart Pushbutton

Postby stablgr » 16 Mar 2019, 01:13

Raspberry Pi 3 Model B Ver 1.2
IQAudio Pi-Dac Pro
RuneAudio v0.5

Searching around the web I've come across a method of safely shutting down (and restarting) the Pi using a N.O. pushbutton wired across pins 5 and 6 and apparently all it requires is for the following line to be added to /boot/config.txt

dtoverlay=gpio-shutdown,gpio_pin=3

After editing the file and rebooting the Pi I find that shorting pin 5 to pin 6 has no effect. Rune carries on running as normal. If I shut Rune down, shorting pin 5 to pin 6 does indeed restart the Pi and Rune comes back to life.

I guess my question is should this work as described and if so, what am I doing wrong. My aim is to have a single pushbutton that will safely shut everything down, then bring it back to life again.

All the best
Gary

Am I doing something wrong here?
stablgr
 
Posts: 14
Joined: 21 Feb 2016, 04:32

Re: Shutdown/Restart Pushbutton

Postby janui » 17 Mar 2019, 10:37

Hi stablgr,
stablgr wrote:Am I doing something wrong here?
No, I don’t think you are doing anything wrong, but I don’t think it will work because gpio pin 3 (header pin 5) is already being used as an I2C connection with your DAC (header pins 3 and 5). You could test this by removing the DAC and trying again. According to the documentation (see here: https://www.stderr.nl/Blog/Hardware/Ras ... utton.html) it looks like you will need to use another gpio pin for shutdown, unfortunately it appears that the start-up function using pin 3 (header pin 5) cannot be moved to another pin.
janui
User avatar
janui
 
Posts: 674
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: Shutdown/Restart Pushbutton

Postby stablgr » 17 Mar 2019, 20:46

Hi Janui,

Thanks for your reply. If I can find a free GPIO pin that will work for the shutdown functionality then I think I can still use a single pushbutton and appropriate logic (relays or otherwise) to connect the button across the appropriate pair of pins depending upon whether the Pi is running or shutdown. I'll also experiment with the DAC removed first to see if it'll all work as planned.

Thanks again for your help.
Gary
stablgr
 
Posts: 14
Joined: 21 Feb 2016, 04:32

Re: Shutdown/Restart Pushbutton

Postby hondagx35 » 18 Mar 2019, 19:57

Hi Gary,

try GPIO3 (Pin5) and GPIO4 (Pin7) for this.
You only have to connect a diode across them with the anode at GPIO3.
The pushbutton should be connected to GPIO4.

Code: Select all
dtoverlay=gpio-shutdown,gpio_pin=4


Frank
User avatar
hondagx35
 
Posts: 3034
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Shutdown/Restart Pushbutton

Postby janui » 19 Mar 2019, 10:53

Thanks Frank,
Really elegant solution.
janui
User avatar
janui
 
Posts: 674
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: Shutdown/Restart Pushbutton

Postby stablgr » 01 Apr 2019, 03:13

Thanks for the tips.

I tried the setup using the diode and the other GPIO pin but still cannot get anything to work. I removed the DAC and tried the both the diode and original modification to config.txt by adding:

dtoverlay=gpio-shutdown,gpio_pin=4

and

dtoverlay=gpio-shutdown,gpio_pin=3

as appropriate.....Still no joy. :(

Next step was to remove the SD card with Rune on it and put in a fresh image of Raspbian. After updating everything I edited config.txt with

dtoverlay=gpio-shutdown,gpio_pin=3

and rebooted. Now when I short between header pins 5 and 6 the Pi will shutdown/restart as required. Does this mean there is something wrong with the code I am entering in config.txt on the Rune installation?

Next step is to try Frank's suggestion with the Raspbian SD card, and if that works, back to Rune and see what happens.

Regards,
Gary
stablgr
 
Posts: 14
Joined: 21 Feb 2016, 04:32

Re: Shutdown/Restart Pushbutton

Postby stablgr » 01 Apr 2019, 03:42

No luck with using GPIO pin 4, with or without the diode.

Pulling GPIO 3 low when the Pi is in standby wakes it up correctly, but when awake, pulling GPIO 4 low does nothing.

Just to make sure I hadn't damaged anything I changed config.txt back to using GPIO 3. After rebooting, pulling GPIO 3 low shutdown/restarts the Pi as expected.

It's getting late so I'll try again in a day or two.

Gary
stablgr
 
Posts: 14
Joined: 21 Feb 2016, 04:32

Re: Shutdown/Restart Pushbutton

Postby janui » 01 Apr 2019, 15:11

Hi stablgr,
How have you been determining which physical pin numbers map to GPIO pin numbers? I have just used the 'gpio' utility (documentation here: https://projects.drogon.net/raspberry-p ... o-utility/) to look at the pin mapping on a Pi3 with a i2s with i2c dac installed. I was surprised to see that pin mapping is different to what I expected, I don’t understand why. Try this:
Code: Select all
gpio readall
This should show you the actual pin mapping.
janui
User avatar
janui
 
Posts: 674
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: Shutdown/Restart Pushbutton

Postby stablgr » 02 Apr 2019, 19:26

Janui,

For the mapping of the physical pin numbers to the GPIO pin numbers I did a google image search and found a pinout diagram for the Pi. I'll be honest that I didn't look too closely at it and perhaps this may be the issue. Next opportunity I have I'll try what you suggested both with and without the DAC installed and see where that leads me.

Thanks for all the help so far.

Best regards,
Gary
stablgr
 
Posts: 14
Joined: 21 Feb 2016, 04:32

Re: Shutdown/Restart Pushbutton

Postby stablgr » 04 Apr 2019, 01:11

Well, that certainly wasn't what I expected.

I tried..
Code: Select all
gpio readall

with three different configurations:
1. Pi 3B with latest version of Raspbian
2. Pi 3B with Rune 0.5 configured for local audio output
3. Pi 3B with IQaudIO DAC Pro installed and Rune 0.5 configured to use the DAC

I got the same results every time but the GPIO pin assignments didn't line up with the hardware pins as I thought they were going to. This is what I got:
Attachments
Screen Shot 2019-04-02 at 10.56.59 PM.png
Screen Shot 2019-04-02 at 10.56.59 PM.png (157.81 KiB) Viewed 986 times
stablgr
 
Posts: 14
Joined: 21 Feb 2016, 04:32

support RuneAudio Donate with PayPal

Next

Return to Raspberry Pi

Who is online

Users browsing this forum: cmh714 and 5 guests