48 Replies Latest reply on Sep 5, 2017 3:43 PM by ntewinkel

    Capacitor to smooth out Raspberry Pi power dips?

    ntewinkel

      I recently was trying to do a few things with a Pi3, and it consistently hung when I tried to update the system (sudo apt-get update/upgrade). It did everything else well enough, so I wonder if that's power related, with the upgrade making the WiFi work extra hard - maybe not, but I thought I'd look into it.

       

      I've also noticed that my older Pi1 will hang once in a while (every few months), and that's a bit of an issue now that I'm using it as my sprinkler controller - reliability has become much more important.

       

      While searching for help online, I noticed peteroakes did some research and made a nice blog entry explaining the role the USB cables have in the power issues. (Thanks Peter!)

       

      In a nutshell, some cables cause a voltage drop that puts the supply too far below the ideal 5v voltage level for the Pi.

      The problem is that once in a while the Pi draws enough power to make the voltage dip into the danger zone.

      (Some places sell adapters with a higher voltage to compensate. AdaFruit, for example sells a 5.25v adapter for the RPi, and notes that 5.25v is still within the specifications for USB, so even with a perfect no-loss USB cable that should be safe.)

       

      One notable item, to me, was that the Pi has some serious power dips on a regular basis, regardless of the cables - just that the better supplies+cables start with higher levels at the Pi and the dips don't take it down too far.

       

      So here's my thought - capacitors are supposed to help against dips and spikes, right?

       

      Is there a way to add some really big capacitor at the Pi side to help avoid such dips (and maybe spikes too) ?

       

      I'm thinking VIN-GND with a 1,000+ uF cap? I have one rated 1,000 at 10v, also I see 1,800 at 16v, both should handle 5v-ish well.

       

      Otherwise, maybe splice a USB cable to add the large cap near the micro-USB plug end?

       

      Will that cause trouble? Will it help at all?

       

      Thanks!

      -Nico

        • Re: Capacitor to smooth out Raspberry Pi power dips?
          shabaz

          Hi Nico!

           

          I'm not sure that an update/upgrade would consume a lot of power, the things that would do that would be all four cores processing, and all four NEON processors working away too. Then the Pi consumes around 7W or more. It could still be a power issue however, especially if you're running a long USB cable and not using the official Pi 3 supply (which has very fat cables and slightly higher than 5V as you say). A big capacitor might help, if the demand really is for short bursts. Any of the ones you suggest would be fine.

          If you do need to run it from a long distance, then a good solution is to have a power supply local to the Pi, e.g. a 12V to 5V DC-DC converter, so that you can power it from a higher voltage from a distance.

          6 of 6 people found this helpful
          • Re: Capacitor to smooth out Raspberry Pi power dips?
            Frederick Vandenbosch

            Those power dips sound strange!

             

            I'm able to run a Pi 3 with official touch screen on a single 5.1V/2.5A official power supply. Occasionally the little lightning symbol pops up, but certainly no hanging.

             

            What are the specs of your power supply? Have you tried another?

            3 of 3 people found this helpful
              • Re: Capacitor to smooth out Raspberry Pi power dips?
                rachaelp

                Whilst the Pi3 typically shouldn't be causing power supply dips, Nico does say that there are voltage drops in his wiring so I suspect it's a wiring issue and it's not taking too much extra current to cause additional drops.

                 

                Nico, if you have confirmed a significant voltage drop across your wiring, then personally I would just fix the reason you have the large drop. As others have said, it shouldn't be drawing significant current with what you are doing. You could prop the voltage up at the Pi end with big capacitors but you're just masking the issue rather than fixing it and you're likely to see the problem reoccur if you run something that really does start to draw significant current at which point no sensible amount of added capacitance will save it from dying.

                 

                Best Regards,

                 

                Rachael

                4 of 4 people found this helpful
                • Re: Capacitor to smooth out Raspberry Pi power dips?
                  ntewinkel

                  Thanks Frederick,

                   

                  >What are the specs of your power supply? Have you tried another?

                  I tried a few, including a Samsung 5V2A charger for my Nexus 10, and an Apple iPad (2) charger. And then I saw Peter's post about cables often being the issue - my testing then confirmed that to be true, so I picked out the better cables I have, and ordered some adapters with the higher starting voltage (5.25v) to compensate for cable losses. I also bought some USB ends to solder up my own (power-only) cables using some larger gauge wires to see if that helps.

                   

                  My question was more about the dips at the Pi end being a concern.

                   

                  (my Pi1 sprinkler controller has a charger from a 7" Android tablet, not sure of the specs but it's behaved well for the most part)

                   

                  Thanks,

                  -Nico

                    • Re: Capacitor to smooth out Raspberry Pi power dips?
                      Roger Wolff

                      My question was more about the dips at the Pi end being a concern.

                      Well.... The pi will boot (which seems to be a bit more demanding in my testing) fine with the voltage at the pi being 2.8V or 2.9V. It kept running down to a few hundred mV less, as long as it had completed the boot process.

                       

                      So for the pi to crash you need pretty serious dips....

                       

                      If you say your cable is OK, then the pi is simply pulling the powersupply into an overcurrent condition or something like that.

                      1 of 1 people found this helpful
                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                    mcb1

                    I'm thinking VIN-GND with a 1,000+ uF cap

                    The rule of thumb for filter capacitors is 1,000 uf per amp as the absolute minimum.

                    This assumes the load is constant, but for your power dip issue, you really need to be looking at 10-20,000uF to be sure.

                    You can try the other values and stick it across the 5v on the GPIO pins.

                     

                    You should be able to measure the 5v lines to see what you are actually getting.

                    The GPIO is probably a good and easy place to get to.

                     

                     

                    IMO most of the issues are the power supply themselves.

                    I've run them from 700mA Samsung chargers with tiny leads while other 'genuine' supplies were below 5v.

                    Most of the 'chargers' are simply a device to provide 5 ish volts to a phone to charge a 3.6v lithium battery, and were never designed to be a stable smooth 5.x volt power supply.

                     

                    You could have a mains issue, but with a switchmode supply (as most are nowdays) it should handle it.

                     

                     

                    I don't suppose it's some dodgy software hobbled together by someone in some small backwater town ...

                    Mark

                    3 of 3 people found this helpful
                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                        Roger Wolff

                        .... 1000uF / A ....

                         

                        That rule of thumb is from the old days with linear power supplies. So... to build a 1A 5V powersupply you'd take a 9V tranformer, rectify it and place a cap there. The peaks of the 9V transformer output are near 12.7V. That would put the capacitor near 11.3V. With a linear regulator like a 7805, you n eed 8V at its input. So you have 3.3V to work with. So for a capacitor the formula is: I = C dV/dt = 1000uF * 3.3V / 10ms =  0.33A. Not quite enough yet for 1A of current! Doing the math is better than using the rule-of-thumb.

                         

                        When you start putting a capacitor on your 5V line, an important question is: How much drop can you tolerate? Well. I've experimented and my raspberry keeps on working fine down to about 3V. But that's the pi only. USB or HDMI peripherals (like HDMI->VGA converters) may require something above that 3V or even 4V.

                         

                        So we need figures like the extra current draw, how long that happens, and what voltage difference we're going to tolerate. The formula is I = C dV/dt which can be reworked to C = I . dt / dV . Put in numbers like I=2A, dt = 10ms and dV = 0.2V and you get an answer for the capacitor you need. With the numbers I've suggested you need 0.1F, or 100 times more than the 1000uF you suggested... .Math to the rescue.

                        6 of 6 people found this helpful
                          • Re: Capacitor to smooth out Raspberry Pi power dips?
                            mcb1

                            rew

                            I bow to your maths, and yes it was for linear supplies. 

                             

                            The ripple would have been 5v on mine Vripple = I / 2 x freq x C (F)  or 1 / 2 x 100 x .001F = 5v. which would be below the regulator minimium of 8v.

                            Most of the time 5v supplies were not the norm, it was for valve equipment ....

                             

                             

                            I've noted that it is only the HDMi that complains when it gets below about 4.7v or so and that was with the older Pi.

                            Presumably Nico is missing the odd cycle or half cycle in his supply, or he has a power supply that can't deliver the goods.

                             

                            Mark

                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                Roger Wolff

                                The pi has a voltage-monitor that is used to show the lightning symbol on the screen, and play with the red led. It triggers below 4.65V nominal.

                                 

                                I've measured the pi itself. It runs fine downto below 3V. At 3.3V and lower you're starting to go outside specs for various chips, but they behave well enough to keep things running "outside spec".

                                 

                                But the 5V from the input is passed on to the HDMI as well as to the USB ports. It depends on what you have there if it will keep on working or not. Grab an USB harddisk enclosure, and it won't work on a pi... At all... (at least some of them...) So... it depends on what you have for experience of what you say works and what doesn't work. Below 4.65V you quickly enter the area where things are "out of spec" for the "should be 5V nominal" outputs of the pi on HDMI and USB.

                                3 of 3 people found this helpful
                                • Re: Capacitor to smooth out Raspberry Pi power dips?
                                  ntewinkel

                                  >Presumably Nico is missing the odd cycle or half cycle...

                                   

                                  My wife always says I'm a few cycles shy of a full sine wave

                                  (well, she uses knives-in-drawers and bricks-in-loads analogies, as well as elevators-not-quite-going-to-the-top and something about marbles having gone missing)

                                   

                                  I do indeed have some crap power supplies. But also some that appear (appear being keyword) to be quality.

                                  Coupled with crap USB cables that I didn't realize would be a factor.

                                   

                                  Mostly my question was because of reading Peter Oakes' findings on how greatly the USB cables affect voltage at the Pi - we're talking drops of a half volt in many cases.

                                   

                                  Thanks,

                                  -Nico

                                   

                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                ntewinkel

                                >I don't suppose it's some dodgy software hobbled together by someone in some small backwater town ...

                                 

                                Nah that stuff is solid!

                                (the sprinkler controller is actually not my work - it's OpenSprinkler.com, but the kitty-cam.. that kitty-cam is solid like a rock!)

                                 

                                The hanging was happening on a Pi3 with the latest Raspbian image just freshly copied to it (redid that again to make sure).

                                 

                                 

                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                niteowl12

                                Wouldn't it be easier to use an O'Scope to measure the input voltage during the "hang" to make sure that voltage drop is the actual problem? This would be my first step because I would think it highly unlikely that an update would use enough extra current to drop the voltage enough to cause a micro to stop functioning.

                                 

                                Is the Pi controlling the sprinkler system through logic control or is it actually providing the power to a valve?

                                 

                                 

                                 

                                10uf Cap

                                 

                                1000uf Cap

                                 

                                 

                                 

                                Notice the drop in voltage is about the same with a 2A jump in current. R1 in the schematic represents the incoming wire resistance to the Pi. If all the power to the Pi and sprinkler run through that one wire then I would focus on fixing that. Use two separate wires or one large one. That resistance will be the primary driver for voltage drop.

                                3 of 3 people found this helpful
                                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                                    Roger Wolff

                                    Jason, that's a very good suggestion. Usually it is quite difficult to catch "occasional" problems. But for power supply sagging problems you can indeed put the scope in "normal" mode (as opposed to "single" or "auto") and set the trigger point at say 4.5V. Then you'd end up with a trace of "the event" when it eventually triggers. On the other hand, not everybody has an oscilloscope.

                                     

                                    The other part of your suggestion: Solenoids, relays and the likes will often generate strong EMI pulses. Those can also create havoc with the reliability of systems...

                                    3 of 3 people found this helpful
                                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                                        ntewinkel

                                        >Solenoids, relays and the likes will often generate strong EMI pulses.

                                         

                                        True, and I've had issues with that in other projects in the past (aka "learning experiences" ), involving Arduino with LCD and relays resetting when the relays went on.

                                         

                                        In this case, it's a blank Pi3 (fresh Raspbian image) going through an update, sitting on my desk with nothing going on. I might try an older image also as part of my tests.

                                        (The Pi1 sprinkler controller is a separate thing)

                                         

                                        Thanks,

                                        -Nico

                                        1 of 1 people found this helpful
                                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                                        ntewinkel

                                        >Wouldn't it be easier to use an O'Scope

                                        Sadly I don't have one, but I do have a TI tester that can graph voltage, that may do the trick (not sure if it's fast enough).

                                         

                                        >Is the Pi controlling the sprinkler system through logic control or is it actually providing the power to a valve?

                                        The sprinkler Pi is my old Pi1, and it's mostly stable - it hangs every few months randomly, before sprinkling season had started (ie, just sitting there idling, with the sprinkler software on but not powering the valves). I just ran a full sprinkling round (3 hours) last night and the veggie gardens this morning, and it's still running properly.

                                        It uses the same methods as OpenSprinkler.com - the Pi provides logic to shift registers, which turn on Triacs that pass the 24VAC power to the valves.

                                         

                                        The issue of hanging was during update of a Pi3 that I was just trying to set up for a different project.

                                         

                                        Thanks for running those tests and the resulting graphs! From what I see, it looks like a capacitor wouldn't really make any difference - is that correct?

                                         

                                        And the conclusion being pretty much what everyone else was saying - upgrade the power supply.

                                         

                                        When I have a chance, I'll try that Pi3 update again while gathering some numbers, maybe through a wired Internet connection too as one of the tests.

                                         

                                        Thanks,

                                        -Nico

                                         

                                          • Re: Capacitor to smooth out Raspberry Pi power dips?
                                            shabaz

                                            Hi Nico!

                                             

                                            I'm still not sure it is a supply issue since the power consumption shouldn't increase during an update/upgrade significantly, but if all you have is a 1000uF capacitor and no oscilloscope I don't think there is anything wrong with just trying it, if you suspect that a combination of your PSU and the USB cable are making things just marginal. It all depends on how marginal, and for how long you're getting high current spikes (if that is what is occurring, because it is speculation, but sometimes we have to speculate).

                                            If the spikes were short and infrequent (e.g. 1msec spikes) and the current demand was around 1A (I don't think the Pi ever consumes 2A unless you've got extra hardware attached; and 1.4A, i.e. around 7W, takes all cores to be performing a workload), and if the supply voltage can drop from 5V by a volt and still continue operation on the Pi 3, then a 1000uF capacitor may well help.

                                            Maybe an interesting project would be a low-voltage detector LED  that lights up for a second even on short drops in voltage : ) There are ICs that will approximately do this (ICs for handling brownouts).

                                            3 of 3 people found this helpful
                                            • Re: Capacitor to smooth out Raspberry Pi power dips?
                                              niteowl12

                                              Yes, the capacitance on the input to the Pi would probably not fix the issue you are having. Upgrading the power supply and the USB cable would help greatly but the post you mentioned also included wire gauge and current ratings. A typical USB port can only supply 1.5A anyway. 

                                               

                                              From some of the things you've said I wonder if there is a memory leak in some of the software its running. Maybe try monitoring memory usage during runtime and record the numbers over time? I have done some scripting in my early days that crashed an i7.   

                                              1 of 1 people found this helpful
                                                • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                  ntewinkel

                                                  >I wonder if there is a memory leak

                                                  The Pi1 sprinkler hang could indeed be a software issue. During the sprinkling season I'll probably remote-desktop into it once in a while to give it a good old fashioned reboot.

                                                   

                                                  The Pi3 is a different story, as it's a blank install of Raspbian (Pixel), latest version direct from RaspberryPi.org

                                                  For that I think I just need to take some more time to test and measure, maybe also trying an older image.

                                                   

                                                  Thanks,

                                                  -Nico

                                                    • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                      mcb1

                                                      The Pi3 is a different story, as it's a blank install of Raspbian (Pixel), latest version direct from RaspberryPi.org

                                                      I'd try a new card.

                                                       

                                                      We had a similar situation with a dashcamera the other week.

                                                      Card had been recording during the trip down, but stopped recording although the camera thought it was quite happy.

                                                      Card could be written to in a computer, but wouldn't record using the camera, even after deleting the files that were on it.

                                                       

                                                      There is a fair amount of reading and writing going on during an update, so to be hanging during this suggests the card.

                                                      Mark

                                                      2 of 2 people found this helpful
                                                        • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                          ntewinkel

                                                          Well here's something interesting...

                                                           

                                                          I tried your suggestion of using a different SD card, but this time I decided to do the update/upgrade via the GUI while connected to the TV.

                                                           

                                                          Turns out the Pi3 isn't hanging as I had previously thought! - it's dropping the WiFi connection during the upgrade. With the TV and GUI I can reconnect the WiFi, but previously I was doing it via remote-desktop and so of course that would look like a hang from that perspective (and it was as good as a hang as I couldn't get to it at that point).

                                                           

                                                          So I think the card I was using might be alright after all (I'll try it again at another time).

                                                           

                                                          And the whole time the Pi3 is running, the GUI is showing that lightning bolt complaining about power issues. grrrr... So I suspect the dropped WiFi may be related to power issues after all... dunno.

                                                           

                                                          I'm using an iPad 2 charger at 5.1 volts and 2.2 Amps, so you'd think that would be plenty. I used what I thought was my "best" USB cable too. I might try a few other combinations to get an idea of what works best.

                                                           

                                                          Oh, and I remembered my less-than-accurate way of testing the USB cables - I just plugged them into my phone charger on one end and into my phone on the other end, and picked the "better" cables being the ones where the phone showed lower "minutes until fully charged". There was a difference of about 30 minutes between them.

                                                          So I ordered a couple of micro-usb port breakout modules off eBay to allow more accurate testing in the future - plus those will be handy for powering breadboards too.

                                                           

                                                          Thanks again for all the advice (that goes to everyone else too!), I very much appreciate it.

                                                           

                                                          For now, I'll just wait for the new power supplies to arrive

                                                          In the meantime, I'll try to keep the Pi3 WiFi usage to a dull roar instead.

                                                           

                                                          Thanks,

                                                          -Nico

                                                            • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                              ntewinkel

                                                              Oh and one other thing that may be suspect, that I keep forgetting about...

                                                               

                                                              I'm using a little wireless keyboard - a small dongle plugs into the usb port. I think it's bluetooth.

                                                               

                                                              However, when I was using remote desktop that was not connected (and the USB dongle was not in it).

                                                               

                                                              edit: it still gives that lightning bolt without the wireless keyboard USB dongle connected.

                                                               

                                                              Cheers,

                                                              -Nico

                                                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                mcb1

                                                                ntewinkel

                                                                The Ipad chargers are rated at that, but they need to sense the device at the end in order to deliver it.

                                                                 

                                                                There was an article in Silicon Chip regarding the voltage required on the data pins, in order to force them into giving the required amount.

                                                                 

                                                                Tablet chargers are also a hidden mystery as my daughter found out in Japan when she took a normal charger.

                                                                It seems that many detect the hardware and will bump the voltage to 15v out the USB socket to facilitate charging the tablet.

                                                                The rest of the time they are a plain looking 5v USB socket supply.

                                                                 

                                                                 

                                                                Nice to see there is some progress and yes the devices hanging off the USB can sometimes be the problem.

                                                                 

                                                                 

                                                                Mark

                                                                3 of 3 people found this helpful
                                                                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                    Roger Wolff

                                                                    I built an USB-cable testing setup once. And I ran a bunch of my cables through the tester. The resistance of the cables came out between less than 200mOhm to more than 4.5 ohm!

                                                                     

                                                                    The best was 22CM Magnet Flat Short 5Pin Micro USB Data Charger Cable Cord For Samsung HTC XC | eBay  in the ugly pink...

                                                                    2 of 2 people found this helpful
                                                                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                        mcb1

                                                                        I have no doubt some cables are worse than other.

                                                                        I've seen the insides and the solder joints......

                                                                        2 of 2 people found this helpful
                                                                          • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                            gdstew

                                                                            It's more a matter of the wire gauge used for the power pins than anything else. Cheap USB cables will use 28 AWG (gauge) wire for all connections, better ones will use two different

                                                                            gauges, one for power and another for the data signals. Most (but not all) of the USB cables I have bought have the wire gauges printed on them and when they do the lower number

                                                                            (lower gauge equals larger wire) will be the one used for power.  When trying to run 1.5 amp or more through the USB cable you need to have at least 22 AWG for power. The

                                                                            biggest problem I have with that is that when looking to buy USB cables over the net they very rarely list the wire gauge(s) used so either a lot of searching or buying local are about

                                                                            the only ways to find good cables. Note that cable length can also be a problem so I try to use 1.8m (6 ft.) or shorter cables for power.

                                                                            4 of 4 people found this helpful
                                                                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                ntewinkel

                                                                                >when looking to buy USB cables over the net they very rarely list the wire gauge(s)...

                                                                                 

                                                                                Totally! After reading Peter's peteroakes blog post, I started looking for cables with thicker wires, but exactly like you noticed - they rarely show wire gauges, and the times I did see gauges listed, they were not stand-out sizes.

                                                                                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                    gdstew

                                                                                    I have upon occasion found USB cables on Ebay with the wire gauges listed, however I am always wary about the accuracy of listings on Ebay. I also came

                                                                                    across a set of 3 - 6" and 3 - 3' micro-USB connector to type A USB connector cables some from a company called Sabrent on sale at Newegg that specifically

                                                                                    mentioned that they used 22 AWG wires. That particular set is apparently no longer available at Newegg however on a quick Google search for Sabrent USB

                                                                                    cables it also shows up at Amazon, Fry's, and Walmart with single cable and cable sets using 22 AWG wire. One disadvantage of the thicker wire is the cables

                                                                                    are less flexible and I think the Sabrent cables use 22 AWG on all four wires because they are very stiff.

                                                                                     

                                                                                    Another thing I've found useful are the inexpensive USB volt/amp display meters at Ali Express. Some have both micro-USB and regular USB type A inputs

                                                                                    and they are accurate enough for most uses. Some even come with switchable 1 and 2 amp resistor loads that plug into the meters USB outputs (they do

                                                                                    GET HOT). They're not particularly useful for catching fast transient type problems but are fast enough to get a reasonably good look during normal use.

                                                                                    I bought the Sabrent cable set from Newegg specifically to use the 6" ones with one of these meters to test all of the USB output power "wall warts" I bought

                                                                                    as well as to watch the voltage supply and current usage of several Raspberry Pis and other "Pi like" SBCs with different attached hardware and program

                                                                                    running loads.

                                                                                    3 of 3 people found this helpful
                                                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                ntewinkel

                                                                Here's an update...

                                                                 

                                                                I received one of the new power adapters a few days ago and tried it last night.

                                                                It's a Keyestudio 5.25v / 2.4A "highly regulated switching power supply". The first feature it mentions is compatibility with Raspberry Pi requirements. It's intended as a proper power supply - the cable is directly attached, and it says the wires are 20awg.

                                                                 

                                                                I put my multimeter on 5v and GND and saw that at startup it was at exactly 5.25v, which then goes to about 5.20v while running, and down to about 5.16v while doing work.

                                                                This is at multimeter display refresh, so there may be quick details I can't see without an oscilloscope of course.

                                                                 

                                                                The point is that I no longer see the power-warning lightning bolt, and the WiFi connection appears to be much more stable - although it did disconnect once still during testing.

                                                                 

                                                                Also, it wasn't my SD card as I first thought - I was able to run the updates for both SD cards I tried it with.

                                                                 

                                                                So I think the lesson here is to use proper power supplies, not chargers (as so many people have said so many times!).

                                                                 

                                                                And the other part of the lesson is to not blame the power supply for everything - in my case the dropped WiFi was causing my troubles, because due to it being a remote-desktop connection it became inaccessible, making it look like it was hanging.

                                                                 

                                                                Cheers,

                                                                -Nico

                                                                4 of 4 people found this helpful
                                                                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                    ntewinkel

                                                                    Another update, in case people are curious...

                                                                     

                                                                    My sprinkler Pi2 went unresponsive again on the weekend (last reset was 2 weeks earlier), so I decided that was a good time to switch power supplies for it - I had been using a 5v 2A tablet charger, so I now have it on the aforementioned Keyestudio power adapter.

                                                                     

                                                                    I then took the tablet power supply and put it on my Pi1 cat-video system (it plays videos for cats, LOL yes). It right away showed the coloured block at the top right indicating poor power supply.... hmmm interesting!

                                                                     

                                                                    So for the Pi1 I went back to a 2-usb-port charger supply (a cheap eBay one) that I'd been using for it, and the video flickers constantly, sometimes even keeping a blank screen - but no power-warning icon. So that video flicker issue I was trying to fix by changing config settings appears to be due to the poor power supply too. (ps, it's an old monitor with HDMI-to-DVI adapter)

                                                                     

                                                                    I have a different power adapter still on the way, but it's taking the scenic route. I'm curious as to how it will perform.

                                                                     

                                                                    Cheers,

                                                                    -Nico

                                                                    4 of 4 people found this helpful
                                                                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                        ntewinkel

                                                                        Another update - the Sprinkler-Pi has been running reliably since the previous update, with the Keyestudio power adapter.

                                                                         

                                                                        The other adapter (5v, 3A) came in a few weeks ago and the kitty-tv Pi seems to be happy running on it - no power warnings, no flickering on/off video. (I haven't run this Pi a lot though).

                                                                         

                                                                        So it does seem that my problems were related to power, and the lesson I'm walking away with is that Raspberry Pis should be powered by purpose-built power adapters, not cellphone or tablet chargers.

                                                                         

                                                                        -Nico

                                                                    • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                      peteroakes

                                                                      It still comes down to the power supply in your case. Increasing the power supply to 5.25 is compensating for the voltage drop on the cables from the brick to the PI. Also the brick can in itself be dropping volts under load. Still within specifications but still adding to the issue.

                                                                       

                                                                      A USB Tablet adapter is a funny thing, some are really good quality and have regulated outputs (Geniune Apple Tablet ones for example or Samsung) but not all. Adding a capacitor at the PI end can help but it can also hinder in that during power up it can draw too much current and cause the brick to current limit while it tries to charge those big ass caps. Depending on the power brick this can recover or spin into a loop of shut down and power up

                                                                       

                                                                      Any USB type charger that is used also has a big question over the quality of the USB lead between it and the PI, if it does not say the wire gauge on the plastic sleeving then it may be a crap one, good enough for charging a phone or for data usage but not powering something that relies on the delivered power levels, In my testing I found some horrific ones and a few good ones. also a common trick is to use thin wire and really thick insulation to give the illusion of a good lead. loading the PI end with a 5 ohm or 2.5ohm resistor will quickly identify a bad lead / power brick in a way that can easily and reliably be measured (1A or 2A load but steady load), if this does not pass then there is no way it will pass on the PI reliably either.

                                                                       

                                                                      So, I have found that the purpose built power supplies for the PI are a good way to go, I would still be hesitant to go to 5.25V as this is right on the 5V +-5% limit and any surge could cause a problem. Most of the official PI ones are 5.1V and 2.5A and only have a figure 8 cable (Two separate multi strand conductors, think speaker cable), not USB cable, and the wire is pretty thick, at a whopping 18AWG.

                                                                       

                                                                      24AWG is 0.025 Ohms per foot

                                                                      22AWG is 0.016 Ohms per foot

                                                                      18AWG is 0.006 Ohms per foot

                                                                       

                                                                      so for a typical 6 foot lead (12 feet of wire, remember the return path too) at 2 Amps

                                                                       

                                                                      24 AWG = 2 * .025 * 12 = 600 mV lost... ouch

                                                                      22 AWG = 2 * .016 * 12 = 384 mV lost

                                                                      18 AWG = 2 * .006 * 12 = 144 mV lost

                                                                       

                                                                      So as you can see, even without physical measurement the 24 awg cable is a lost cause to supply a PI under load unless it is less than 1 foot long and this is assuming the power supply itself maintains the 5V out under load, some dont. The official PI PSU with 18AWG can easily supply 2A and more on a 6 foot lead.

                                                                       

                                                                      So in conclusion, the PI is designed with a USB connector for its supply, this does not mean unfortunately that the PI will work with all the range of the USB specifications, not even close

                                                                        • USB Specification for volts MAX  nominal volts = 5.00 +0.25 −0.60 V  so anything from 4.4V to 5.25, this is MAX not under normal operation too and if you use a 5.25V supply, your risking your pi or other USB device you may connect to it.
                                                                        • raspberry PI is 5V +0.25 - 0.25 or to put it another way, 4.75 to 5.25V
                                                                        • The one thing I have not yet mentioned is that if a power supply for the PI is a full functioning USB specification PSU, it may limit the power delivered even though it is able to supply more, if the PI does not signal the current requirements. I dont know if t does.
                                                                      3 of 3 people found this helpful
                                                                        • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                          gdstew

                                                                          "Also the brick can in itself be dropping volts under load"

                                                                           

                                                                          I've found quite a few of the cheap USB chargers will not produce 5V at the rated current. I've seen as low as 4.6V which is of course well out of spec. I personally want

                                                                          at least 4.9V - 4.95V at rated current before I will use it.

                                                                           

                                                                           

                                                                          "if it does not say the wire gauge on the plastic sleeving then it may be a crap one"

                                                                           

                                                                          I've found quite a few that do have the wire gauge printed on them that are still crap, usually 28 AWG on all conductors, sometimes 28/26-24 AWG. At least you can tell

                                                                          by looking at them. I've also noticed that some of the current "Pi rated" supplies use a 4 ft. power cable instead of 6 ft. which helps a little.

                                                                           

                                                                           

                                                                          "I would still be hesitant to go to 5.25V as this is right on the 5V +-5% limit and any surge could cause a problem"

                                                                           

                                                                          Most ICs have a maximum voltage rating in their specs that is well above 5% of the nominal rating, usually around 6V to 7V for 5V devices specifically to handle surges on the power

                                                                          supply. It is not a good idea to test this specification on a regular basis.

                                                                           

                                                                           

                                                                          "So in conclusion, the PI is designed with a USB connector for its supply, this does not mean unfortunately that the PI will work with all the range of the USB specifications, not even close"

                                                                           

                                                                          and

                                                                           

                                                                          "The one thing I have not yet mentioned is that if a power supply for the PI is a full functioning USB specification PSU, it may limit the power delivered even though it is able to supply more, if

                                                                          the PI does not signal the current requirements. I dont know if t does."

                                                                           

                                                                          No USB host device is required to work with all the range of the USB specifications. The specification was specifically designed to allow a range of minimum current requirements (the

                                                                          minimum amount of current required to be supplied by a USB host is 50 mA) mainly to allow battery powered or otherwise low powered devices to use USB. A USB host device should always

                                                                          provide 5V +- %5. The 4.4V voltage rating is for hub devices to allow for voltage drops through chained hub devices powered by the USB host. I believe that two chained hubs is the maximum

                                                                          and 4.4V is the minimum for the second hub in the chain.

                                                                          3 of 3 people found this helpful
                                                                            • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                              Roger Wolff

                                                                              Some minor corrections:

                                                                              A device is allowed to draw up to 100mA before negotiating the "upgrade" to 500mA. The host is allowed to refuse to upgrade, meaning the device should stay in the lower-power-consumption mode.

                                                                               

                                                                              An official host is supposed to work with all conforming USB slaves (and the other way around). Restrictions may apply. So a host supporting 12mbps (USB 1.0 and 1.1!) will not communicate any faster than 12mbps with a more recent USB slave. And with the power... the host is allowed to refuse to provide anywhere between the minimum of 100 and 500mA, and it should refuse to negotiate more if it can't provide it.

                                                                               

                                                                              Your statement is more from the actual situation: many hosts and slaves were designed to go outside the specifications. As a simple example we all know, the raspberry pi has an USB connector for power. The datapins are not connected, so the pi will not negotiate anything (=not conforming to spec). The pi will draw whatever it wants without negotiation (=not according to spec), and it will potentially draw more than 500mA (=not allowed by the spec).

                                                                              2 of 2 people found this helpful
                                                                                • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                  gdstew

                                                                                  "The datapins are not connected, so the pi will not negotiate anything (=not conforming to spec). The pi will draw whatever it wants without negotiation (=not according to spec),

                                                                                  and it will potentially draw more than 500mA (=not allowed by the spec).  "

                                                                                   

                                                                                  The Pi power connection is NOT a USB device nor was it ever intended to be used as one, it simply uses a USB connector. The USB connector was chosen mainly because

                                                                                  of the availability of USB chargers which also (usually) not USB devices. The USB A type connector is capable of handling 2A/pin, the micro connector 1.8A/pin (I was surprised

                                                                                  when the Pi 3 spec said that it could pull 2A since it is using the USB micro connector) so it is obvious that someone figured out that it might be used for other purposes.

                                                                                   

                                                                                  Thanks for the corrections on current negotiation, my memory ain't what it used to be and I couldn't find the chapter on power in my USB spec. But if I remember correctly, the

                                                                                  amount of current negotiated for is actually 100 mA  to 500 mA in 100 mA increments?

                                                                                  2 of 2 people found this helpful
                                                                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                ntewinkel

                                                                                Thanks for the feedback, Peter, and for the article you wrote that sparked my questions! (and answered a lot of my earlier questions)

                                                                                 

                                                                                >Peter writes...

                                                                                >I would still be hesitant to go to 5.25V as this is right on the 5V +-5% limit and any surge could cause a problem

                                                                                 

                                                                                AdaFruit sells a 5.25v supply specifically for SBCs. They're what I consider a reputable company, so I feel the risk isn't that high. (I may be wrong).

                                                                                https://www.adafruit.com/product/1995 https://www.adafruit.com/product/501

                                                                                "the perfect choice for powering single-board computers like Raspberry Pi"

                                                                                "...specifically designed to provide 5.25V not 5V ... to solve a problem that occurs often with USB-powered gadgets: they draw so much current that the resistance of the cable causes a voltage drop"

                                                                                 

                                                                                The Keyestudio one I picked up is rated 5.25v +/- 3% (which seems to come to max of 5.41v then). It has 20AWG wires too.

                                                                                 

                                                                                For the Pi end of things, I also kind of feel that any quality product designed for a specification max of 5.25v should easily be able to handle the additional 0.16 volts. Isn't there an engineering multiplication factor that gets applied, like ratings of snow-loads and bridges? I may be wrong there too

                                                                                 

                                                                                Cheers,

                                                                                -Nico

                                                                                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                    niteowl12

                                                                                    -Nico,

                                                                                     

                                                                                    The datasheet from the step down DC/DC shows that input voltage operating range is 2.5 to 5.5V and thats at the dc/dc input after a reverse protection FET/Diode and the wire from the wall unit to the board. I think you are safe even in the event of a surge.

                                                                                    1 of 1 people found this helpful
                                                                                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                        gdstew

                                                                                        The absolute maximum input voltage for the part is 6.5V so yes it is OK. As I wrote earlier, most parts are built to withstand voltages beyond the normal operating range

                                                                                        that you list. I will add to that as long as the maximum power rating for the device is not exceeded. These specs are normally found under the heading of Absolute

                                                                                        Maximum Ratings.

                                                                                        1 of 1 people found this helpful
                                                                                          • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                            peteroakes

                                                                                            Absolute MAX Ratings are not a guarantee of correct operation, only that it won't fry, also it is NEVER recommended to deliberately operate at max ratings.

                                                                                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                                ntewinkel

                                                                                                >Absolute MAX Ratings are not a guarantee of correct operation

                                                                                                 

                                                                                                I'm still learning how all these things really work (I still don't quite understand why pretty much all my 5v chargers underpower the Pi at idle), so bear with me here...

                                                                                                 

                                                                                                My understanding is that the 5.25v charger is not out of spec for the Pi, given that 5.25 is still in that "sweet" range. The absolute max rating is just there to protect from the odd unusual situation where it might spike a bit higher. That charger is not operating at 6.5v - at most it's supposed to hit 5.41 due to that possible +3% . As I see it, most of the time it will operate at a max of 5.25v, usually a few specs down from that, and very rarely a touch above it - ie, that odd unusual situation that is slightly above spec, but still well below the absolute max.

                                                                                                 

                                                                                                Also not sure when that +3% would happen (line voltage fluctuations?), as for the most part I was recording the voltage going down with use, which seems to be what people generally complain about - voltage drops.

                                                                                                 

                                                                                                I have a feeling this kind of question about hardware is similar to software students asking me why they need to separate out the data models

                                                                                                 

                                                                                                -Nico

                                                                                                  • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                                    Roger Wolff

                                                                                                    Components are specified with an "absolute max" rating. Above that, it might fry. No guarantees though.

                                                                                                     

                                                                                                    Depending on the component, you can go beyond the absolute max rating and sometimes you're left with a working component. For example, a 0.25W rated resistor will handle 1kW just fine, as long as it's short enough. On the other hand, I have mosfets rated for 25V, and that is really really close to the point where they break. Around 27V is where they start going bad. Note that I tested just one. So it could very well be that they generally end up tolerating 26-28V and I got a mediocre one.

                                                                                                     

                                                                                                    Anyway, those are absolute max. Then you often see "recommended" ratings. So oldfashioned opamps were specified at "works fine at 15V", and they have an 18V tolerance. I suspect that the 15V is allowed to be 10% high too, so it will probably work fine at 15V+10% = 16.5V. But in theory the component can stop working somewhere between the 15V and the 18V but it should work again next time you turn it on. In practise this is rare. Most components work to just above their absolute max and then simply die.

                                                                                                     

                                                                                                    Now, for the 5V on the pi there are many components involved. If someone found one of them that has a 6.5V absolute max, that's neat, but that doesn't mean that nothing else is connected to that 5V line. So you can't safely put your pi on 6.5V.

                                                                                                     

                                                                                                    To make things work, you have to take tolerances and imperfections into account. So if I have a component that signals a "high" with 3.3V, and another that interprets a signal as "high" starting at 3.3V then intheory things should work. But in practise, the wire between the two might cause the voltage to be only 3.2V at the recieving end, and then we have a problem. So margins dictate that the output is specified in a more strict way than what the input should tolerate.

                                                                                                     

                                                                                                    So powersupplies normally specify 5V nominal +/- 5%. So 4.75-5.25. On input when a device is marked as works-at-5V, then it should tolerate 5V nominal +/- 10%, or 4.5 to 5.5V.

                                                                                                     

                                                                                                    Normally the 0.25V margin allows for a voltage droop in the cable and things like that. The Adafruit 5.25V powersupply will compensate for that "expected" effect by sitting on the high end of the normal tolerances. 

                                                                                                     

                                                                                                    Now adafruit still has to BUILD those devices. We know they are aiming for 5.25V. But they can't make them infinitely accurate. So they have a tolerance on that too. The resistors they use to arrange for the output voltage to be 5.25V are probably specified to 1%. So they could easily end up with 5.25V + 1% = 5.30V (plus a little). So that's more than the 5.25V that we expected from a powersupply.

                                                                                                     

                                                                                                    Now you might say that we could adjust a potentiometer on the power supply in the factory to make it much more accurate. That won't work in practice, as components tend to change value both depending on environmental circumstances as well as due to aging. So if they finetune it to 5.25V +/- 0.1% then it still might end up at +1% when it's hot (or maybe when it's cold).

                                                                                                     

                                                                                                    But on the input side, most devices will tolerate up to 5.5V, so there is still some margin. But we've doubled the "cable droop" margin that we can tolerate. So in practice we'll be ok.

                                                                                                    1 of 1 people found this helpful
                                                                                                      • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                                        gdstew

                                                                                                        "On the other hand, I have mosfets rated for 25V, and that is really really close to the point where they break. Around 27V is where they start going bad. Note that I tested just one. So it could very well be that they generally end up tolerating 26-28V and I got a mediocre one."

                                                                                                         

                                                                                                        Was the absolute maximum rating for the MOSFET  25V or was that the maximum operating voltage ? If there is no absolute maximum rating in a spec sheet I always use a 10% - 15% reduction from

                                                                                                        the given spec or use a different part to get a proper safety margin when needed.

                                                                                                         

                                                                                                         

                                                                                                        "Now, for the 5V on the pi there are many components involved. If someone found one of them that has a 6.5V absolute max, that's neat, but that doesn't mean that nothing else is

                                                                                                        connected to that 5V line. So you can't safely put your pi on 6.5V."

                                                                                                         

                                                                                                        This part of the discussion was about the Pi power supply being able to safely handle surges when using a power source that was at or near the top end of the nominal working voltage

                                                                                                        not the maximum voltage input allowed for the Pi (still, can't be too careful).

                                                                                                         

                                                                                                        On the newer Pis (B+, 2, 3) the ones without proper schematics I'd like to add, the 5V input also goes directly to the circuit (the one that has never had a proper schematic for it published)

                                                                                                        that is used to handle the USB host 5V supply much better than the original Pis did. So there are other components connected to the Pi 5V input to take into consideration. BK5rA (U13) is

                                                                                                        described in the LAN9514 data sheet as a USB power switch and Googling it as "BK5rA USB power switch" gets a TI data sheet for the LM3525 Single Port USB power switch which has

                                                                                                        an absolute maximum input voltage of 6V. As far as I know (without proper schematics) everything else is 1.8V or 3.3V so it still looks OK.

                                                                                                        1 of 1 people found this helpful
                                                                                                          • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                                            Roger Wolff

                                                                                                            I think it may have been this MOSFET that I tested: https://assets.nexperia.com/documents/data-sheet/PSMN1R2-25YL.pdfII

                                                                                                             

                                                                                                            They say they guarantee operation at 25V, provided the temperature is above 25 degrees.

                                                                                                             

                                                                                                            When you design things, taking a 10% margin is appropriate. In this case, stuff like "ground bounce" or inductance in the wires coming from the battery and the capacitors may locally produce voltages above the rated 25V should you try to use these at exactly 25V. Moreover, if you read that datasheet carefully, the maximum voltage goes down, BELOW 25V when the temperature is not 25 degrees C. If you forget to read that, again that 10% margin will save you (it's only a few percent down to -40 degrees).

                                                                                                             

                                                                                                            If you prefer to take 10% margin on the rated 25V of a MOSFET, then you should also refrain from guessing that everything else will be OK... You're right. Things will probably be OK.

                                                                                                             

                                                                                                            Proper engineering says you try to keep a margin against ALL "absolute max" ratings. When pressed you've now come up with a second component we should've checked in the first place. What are the chances that you forgot antoher one?

                                                                                                             

                                                                                                            On the first pi, the 5V also goes to the CPU. The CPU has a built-in switcher to generate its own core voltage. I don't see the tell-tale peripheral components on a PI2 that I had handy. So maybe that's now in the "power circuit". But if that's the case, I don't know how the "overvolting" would still be possible. Is it?

                                                                                                             

                                                                                                            Anyway, with the lack of schematics, it is dangerous to make assumptions about the allowable voltage. If the foundation says 5.25, they know that their users would adjust a powersupply to 5.5V and get burnt by the surges caused by long wiring. So they take some margin. But the real max is likely 5.5V. IF you know what you're doing and have access to the schematics and all the datasheets, you could possibly find an even slightly higher limit. But I find that risky when we don't have a schematic. 

                                                                                                            1 of 1 people found this helpful
                                                                                                              • Re: Capacitor to smooth out Raspberry Pi power dips?
                                                                                                                gdstew

                                                                                                                "On the first pi, the 5V also goes to the CPU."

                                                                                                                 

                                                                                                                So the immediate question is what is the absolute maximum voltage for these pins and a second question is it also connected to the CPU/SoC on the Pi 2 and 3 ?

                                                                                                                 

                                                                                                                 

                                                                                                                "The CPU has a built-in switcher to generate its own core voltage"

                                                                                                                 

                                                                                                                Core voltage, RAM voltage, and GPU voltage. All of these can be adjusted by that CPU/SoC.

                                                                                                                 

                                                                                                                 

                                                                                                                "If you prefer to take 10% margin on the rated 25V of a MOSFET"

                                                                                                                 

                                                                                                                10% to 15% (at least get that right) maybe more depending on circuit requirements. Where the margin is applied depends on if the 25V rating was

                                                                                                                operational or absolute maximum.

                                                                                                                 

                                                                                                                 

                                                                                                                "then you should also refrain from guessing that everything else will be OK... You're right. Things will probably be OK."

                                                                                                                 

                                                                                                                The "guessing" is based on the specifications of the components provided by the manufacturer for ALL parts used in a circuit and for the environment

                                                                                                                (electrical, thermal, etc.) that the circuit will be exposed to, safety and reliability requirements, and experience with similar components and circuits.

                                                                                                                 

                                                                                                                 

                                                                                                                "Proper engineering says you try to keep a margin against ALL "absolute max" ratings."

                                                                                                                 

                                                                                                                I never said or in any way implied that it wasn't. Once again this is about using  5.25V for the Raspberry Pi power input and trying to determine if

                                                                                                                there is enough margin to prevent problems if ALL the components on the Pi connected to it were to subjected to voltage surges on that line which is

                                                                                                                exactly what you are saying to do so what argument are you trying to make here ?

                                                                                                                 

                                                                                                                 

                                                                                                                "When pressed you've now come up with a second component we should've checked in the first place. What are the chances that you forgot antoher one?"

                                                                                                                 

                                                                                                                I have no idea what your point is. Pressed for what? I simply found another component connected to the 5.25V supplied to the Pi and checked its specification

                                                                                                                to see if it could be a problem. And actually I did forget one, as you mentioned on the original Pis it is connected to the CPU/SoC so I need to check that spec

                                                                                                                too. And if it connected to the newer Pi 2 and 3 those specs needs to be checked as well.

                                                                                                                 

                                                                                                                 

                                                                                                                "If the foundation says 5.25, they know that their users would adjust a powersupply to 5.5V and get burnt by the surges caused by long wiring."

                                                                                                                 

                                                                                                                Citation ?

                                                                                                                 

                                                                                                                Most of the power supplies (the wall wort ones at least) are not adjustable although some of the ones that connect to the GPIO connector might be. Also

                                                                                                                every recommendation I've seen (and made in this thread no less) says to keep these wires short, following that advice is optional. I do believe that I have

                                                                                                                seen at least one 5.5V wall wort out there but I would not use it and I would advise anybody else that asked about it in this forum not to use it either.

                                                                                                                 

                                                                                                                 

                                                                                                                "Anyway, with the lack of schematics, it is dangerous to make assumptions about the allowable voltage."

                                                                                                                 

                                                                                                                I don't know about "dangerous". I do know that I would not use a Pi in a critical situation and being wrong could possibly let all the magic smoke out.

                                                                                                                Anyway, the "assumptions" being made are based on the available specifications of the parts known to be connected to it, the absolute maximum

                                                                                                                specifications of many, many, many (...) other different digital ICs from many different manufacturers in use over the past 40 years (and I've got two

                                                                                                                6' shelves stuffed with old data books, real books!, and almost a G Byte of PDF data sheets to prove it). OK, the switching regulator is actually analog

                                                                                                                but it was checked. Since there are no schematics available it is impossible to easily determine with absolute certainty (welcome to the real world) that

                                                                                                                this is not a problem. So I will change it to "probably OK".

                                                                                                                 

                                                                                                                Feel better ?

                                                                                                                1 of 1 people found this helpful