Tackling Graceful Shutdowns on the GBZ

Various user-contributed guides for software-related things
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 11:17 am

Ganreizu wrote: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.
Thanks

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 » Wed May 18, 2016 2:55 pm

chiz wrote:@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. ;)
Yes, I just bought 47k resistors and a 2N3904
transistor to tackle this. It costs a couple cents in components. The low battery indicator will run off of the Powerboost and feed a GPIO which triggers shutdown as I originally planned. So, no harm, no foul.

BUT, I'm going to experiment with running the BATT lead off the Teensy at the same time as well. If it doesn't work, I'm ok with abandoning it. But if it does work, I'm going to look at also building a battery gauge which is independent from the graceful shutdown project. I just want to see what's possible. But the overall impact on performance would be next to nil. Not a concern. It doesn't even need to be running constantly either. It could poll, update the battery indicator and then sleep for 5mins and then rinse and repeat. Most likely it would be part of the daemon and it would just be sitting idle mostly.

Regarding prerunnerseth, yes, he is planning to build an all in one PCB that combines the Teensy and the Powerboost and also have built-in GPIO triggers with a backup hardware-based power down function. However, you should still be able to use my daemon with it.

If you haven't bought your Powerboost or your Teensy yet, you should probably wait to see how this develops. I'm definitely excited to see. If you have bought those components already, what I'm working on should solve this also.

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 2:59 pm

Wouldn't we need both of those anyway? Powerboost to play while charging and teensy to program as gamepad to be able to do multiple inputs?

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 » Wed May 18, 2016 3:19 pm

Ganreizu wrote:Wouldn't we need both of those anyway? Powerboost to play while charging and teensy to program as gamepad to be able to do multiple inputs?
I'm only reiterating what he said before. From my understanding, he's building a replacement for both of those boards. He sees the Teensy as overkill/a waste. But I don't wanna speak for him. Wait for prerunnerseth to chime in, I'm sure he'll clarify.

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 » Wed May 18, 2016 7:42 pm

Popcorn wrote:
Ganreizu wrote:Wouldn't we need both of those anyway? Powerboost to play while charging and teensy to program as gamepad to be able to do multiple inputs?
I'm only reiterating what he said before. From my understanding, he's building a replacement for both of those boards. He sees the Teensy as overkill/a waste. But I don't wanna speak for him. Wait for prerunnerseth to chime in, I'm sure he'll clarify.
Teensy is completely seperate and wont be needed for my solution. My Solution will replace the Powerboost though. I want to offer a complete power management solution that will handle shutting down the RPi gracefully. I hope to get some time with my demo board this week. once i verify it functions in real life the way the simulation works I will do the layout and order boards. Will probably be a couple weeks before I have something in hand on a custom PCB.

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 » Wed May 18, 2016 7:59 pm

@popcorn

I need an active high or active low ti indicate that shut down has completed. I cant rely on the pin just going dead (high Z). Is this what you are getting? I can detect the internal pull up on a pin and watch for it to decay after shutdown, but if the pin doesn't go high fast enough during startup then we will have an issue. An active pin assertion is best.

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 » Wed May 18, 2016 9:07 pm

prerunnerseth wrote:@popcorn

I need an active high or active low ti indicate that shut down has completed. I cant rely on the pin just going dead (high Z). Is this what you are getting? I can detect the internal pull up on a pin and watch for it to decay after shutdown, but if the pin doesn't go high fast enough during startup then we will have an issue. An active pin assertion is best.
You can do this no problem using the GPIO-poweroff driver. Once configured in boot/config.txt, it will go active high on successful shutdown. I tested this and mentioned it all the way back on page 1 or 2 of this thread. I know that's alot to weed through. Hehe.

My version works a bit differently in that going dead will shut off the pololu switch, which is what we want.

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 » Thu May 19, 2016 5:40 am

Popcorn wrote:
prerunnerseth wrote:@popcorn

I need an active high or active low ti indicate that shut down has completed. I cant rely on the pin just going dead (high Z). Is this what you are getting? I can detect the internal pull up on a pin and watch for it to decay after shutdown, but if the pin doesn't go high fast enough during startup then we will have an issue. An active pin assertion is best.
You can do this no problem using the GPIO-poweroff driver. Once configured in boot/config.txt, it will go active high on successful shutdown. I tested this and mentioned it all the way back on page 1 or 2 of this thread. I know that's alot to weed through. Hehe.

My version works a bit differently in that going dead will shut off the pololu switch, which is what we want.
Fantastic! Thats exactly what I want.

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 » Thu May 19, 2016 7:06 am

@popcorn

I have my circuit running wonderfully, but having and have the Kill command running awesome too using GPIO power-off. ONly thing I'm missing is the daemon to detect when to shutdown from a command from the controller. Can you share where you found the information?

THanks

I think i found it... are you using the python script?

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 » Thu May 19, 2016 11:09 am

IT'S ALIVE!!!!!..... my prototype is working AWESOME!..... With switch and push button!. Ill take a video after work.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest