Tackling Graceful Shutdowns on the GBZ
- Oxodao
- Posts: 131
- Joined: Wed Jun 01, 2016 11:35 am
- Location: 127.0.0.1
- Has thanked: 4 times
- Been thanked: 30 times
- Contact:
Re: Tackling Graceful Shutdowns on the GBZ
Saint memmie, marne France, 51470
That would be nice
Yeah that's maybe what I'll endup doing if there is no other way
That would be nice
Yeah that's maybe what I'll endup doing if there is no other way
Arduino sketch for the gamepad (Teensy replacement): http://github.com/oxodao/GBZGamepad
-
- Posts: 56
- Joined: Thu May 05, 2016 5:32 pm
- Location: WI, USA
- Has thanked: 2 times
- Been thanked: 10 times
Re: Tackling Graceful Shutdowns on the GBZ
@Camble Were you able to try the MOSFET solution with both MOSFETs yet? If so, do you have an original DMG-01 power switch or are you using a true DPDT switch? I'm trying to figure out if this will be doable with the original power switch (the wiring diagram for it suggests it will not work if I'm reading it correctly and I won't be able to test it with my Raspberry Pi Zero for a few days until I get my mini HDMI adapter in the mail).
- 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
I'm using a DPDT switch.Quatrerwin wrote:@Camble Were you able to try the MOSFET solution with both MOSFETs yet? If so, do you have an original DMG-01 power switch or are you using a true DPDT switch? I'm trying to figure out if this will be doable with the original power switch (the wiring diagram for it suggests it will not work if I'm reading it correctly and I won't be able to test it with my Raspberry Pi Zero for a few days until I get my mini HDMI adapter in the mail).
I've been working at that for a while now, but only making slow progress. The depletion MOSFET was turning back on as soon as I flipped the power switch, meaning the PowerBoost would shut off instantly. At the moment I've got EN shorted to ground through a large resistor. When I flip the switch, this pulls EN up to BAT, turning on the PowerBoost. This works just fine, but the LEDs on the PowerBoost flicker all the time. I'm trying to come up with a timed solution which cuts this pull-up after a few seconds to allow the Pi to take over.
Right now I'm waiting on delivery of some N-Channel JFETs to try out. They're already a few days late or I would have probably posted my results by now.
It's not difficult to build a small timer circuit which delays power off for a set time. But this isn't as elegant and there's always the risk that the Pi doesn't safely shut down in time. I've been pulling my hair out with this at times, but I'm sure there has to be a way to do it.
Last edited by Camble on Thu Jul 14, 2016 7:42 am, edited 1 time in total.
Re: Tackling Graceful Shutdowns on the GBZ
Isn't 4€ cheap?Oxodao wrote:My problem is that the Pololu is not available nowhere cheap from france...
Sure, shipping isn't, but it gets fine if you're not buying only this
- Oxodao
- Posts: 131
- Joined: Wed Jun 01, 2016 11:35 am
- Location: 127.0.0.1
- Has thanked: 4 times
- Been thanked: 30 times
- Contact:
Re: Tackling Graceful Shutdowns on the GBZ
Inb4, shipping... I have nothing else to buy... even less on this site that has not much..
4€ pololu + 20c 47k resistors ... 4.20€ products, 5.90€ shipping...
I don't plan on buying anything else...
4€ pololu + 20c 47k resistors ... 4.20€ products, 5.90€ shipping...
I don't plan on buying anything else...
Arduino sketch for the gamepad (Teensy replacement): http://github.com/oxodao/GBZGamepad
-
- Posts: 56
- Joined: Thu May 05, 2016 5:32 pm
- Location: WI, USA
- Has thanked: 2 times
- Been thanked: 10 times
Re: Tackling Graceful Shutdowns on the GBZ
I can't figure out why you would need a resistor between the EN and GND pins or even any timing circuit to control this.Camble wrote: I'm using a DPDT switch.
I've been working at that for a while now, but only making slow progress. The depletion MOSFET was turning back on as soon as I flipped the power switch, meaning the PowerBoost would shut off instantly. At the moment I've got EN shorted to ground through a large resistor. When I flip the switch, this pulls EN up to BAT, turning on the PowerBoost. This works just fine, but the LEDs on the PowerBoost flicker all the time. I'm trying to come up with a timed solution which cuts this pull-up after a few seconds to allow the Pi to take over.
Right now I'm waiting on delivery of some N-Channel JFETs to try out. They're already a few days late or I would have probably posted my results by now.
It's not difficult to build a small timer circuit which delays power off for a set time. But this isn't as elegant and there's always the risk that the Pi doesn't safely shut down in time. I've been pulling my hair out with this at times, but I'm sure there has to be a way to do it.
If I'm reading the diagram right nothing should be connected through the switch when the switch is on (pins 5 & 6 active), so there would be no current flowing between the drain and source. When you turn the switch off (pins 1 and 2 active), GPIO27 connects to GND on the raspberry pi, pulling it low, initializing the shutdown. Now there could be current flowing between the drain and source (EN and GND), but GPIO14 should be set to high already, keeping the depletion MOSFET off. Only when the raspberry pi shuts off (or prematurely pulls GPIO14 low) should the EN and GND pins be connected. I could see for a brief moment there might be no gate-source voltage once the switch is flipped, but I'm wondering if putting the main switch on the drain instead of the source would fix that or if that would cause any issues.
I haven't actually been able to try the MOSFET solution yet, but I will be able to soon (the remainder of the parts I need just shipped!). I could be wrong since I don't have much of a background in electronics yet. I'm really interested in the rest of your findings regarding this solution though!
- 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
@Quaterwin
[spoiler="If you mean this diagram..."][/spoiler]
It doesn't work. The PowerBoost shuts off as soon as the MOSFET's source is connected to ground. A resistor over the gate and source might prevent this, but I'm unsure. I'll test it out this weekend.
I'm working off this at the moment, so you can see why the pull down resistor is there between EN and GND. EN is pulled up manually by connecting it to BAT. Once the Pi boots, a GPIO pin takes over to keep EN high.
Because the above solution uses a momentary switch I've been trying to use the depletion MOSFET to cut this pull up after turning on the Pi. My first idea was to add a delay with a capacitor, but I've ditched this in favour of using the GPIO pin to keep the EN high and also turn off the MOSFET.
Progress is slow as I'm kind of in the same boat when it comes to electronics.
[spoiler="If you mean this diagram..."][/spoiler]
It doesn't work. The PowerBoost shuts off as soon as the MOSFET's source is connected to ground. A resistor over the gate and source might prevent this, but I'm unsure. I'll test it out this weekend.
I'm working off this at the moment, so you can see why the pull down resistor is there between EN and GND. EN is pulled up manually by connecting it to BAT. Once the Pi boots, a GPIO pin takes over to keep EN high.
Because the above solution uses a momentary switch I've been trying to use the depletion MOSFET to cut this pull up after turning on the Pi. My first idea was to add a delay with a capacitor, but I've ditched this in favour of using the GPIO pin to keep the EN high and also turn off the MOSFET.
Progress is slow as I'm kind of in the same boat when it comes to electronics.
Last edited by Camble on Fri Jul 15, 2016 3:24 am, edited 1 time in total.
-
- 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
Very interesting.
I've done the Popcorn Pololu solution, it's nice but need a switch to poweroff the powerboost when not used.
If I understand what you are working on Camble, it seems better as the powerboost is switched of automatically.
If you manage to make it works, I think I'll switch to it.
I've done the Popcorn Pololu solution, it's nice but need a switch to poweroff the powerboost when not used.
If I understand what you are working on Camble, it seems better as the powerboost is switched of automatically.
If you manage to make it works, I think I'll switch to it.
Last edited by SidSilver on Fri Jul 15, 2016 3:28 am, edited 1 time in total.
- 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
The monetary switch works very well. Hold the button for a few seconds and the Pi boots. Everything shuts down cleanly as you'd expect. The problem is only due to the slide switch. If you were to continue to hold the power button, the charging LEDs on the powerboost go haywire. That can't be a good state for it to be in.SidSilver wrote:Very interesting.
I've done the Popcorn Pololu solution, it's nice but need a switch to poweroff the powerboost when not used.
If I understand what you are working on Camble, it seems better as the powerboost is switched of automatically.
Who is online
Users browsing this forum: No registered users and 1 guest