Tackling Graceful Shutdowns on the GBZ

Various user-contributed guides for software-related things
User avatar
Camble
Posts: 885
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 488 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Camble » Sat Jul 23, 2016 6:41 am

Just a quick update.

Using GPIO4 (physical pin 7) instead of UART TX and adding the following into /boot/config.txt reduces the time on bootup from 8-10 seconds to 5 seconds. This means you only have to wait half the time after powering on before switching off to ensure a graceful shutdown.

Code: Select all

dtoverlay=gpio-poweroff,gpiopin=4,active_low="y"
Thanks @Popcorn :D

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Sat Jul 23, 2016 8:34 am

According to this, anything that happens in the first through third stage bootloader wouldn't corrupt your SD card anyway. The SD gets mounted after the Kernel is booted. So even if you were to shutdown within the first 5 seconds, your system should still be safe from SD corruption, which is the whole point of this thing.

Image

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

Re: Tackling Graceful Shutdowns on the GBZ

Post by Camble » Sat Jul 23, 2016 8:35 am

@Popcorn Well that's awesome. Even more peace of mind.

User avatar
Popcorn
Trailblazer
Trailblazer
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Popcorn » Sun Jul 24, 2016 8:47 am

Camble wrote:@Popcorn Well that's awesome. Even more peace of mind.
Great news. Do you have the wiring diagram and component list for your alt MOSFET solution? I want to try to build one and modify the instructions on my monitor to match. Thanks!

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

Re: Tackling Graceful Shutdowns on the GBZ

Post by Camble » Sun Jul 24, 2016 3:56 pm

@Popcorn It's all here.

[edit] I've updated the guide to include an alternative circuit, for use with the original DMG-01 switch. No need to buy a fancy switch at all!

Artist_block
Posts: 11
Joined: Wed Jul 27, 2016 8:49 pm
Been thanked: 4 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Artist_block » Wed Jul 27, 2016 11:00 pm

Hey Camble. I'm I bit confused, your shutdown circuit is almost identical to this one. https://www.raspberrypi.org/forums/view ... 42#p781542 https://www.youtube.com/watch?v=3hhhXcmpcac So is your circuit supposed to delay the powerboost from powering down, just long enough to for the pi to cycle down?

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

Re: Tackling Graceful Shutdowns on the GBZ

Post by SidSilver » Thu Jul 28, 2016 12:33 am

Artist_block wrote:Hey Camble. I'm I bit confused, your shutdown circuit is almost identical to this one. https://www.raspberrypi.org/forums/view ... 42#p781542 https://www.youtube.com/watch?v=3hhhXcmpcac So is your circuit supposed to delay the powerboost from powering down, just long enough to for the pi to cycle down?
It looks like the same but it's not.
Instead of the capacitor acting as a count down, Camble as wires to the pi to have a signal of the actual pi shutdown.
So the powerboost is powered off only when the pi is actually off.

With the capacitor you have to wait a fixed time that may be too long and in some cases can be too short and damage your SD because of a bad shutdown.

User avatar
alien0matic
Posts: 102
Joined: Wed Jun 08, 2016 7:20 am
Has thanked: 15 times
Been thanked: 23 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by alien0matic » Fri Jul 29, 2016 6:09 am

I did the part with the low battery warning on my GBZ, but as soon as the LED starts blinking, the screen starts to switch on and off, the sound gets on and off, too. I did all this a few weeks back and I thought I had it wired wrong, but this doesn't seem to be the case.
Is there any advice on how to find the error? Will try to do a video of it if this helps.

User avatar
day
Posts: 134
Joined: Thu Jul 07, 2016 10:08 am
Has thanked: 87 times
Been thanked: 189 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by day » Fri Jul 29, 2016 6:32 am

maybe your calibration is not correct and you need to set a slightly higher value of "low battery" level ?

User avatar
alien0matic
Posts: 102
Joined: Wed Jun 08, 2016 7:20 am
Has thanked: 15 times
Been thanked: 23 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by alien0matic » Fri Jul 29, 2016 9:50 am

To get the facts straight:
Sound and screen starts to shut off and on when the power is low. I'm trying to figure out what is wrong. If the LED is fully light there is 3V on the GPIO pin.

edit:
So, I just added debug messages to the python script. The lowBattery callback is never called. The only thing I can trigger it to be called is when I measure the resistor with my multimeter. Someone please give me an advice on where to look. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest