Tackling Graceful Shutdowns on the GBZ

Various user-contributed guides for software-related things
prerunnerseth
Posts: 279
Joined: Fri May 06, 2016 5:36 pm
Has thanked: 16 times
Been thanked: 229 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by prerunnerseth » Mon May 16, 2016 11:11 am

Popcorn wrote:
prerunnerseth wrote:
Popcorn wrote:Yeah, seems like this guy did something similar with the Powerboost and wiring it up to the LED led

http://www.stuffaboutcode.com/2016/01/p ... nitor.html

I didn't believe/know the Pi Zero had any onboard ADC. That's why I'm looking at the Teensy because there's a bunch of them that are unused on there.
So whats wrong with using this method? I thought you wanted to get a battery level and not just a lower battery indicator.
Nothing except if we use the Teensy, we get a battery level reading as a bonus. Going that route, we'd need to make a little breakout board, build a circuit and solder more components. I want to try to use what we have instead of adding more. That's the thought process anyway.
Yeah, thats a bit different direction than me. Im desigining a complete solution that you can wire into the Pi and have everything on the one board. I hate the idea of adding another processor to add more GPIOs when the Pi already has so many. I know people use the teensy because it was what they could get working, but to me its such a waste.. forces you to have a USB hub and such.

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 » Mon May 16, 2016 11:13 am

prerunnerseth wrote:
Popcorn wrote:
prerunnerseth wrote:
So whats wrong with using this method? I thought you wanted to get a battery level and not just a lower battery indicator.
Nothing except if we use the Teensy, we get a battery level reading as a bonus. Going that route, we'd need to make a little breakout board, build a circuit and solder more components. I want to try to use what we have instead of adding more. That's the thought process anyway.
Yeah, thats a bit different direction than me. Im desigining a complete solution that you can wire into the Pi and have everything on the one board. I hate the idea of adding another processor to add more GPIOs when the Pi already has so many. I know people use the teensy because it was what they could get working, but to me its such a waste.. forces you to have a USB hub and such.
That's ambitious and would be amazing to do. So you are plannig to replace the Teensy, Powerboost, and Audio Amp?

prerunnerseth
Posts: 279
Joined: Fri May 06, 2016 5:36 pm
Has thanked: 16 times
Been thanked: 229 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by prerunnerseth » Mon May 16, 2016 11:19 am

Popcorn wrote:
prerunnerseth wrote:
Popcorn wrote:
Nothing except if we use the Teensy, we get a battery level reading as a bonus. Going that route, we'd need to make a little breakout board, build a circuit and solder more components. I want to try to use what we have instead of adding more. That's the thought process anyway.
Yeah, thats a bit different direction than me. Im desigining a complete solution that you can wire into the Pi and have everything on the one board. I hate the idea of adding another processor to add more GPIOs when the Pi already has so many. I know people use the teensy because it was what they could get working, but to me its such a waste.. forces you to have a USB hub and such.
That's ambitious and would be amazing to do. So you are plannig to replace the Teensy, Powerboost, and Audio Amp?
The Teensy is mostly unneeded anyways unless you do want your ADC input for battery level indication. What I'm working on now is the power path and supply part of it. Here is my flow so far.

Switch turned on or button pressed - power turns on
Switch turned off or button pressed again - Interrupt sent to PI - Pi Shuts down - asserts kill command to power path controller - power cut
in the case of a frozen RPi - when the switch is turned off or button pressed again if no kill command is received from the RPi within 45 seconds then the power is cut anyways.

Low battery
LBO is asserted from the boost - Low battery icon presented on RPi Screen - If the RPi isnt shut down or plugged in within 2 minute the power is shut off anyways.

All other charger and boost functions would remain the same.

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 » Mon May 16, 2016 11:42 am

prerunnerseth wrote:
Popcorn wrote:
prerunnerseth wrote:
Yeah, thats a bit different direction than me. Im desigining a complete solution that you can wire into the Pi and have everything on the one board. I hate the idea of adding another processor to add more GPIOs when the Pi already has so many. I know people use the teensy because it was what they could get working, but to me its such a waste.. forces you to have a USB hub and such.
That's ambitious and would be amazing to do. So you are plannig to replace the Teensy, Powerboost, and Audio Amp?
The Teensy is mostly unneeded anyways unless you do want your ADC input for battery level indication. What I'm working on now is the power path and supply part of it. Here is my flow so far.

Switch turned on or button pressed - power turns on
Switch turned off or button pressed again - Interrupt sent to PI - Pi Shuts down - asserts kill command to power path controller - power cut
in the case of a frozen RPi - when the switch is turned off or button pressed again if no kill command is received from the RPi within 45 seconds then the power is cut anyways.

Low battery
LBO is asserted from the boost - Low battery icon presented on RPi Screen - If the RPi isnt shut down or plugged in within 2 minute the power is shut off anyways.

All other charger and boost functions would remain the same.
That logic sounds sound. And yeah, I could live without the battery level in your IC. It was just a nice-to-have. I will built one out with the teensy anyways since I've bought the thing and have it anyway. But, I still have 2 spare Gameboy cases so I might use your future board for a future build of one of those. Keep us posted. Sounds great!

User avatar
chiz
Posts: 228
Joined: Thu May 05, 2016 12:05 am
Has thanked: 29 times
Been thanked: 119 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by chiz » Wed May 18, 2016 4:21 am

@Popcorn

Regarding the over voltage thing going to the RPi's GPIO, can't we solve it using an inline resistor to reduce the voltage and still implement what you have? I'm fine with your solution until PRS completes the all-in-one charger/shutdown board. (Note: I've already ordered the Pololu switch :))

One concern that I have though is with the implementation of a battery level indicator overlay, if I'm not mistaken, it would need another process constantly running in the background and could impact overall performance esp. if we're talking Pi0 performance. To me the shutdown feature is the minimum we would need. Besides, the original GB didn't have a battery level indicator, just a low batt indicator. Yours is one step ahead by having an animation showing the time left to save before the system shuts down.

These mobile phones and tablets spoiled us with this battery icon that we now feel it's necessary. Just a thought. ;)

User avatar
Bubble
Posts: 35
Joined: Sun May 08, 2016 7:33 am
Has thanked: 7 times
Been thanked: 4 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Bubble » Wed May 18, 2016 4:34 am

Hello Popcorn ,
I've read the wall thread and try to understand what you where doing with my noobie electronics level ^^
It seems you've done what we were looking for and even more. This looks awesome !
Time for me to place an order. Wich version of Pololou do you recomend to follow your build ? 2808 pushbutton or 2810 slide switch ?
As a noob, my goal is to stick with your final diagram to avoid being lost.
Thanks for what you're doing and for sharing :D

User avatar
Ganreizu
Posts: 552
Joined: Thu May 05, 2016 8:20 am
Has thanked: 168 times
Been thanked: 97 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Ganreizu » Wed May 18, 2016 7:35 am

Bubble wrote:Hello Popcorn ,
I've read the wall thread and try to understand what you where doing with my noobie electronics level ^^
It seems you've done what we were looking for and even more. This looks awesome !
Time for me to place an order. Wich version of Pololou do you recomend to follow your build ? 2808 pushbutton or 2810 slide switch ?
As a noob, my goal is to stick with your final diagram to avoid being lost.
Thanks for what you're doing and for sharing :D
If you haven't bought the polulu i would just wait for the premade shutdown board to be available. If you want to do it yourself anyway i think it doesn't matter which one you get but the slide switch should work better.

User avatar
Fleder
Posts: 849
Joined: Thu May 05, 2016 9:04 am
Location: Germany
Has thanked: 183 times
Been thanked: 258 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Fleder » Wed May 18, 2016 8:15 am

Ganreizu wrote:If you haven't bought the polulu i would just wait for the premade shutdown board to be available. If you want to do it yourself anyway i think it doesn't matter which one you get but the slide switch should work better.
I am sorry, i haven't followed the whole thread yet.
Is there a PCB planned for this shutdown method? If so, what is the progress?
Thank you.

User avatar
Ganreizu
Posts: 552
Joined: Thu May 05, 2016 8:20 am
Has thanked: 168 times
Been thanked: 97 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Ganreizu » Wed May 18, 2016 8:25 am

Fleder wrote:I am sorry, i haven't followed the whole thread yet.
Is there a PCB planned for this shutdown method? If so, what is the progress?
Thank you.
Gotta ask @prerunnerseth but yeah he's making a PCB for this, and possibly a USB audio board after that, of which i will be buying both immediately.

User avatar
Bubble
Posts: 35
Joined: Sun May 08, 2016 7:33 am
Has thanked: 7 times
Been thanked: 4 times

Re: Tackling Graceful Shutdowns on the GBZ

Post by Bubble » Wed May 18, 2016 10:28 am

I went through prerunnerseth posts before to ask, but from my perspective, Popcorn's solution sounds really nice, because those components will be esaier to find around the world.
Custom PCBS are awesome, but accesibility is also the key in an open source project ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest