Page 31 of 37

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Mon Jul 18, 2016 4:23 am
by Camble
So the N-channel depletion MOSFET was working as intended, until the power switch was closed. Everything just shut off straight away.

I finally have a working solution, using a P-channel JFET connected to the EN pin of the PowerBoost.

I am not sure if the resistor is necessary when using a depletion FET, but it seems to have eliminated a weird intermittent problem with powering off.

The only thing with this setup is that you can't switch off during early boot-up.

Here's a video.

Image

Be sure to add the following to /boot/config.txt

Code: Select all

dtoverlay=gpio-poweroff,gpiopin=4,active_low="y"

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Mon Jul 18, 2016 4:36 am
by Quatrerwin
Looking forward to trying your solution! Thanks for your work!

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Mon Jul 18, 2016 4:51 am
by Camble
Cool, let me know how you get on! I'm thinking of adding a short RC delay on power-off, just to be completely safe. 2 seconds or something like that.

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Mon Jul 18, 2016 5:53 am
by Quatrerwin
I was thinking about adding a diode as well for some protection (raspberry pi gpio doesn't like voltages above 3.3V and I'm not sure what the current limit is)

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Mon Jul 18, 2016 6:00 am
by Camble
The UART TX pin is 3.3v and it shouldn't be receiving any current. It keeps the JFET's gate at +3.3v. A diode won't hurt, but I don't think it's necessary.

The GPIO27 pin is simply shorted to ground when you want to signal a shutdown, so no protection required here either.

Something that would be more useful is a way to prevent the UART voltage fluctuating to as low as 1v while the Pi boots up. After about 5 seconds of bootup, it stabilises at 3.3v, but if you close the power switch before this happens, the PowerBoost will shut off. Strange, because the minimum cut-off gate voltage for this JFET is 750mV. Maybe just not enough to pinch off. I might try playing with the voltages some more.

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Mon Jul 18, 2016 8:45 pm
by Quatrerwin
@Camble I'm playing around with the depletion MOSFET and I'm having difficulty turning it off. The MOSFET connects to the powerboost on the drain and source side (source going to ground, drain going to enable). The gate goes to the raspberry pi on the TXD pin. Since I have the raspberry pi zero getting its power from the powerboost, the ground is shared (I've also verified it). Is there any way you did the wiring to get it to work?

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Tue Jul 19, 2016 1:31 am
by Camble
@Quatrerwin What MOSFET are you using? Can you check the voltage across the gate-source when the Pi is powered?

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Tue Jul 19, 2016 5:48 am
by Quatrerwin
It would be this one: DN2530
At the terminals, gate-source voltage is 3.3V and the current is 40mA. I'm not sure if the positive voltage is an issue (I'm having difficulty imagining how to make it negative while still having the drain to source work). The drain is connected to the 5V source on the powerboost through an LED and resistor, the gate to TXD on the raspberry pi, and the source to the ground on the powerboost. Additionally I did try a 100k resistor between the gate and ground.

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Tue Jul 19, 2016 5:49 am
by Camble
You need a P-channel depletion MOSFET or a P-channel JFET.

2N5460

Re: Tackling Graceful Shutdowns on the GBZ

Posted: Tue Jul 19, 2016 5:55 am
by Quatrerwin
I'm waiting on my p channel JFETs to arrive. Were you able to get the n channel depletion MOSFET to work without one?