User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Powering by MOSFET, why undervoltage lightning bolt?[SOLVED]

Fri Mar 17, 2017 1:56 am

Do you know why I'm getting undervoltage warnings on my B+ even though I'm seeing better than 4.92V on output from my MOSFET?

I started with a 12" Anker cable with a 2.4A supply and 3m USB extension cable. (I believe the extension cable is 22 gauge.) Confirmed it booted up OK on this combination. No lightning bolts. Cut the Anker cable (and cried :lol:), attached it to a FQP30N06L MOSFET which is connected to a GPIO on an Arduino 3.3V Pro Mini clone. It boots just fine -- except the lightning bolt.

On the Pi the Drok USB meter says 4.95V and my Dr. Meter says 4.92V, both of which are well above the under voltage threshold of 4.65V. Drok meter says current consumption is around 440mA and the undervoltage warning disappears if current is less, about 300mA or so.

When not connected to the Pi and turned on via Arduino GPIO the MOSFET shows 3 ohms Drain-Source which according to Ohm's Law should be able to deliver up to 1.64A. (4.92V / 3 ohms = 1.64A) The Arduino puts out 3.2V when the GPIO is high and the threshold of the MOSFET is 1V. So the Arduino and MOSFET should in theory be sufficient for the task.

I'm using HDMI, two USB Wi-Fi adapters and a keyboard. The supply has never thrown the under voltage warning until I inserted a MOSFET. If I unplug one of the two adapters, current in use drops below 300mA and the warning disappears.

Using Raspbian Jessie lite, freshly updated.

Ideas?
Last edited by SlowBro on Fri Mar 17, 2017 6:39 pm, edited 1 time in total.

klricks
Posts: 7300
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 2:24 am

Where are you measuring voltage? You need to measure 5V at GPIO pin 4 or 6 and any ground such as a port shield.
The 4.65V threshold circuit is behind the 'polyfuse' so you can't measure at the input power supply or cable.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 2:27 am

Ok. I was measuring at the MOSFET which is essentially before the Polyfuse. Tomorrow will try it as you said.

User avatar
Burngate
Posts: 6374
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 10:33 am

SlowBro wrote:When not connected to the Pi and turned on via Arduino GPIO the MOSFET shows 3 ohms Drain-Source which according to Ohm's Law should be able to deliver up to 1.64A. (4.92V / 3 ohms = 1.64A)
There might be an error in your thinking.

Yes, with 4.92v across 3Ω 1.64A will flow, but you haven't got that voltage across the FET - it's across the Pi, with almost nothing across the FET.
SlowBro wrote:The Arduino puts out 3.2V when the GPIO is high and the threshold of the MOSFET is 1V. So the Arduino and MOSFET should in theory be sufficient for the task.
The threshold may be 1v (the datasheet says 1v is the minimum, with 2.5v maximum) but you want it to pass 440mA with almost no voltage loss, so that the full 5v is across the Pi.

There have been lots of threads, here, regarding thin power supply cables.
What you are doing is creating a high resistance power supply.
SlowBro wrote:On the Pi the Drok USB meter says 4.95V and my Dr. Meter says 4.92V, both of which are well above the ]under voltage threshold of 4.65V. Drok meter says current consumption is around 440mA and the undervoltage warning disappears if current is less, about 300mA or so.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:05 am

klricks wrote:You need to measure 5V at GPIO pin 4 or 6 and any ground such as a port shield.
Drops to 4.74V at pin 4, which is still above the threshold, though not by much. But after boot the voltage rises above 4.82V and I still get the lightning bolt.

Where can I see what the threshold currently is, and is there also a current threshold?

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:07 am

Burngate wrote:There might be an error in your thinking.
Quite probable, this is the first time I've worked with MOSFETS :)
Burngate wrote:The threshold may be 1v (the datasheet says 1v is the minimum, with 2.5v maximum) but you want it to pass 440mA with almost no voltage loss, so that the full 5v is across the Pi.
So what resistance should the FET read if all is as it should be? I could try driving the gate higher with an NPN and in fact I'm going to try that now.
Last edited by SlowBro on Fri Mar 17, 2017 11:09 am, edited 1 time in total.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:08 am

Use a different MOSFET: one with low RDS_ON *and* capable of being driven fully on by 3V3 or 5V logic as you prefer.

The resistance should be as low as possible - 10's of milli ohms.

I use FDN304P for a high side switch on the 5V rail. You could take a leaf out of the RPi engineers book & use the same DMG2305UX p-channel MOSFET they do on the model B's.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:14 am

gregeric wrote:Use a different MOSFET: one with low RDS_ON *and* capable of being driven fully on by 3V3 or 5V logic as you prefer.
What do you consider to be a low RDS? And also, the one I'm using is listed as logic-level in the datasheet. But the Vgs on page one is 10V so it may be a higher level of logic.

RDS for mine is listed as 0.045 ohms max at 5V, which is better than the FDN304P you are using, so I'm confused.

Since I'm seeing 3 ohms I know the voltage isn't optimal, so I'm going to try to drive the gate higher with a PN2222A. That should take care of any low voltage gate concerns.
gregeric wrote:I use FDN304P for a high side switch on the 5V rail. You could take a leaf out of the RPi engineers book & use the same DMG2305UX p-channel MOSFET they do on the model B's.
I might do that. I put in an order for an Arduino relay and some TIP120s last night; I could also use a P-channel like you said, and just tie its gate to 5V with an NPN to turn it on.

PiGraham
Posts: 4206
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:31 am

SlowBro wrote:And also, the one I'm using is listed as logic-level in the datasheet. But the Vgs on page one is 10V so it may be a higher level of logic.
That will be the maximum, not the threshold. Looking at that SParkfun page spec I see:
VGS(th) Gate Threshold Voltage VDS = VGS, ID = 250 µA 1.0 -- 2.5 V
You should ensure that you have >2.5V on the gate w.r.t. the Source to turn the device fully on, although some of these device could turn fully on at just 1v

nicolap8
Posts: 576
Joined: Mon Mar 13, 2017 9:45 pm

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:38 am

Hi,
some toughs. Assume:
Vin = 4.92 V
Iout = 0.400 A (the current that effectively came out of mosfet)
Rdson = 3 ohm
for the Ohm law:
Vout = Vin - Rdson * Iout = 3.72 V
This because the mosfet resistence (Rdson) "consumes" some current (warms up).
With your calculation of I = 1.64 you have that Vout = 0!!!

I think that you misread the datasheet in some point:
the resistance between D and S is called Rdson and is from datasheet < 0.045 Ohm (so assume it's two time = 100 milli Ohm ;-) (and note also graph 8) but measuring this low resistance is not simple, you require a good multimeter. Remember that also the connections have some resistence (a thin cable has a lot).
For more usable numbers you must look at graphs from page 3: try to draw your work point and you will see the magic!

Vgs is the voltage that "open" the mosfet. Look at the top right graph in page 3: with 3 V you can expect more that 10 A but this value is lowering fast with less volt. You say that is 1 V but this is the minimum, the maximum is 2.5V but only for Vds = Vgs and Id = 250 micro A!!!
But the top left graph says that with 5 Vds and 3.3 Vgs you will have only 6 to 9 A.
Ever assume the worst for you... it's safer!

You got the under voltage threshold of 4.65V (warning: the USB under voltage thresold is 4.75 V) so doing some calculations:
Vin = 4.92 V
Vout = 4.60 V
I out = 0.400 A
R = (Vin - Vout) / Iout = 800 milli Ohm

Thanks to my (bad) experiences I learned not to trust USB cables... it's the first thing to check.
Nicola

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 11:41 am

PiGraham wrote:You should ensure that you have >2.5V on the gate w.r.t. the Source to turn the device fully on, although some of these device could turn fully on at just 1v
Yep, there is 3.2V driving it.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 12:04 pm

Sorry, I didn't read beyond the strapline of your MOSFET's datasheet
• 32A, 60V, RDS(on) = 0.035Ω @VGS = 10 V
and assumed it wasn't driveable directly by logic levels. It appears it should be OK however - problem must lie elsewhere, or it's the sum total of all those little resistances there & elsewhere adding up to give you issues.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 12:15 pm

SlowBro wrote:Since I'm seeing 3 ohms I know the voltage isn't optimal, so I'm going to try to drive the gate higher with a PN2222A. That should take care of any low voltage gate concerns.
Same voltage as before :-/ 4.74V at GPIO pin 4, which is above the voltage threshold anyway so I still don't know why I'm getting the warning. The FET resistance with the NPN driving it is now 0.0 ohms. Frustrating.
gregeric wrote:problem must lie elsewhere, or it's the sum total of all those little resistances there & elsewhere adding up to give you issues.
Should I need to tie in also the shielding on the Anker maybe? Maybe it's not getting a good ground.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 3:17 pm

nicolap8 wrote:Hi,
some toughs. Assume:
Vin = 4.92 V
(..)
You got the under voltage threshold of 4.65V (warning: the USB under voltage thresold is 4.75 V) so doing some calculations:
Vin = 4.92 V
Vout = 4.60 V
Ok let me stop you right there. 4.92V was what is coming out of the MOSFET, and is Vout. Further, voltage on the other side of the fuse all the way at GPIO pin 4 is 4.74V to ground on the Ethernet shield.
nicolap8 wrote:Thanks to my (bad) experiences I learned not to trust USB cables... it's the first thing to check.
Mine as well, so in the opening post I mentioned I am using a known-good, tested Anker cable that worked fine right up to the moment I cut it and inserted the MOSFET.

And now the MOSFET is being driven at 5V with 0.0 ohms measured, so I think it's safe to rule out low gate voltage.

I'm next going to splice the shielding on both halves of the cable back together and see if that fixes it. Also need to test the end to end resistance.

If that isn't the problem I may give up in favor of a transistor or relay. A MOSFET is preferred though as this is a battery powered device so I'd rather not drive a relay. Will do it if I must. Maybe a latching relay?

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 4:02 pm

Another possibility, is it maybe introduced ripple current that the meter is not seeing? Maybe the ripple valleys are dipping below 4.65V but the average is 4.74V. How could I tell? I have some snap on ferrites.

PiGraham
Posts: 4206
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 4:19 pm

SlowBro wrote:Same voltage as before :-/ 4.74V at GPIO pin 4, which is above the voltage threshold anyway so I still don't know why I'm getting the warning. The FET resistance with the NPN driving it is now 0.0 ohms. Frustrating.
Are you measuring the voltage with a calibrated meter? It's reasonable to expect most meters to be better than +/-0.1V, but unless you know your meter is better than that (because it's calibration is up to date and better than that) maybe your 4.74V is really 4.64V.

Have you checked the voltage on an oscilloscope? Perhaps the average level is OK but it dips with load enough to trigger the warning. I would expect there to be some smoothing on the warning to that short dips produce steady low voltage indications.
If this is a problem a good size capacitor (Perhaps 100 to 1000 microfarad) across the supply pins of the Pi might help.

Given you report that a small extra load makes a difference this is something marginal.

And of course if you use a power supply that outputs a slightly higher voltage that will sort this out.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 5:47 pm

Shielding is now good but still no difference.
PiGraham wrote:Are you measuring the voltage with a calibrated meter?
I do not have a high quality meter to calibrate against, but what I do have are two different meters by two different companies and both show the same voltage within 0.01V. For what it's worth, both meters have high ratings on Amazon.
PiGraham wrote:Have you checked the voltage on an oscilloscope?
I have a Gabotronics Xprotolab scope but haven't yet learned how to use it :-/
PiGraham wrote:Perhaps the average level is OK but it dips with load enough to trigger the warning. I would expect there to be some smoothing on the warning to that short dips produce steady low voltage indications. If this is a problem a good size capacitor (Perhaps 100 to 1000 microfarad) across the supply pins of the Pi might help.
Maybe I'll just stick a largish cap and ferrite on it and see what happens.
PiGraham wrote:And of course if you use a power supply that outputs a slightly higher voltage that will sort this out.
Are you saying that because I asked about ripple? Because the same supply worked great without the MOSFET. Still works great; I just plugged in a different cable and no lightning bolt.
Last edited by SlowBro on Fri Mar 17, 2017 6:22 pm, edited 1 time in total.

drgeoff
Posts: 11247
Joined: Wed Jan 25, 2012 6:39 pm

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 6:07 pm

Where is the MOSFET? In the +5 volt supply to the RPi or in the ground return to the PSU?
Quis custodiet ipsos custodes?

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 6:08 pm

drgeoff wrote:Where is the MOSFET? In the +5 volt supply to the RPi or in the ground return to the PSU?
Ground return.

SlowBro wrote:Maybe I'll just stick a largish cap and ferrite on it and see what happens.
Well it's somewhat better. Lighting bolt stays on for the last 10 seconds of boot and about 20 seconds after boot it disappears. I can make it reappear with cat /dev/zero > /dev/null. Idle current is about 380mA with no lightning bolt. Only comes on above about 400mA. Voltage at pin 4 now is around 4.82V idle and drops to about 4.78V running the stress test.

I had put a beefy ferrite on the cable after the MOSFET and a 470uF cap between the leads on that same cable.

Any good tutorials you recommend for how to learn my Xprotolab scope? :-)

User avatar
mikronauts
Posts: 2817
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 6:25 pm

"and 3m USB extension cable" 22ga

I'd try a better USB extension cable...
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: Powering by MOSFET, why undervoltage lightning bolt?

Fri Mar 17, 2017 6:39 pm

mikronauts wrote:"and 3m USB extension cable" 22ga

I'd try a better USB extension cable...
Holy cow, you're right. I just bypassed the cable and no lightning bolt.

I had ignored this because the cable worked great before making changes.

Thanks so much, mikronauts! And everyone who offered solutions.

I don't understand why that worked though. The only thing I added is a 470uF ripple capacitor, a 300k ohm resistor to the gate, and the MOSFET, with its 0.0 ohms. The Arduino is powered on a separate supply. So there shouldn't be that much more juice flowing through the cable from before.

I only know that it works, not why. Oh well.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: [SOLVED]Powering by MOSFET, why undervoltage lightning b

Fri Mar 17, 2017 7:32 pm

Camera stress test!

My camera came in the mail today so I thought why not see how voltage performs? Tadaa. I set it to continuously capture for 10 seconds. Current spiked to 520mA and no lightning bolts.

Image

PiGraham
Posts: 4206
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: [SOLVED]Powering by MOSFET, why undervoltage lightning b

Fri Mar 17, 2017 8:50 pm

That's good news.
I think the cable did not "work great before". It probably just worked near the limit and the addition of the MOSFET pushed thing too close to the limit, so that it still worked, but the warning was triggered when the current spiked.
The cap smoothed out the spikes and the cable change moved you away from the limit.
The main thing was the cable, but there were multiple factors, including a PSU outputting <5v

OTOH, the MOSFET was fine.

User avatar
SlowBro
Posts: 169
Joined: Sat Feb 18, 2017 1:30 am

Re: [SOLVED]Powering by MOSFET, why undervoltage lightning b

Sat Mar 18, 2017 10:33 am

PiGraham wrote:That's good news.
I think the cable did not "work great before". It probably just worked near the limit and the addition of the MOSFET pushed thing too close to the limit, so that it still worked, but the warning was triggered when the current spiked.
The cap smoothed out the spikes and the cable change moved you away from the limit.
The main thing was the cable, but there were multiple factors, including a PSU outputting <5v

OTOH, the MOSFET was fine.
The PSU puts out 5.20-5.21V; at least that's what both meters say. But yes I can understand the explanation of the cable moving me close to some limit.

Now to calibrate my meters.

Hey I asked earlier and no one replied: Where in the software can I view the current and voltage limits? Some config file?

klricks
Posts: 7300
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: [SOLVED]Powering by MOSFET, why undervoltage lightning b

Sat Mar 18, 2017 2:55 pm

SlowBro wrote:....Hey I asked earlier and no one replied: Where in the software can I view the current and voltage limits? Some config file?
There is no software. It's all done in hardware...
The 4.63V threshold is defined by the APX803-46SAG chip (U4). See schematic at grid location 2C:
https://www.raspberrypi.org/documentati ... EDUCED.pdf

The data sheet shows for the -46 part has a tolerance range of 4.63V +- 7mV
https://www.diodes.com/assets/Datasheets/APX803.pdf

This means the threshold can vary some between different RPi boards.

Current used by the RPi board is limited by a special type of fuse often called a 'polyfuse' (F1 on the RPi board).
The 'polyfuse' on the RPi 3B is rated at 2.6A (Hold Current). If the user attempts to draw more than the rated hold current then the fuse will heat up and increase in resistance. If the current reaches the Trip Current rating then the power will be totally shut down. The Trip Current rating is typically 2X the Hold Current. If operated between these limits the RPi will become unstable.... showing lightning bolt icon... USB devices quit working......Random reboots etc etc.
The polyfuse will self heal or reset when cooled down. Usually overnight is sufficient to mostly reset it.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Return to “Troubleshooting”