[Guide] Graceful shutdown switch without Pololu [RETIRED]

Various user-contributed guides for hardware-related things
User avatar
HoolyHoo
Posts: 766
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 206 times
Been thanked: 741 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Thu Aug 18, 2016 6:58 am

@camble just a couple questions.

Is it necessary to have @popcorn script installed for this circuit to work with the original dmg switch or will it work stand alone?

Also, maybe I'm not looking at it right, but in the schematic when the original dmg is in the "off" position there is no connection between enable and ground to close the circuit and disconnect the Powerboost. Wouldn't the Powerboost stay on at that position?

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Thu Aug 18, 2016 7:07 am

@HoolyHoo Correct, you will need a script running to monitor the GPIO pin and shut down the Pi. @Popcorn's script does this perfectly. I will be supplying a script when my PCBs are ready.

In the second schematic, the DMG switch is already in the OFF position. The circuit is broken to turn on the PowerBoost.

User avatar
HoolyHoo
Posts: 766
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 206 times
Been thanked: 741 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Thu Aug 18, 2016 7:45 am

Camble wrote:@HoolyHoo Correct, you will need a script running to monitor the GPIO pin and shut down the Pi. @Popcorn's script does this perfectly. I will be supplying a script when my PCBs are ready.

In the second schematic, the DMG switch is already in the OFF position. The circuit is broken to turn on the PowerBoost.

I'm sorry I know it's just me but I'm not quite understanding. In order for the Powerboost to turn off, the enable and ground must be connected, correct? So when I look at the diagram, when the dmg switch is in the off position, there is no connection between those pins, thus the Powerboost is on even though the switch is off. Please help me understand. Thanks.

SidSilver
Posts: 263
Joined: Sun May 22, 2016 6:22 am
Location: France
Has thanked: 137 times
Been thanked: 37 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by SidSilver » Thu Aug 18, 2016 7:49 am

When EN pin goes low the powerboost turns off. With the graceful shutdown, if the pi is on, the powerboost stays on. That's why you need the script. When you switch off, the script detects it and shutdown the pi. When the pi is off the powerboost turns off.

DarrylUK
Posts: 62
Joined: Thu Jul 21, 2016 2:09 pm
Has thanked: 14 times
Been thanked: 20 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by DarrylUK » Sun Aug 21, 2016 11:36 pm

On ak34's AIO diagram the GND from the power in USB goes to the GND on the power boost. I presume there is only one GND on the power boost so we're taking 2 wires to it?

User avatar
hueblo
Posts: 175
Joined: Mon Jun 06, 2016 2:59 pm
Has thanked: 78 times
Been thanked: 81 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by hueblo » Mon Aug 22, 2016 12:01 am

Camble wrote:@skrapps924 If you're using Popcorn's Power Monitor, line 25 reads:

Code: Select all

GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Change this line to read:

Code: Select all

GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
I'll be adding a script to this guide at some point in future, since Popcorn's deals with low battery in a different way.
Hey @camble

Sorry for bugging you. I'm not sure if you saw the 2nd diagram I drew up. Can you verify which one is correct? The first one did turn on the unit but then it would not shut down, the 2nd one did not turn it on at all. I then found the code to modify popcorns monitor software. When ever I modify the code it gives a gpio error at shutdown then the OS will no longer boot. I have to apply the Retropie image again to get it to boot. What am I doing wrong?

1
deleted so people will not get confused

2
Image
Last edited by hueblo on Mon Aug 22, 2016 1:53 pm, edited 1 time in total.

SidSilver
Posts: 263
Joined: Sun May 22, 2016 6:22 am
Location: France
Has thanked: 137 times
Been thanked: 37 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by SidSilver » Mon Aug 22, 2016 1:52 am

hueblo wrote: Hey @camble

Sorry for bugging you. I'm not sure if you saw the 2nd diagram I drew up. Can you verify which one is correct? The first one did turn on the unit but then it would not shut down, the 2nd one did not turn it on at all. I then found the code to modify popcorns monitor software. When ever I modify the code it gives a gpio error at shutdown then the OS will no longer boot. I have to apply the Retropie image again to get it to boot. What am I doing wrong?

2
Image
Your first schema is the good one.

From what you say, it seems to be a script issue.
Camble wrote:If you want to use the original DMG-01 switch, you will need to connect the switch directly to the 3.3v pin on the Pi and set up GPIO27 to GPIO.PUD_DOWN
in Popcorn script
Last edited by SidSilver on Mon Aug 22, 2016 2:35 pm, edited 1 time in total.

User avatar
hueblo
Posts: 175
Joined: Mon Jun 06, 2016 2:59 pm
Has thanked: 78 times
Been thanked: 81 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by hueblo » Mon Aug 22, 2016 9:36 am

Hey @SidSilver

Thank you for verifying the schematic. Below is the listing of the pins I have hooked up. I also added the code below to config.txt. When ever I change the code to GPIO.PUD_DOWN the pi0 no longer wants to boot. I have to apply the image again to get it to boot. What I'm doing wrong? Any help is appreciated. Also running Retropie 4.

Added to config.txt

Code: Select all

dtoverlay=gpio-poweroff,gpiopin=22,active_low="y"
Change to Popcorn's script

Code: Select all

GPIO.setup(powerGPIO, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

Physical Pin GIPO Description
13 GIPO27 Shutdown
15 GIPO22 Keep Alive
17 3.3V

User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Mon Aug 22, 2016 11:02 am

@HoolyHoo The second diagram with the DMG switch shows the switch is in the off position. The EN pin is connected through the switch to the Drain pin on the JFET.

@hueblo The second diagram is the correct one. The pairs are: 3.3v & Shutdown. EN & Drain.

@SidSilver Nope, sorry.

SidSilver
Posts: 263
Joined: Sun May 22, 2016 6:22 am
Location: France
Has thanked: 137 times
Been thanked: 37 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by SidSilver » Mon Aug 22, 2016 11:20 am

Camble wrote:@HoolyHoo The second diagram with the DMG switch shows the switch is in the off position. The EN pin is connected through the switch to the Drain pin on the JFET.

@hueblo The second diagram is the correct one. The pairs are: 3.3v & Shutdown. EN & Drain.

@SidSilver Nope, sorry.
Oh sorry I thought the tracks were vertical (because of the schematic)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest