# My Raspberry Pi is losing power in a surge

I have an RC car. The battery provides power to the ESC and then the ESC provides 6 V back out to the receiver. Instead of the receiver I have a Raspberry Pi, which uses the 6 V, steps it down to 5 V and provides power to the Raspberry Pi.

### The problem

Every time we go full power*, there is a lack of voltage and the Raspberry Pi seems to hard reset.

* By full power we mean direct to 100% and not ranging from 0-100

I am not an expert in electrical circuits, but some of the suggestions are to use a capacitor to provide the missing 5 V in the interim. How do I prevent the Raspberry Pi from dying in the event of full power?

• Suspect the problem is that "full power" is using too much current, therefore the supply voltage is collapsing, causing a brown out. You don't say what you are using ti "step down to 5V" either. – Andrew Jan 14 '14 at 19:55
• But in either case, this is very borderline (if not over it) for being Off-Topic here...! – Andrew Jan 14 '14 at 19:55
• The simplest solution really is use a separate battery for the PI – dm76 Jan 15 '14 at 12:23

Since you're running directly from a battery I would say it's safe to just add as much decoupling (in other words caps across your input power) as possible, since the only real downside (that I think is relevant to your setup) to adding a lot of capacitance is increased in-rush current (since the capacitor naturally acts as a short-circuit during charge-up).

In certain circumstances however the high current draw associated with excessive decoupling during initial start-up should be avoided. An example is when you use a switching converter to step a voltage up/down. If the converter has built in over current protection (and no slow start feature), the short-circuit caused by the uncharged caps will cause the converter to stagger (starting up, over current and starting up again), and never fully reach its target voltage. However, since you're running directly from a battery this shouldn't be a problem, since a battery can be driven way above it's rated current capacity (for short periods).

Another thing to also remember is that since there exists a large energy store across your power rails (the capacitors), the system might take a while to discharge (after being powered off). In other words, your Pi will probably run for another 30 seconds (depending on how much capacitance you add) or so after you disconnect your main battery.

Finally, always try to add capacitors that's rated at at least twice your operating voltage (for instance, if you have 6V batteries try to get 16V caps). Motors that reverses their direction very quickly may induce sufficiently large voltage spikes back into your system, and cause your caps to explode (hopefully your motor driver has sufficient clamping diodes).

I would say a single 1000 uF electrolytic cap would be more than enough decoupling. If your Pi continues to brown-out, I guess the more appropriate cause would be your batteries not being able to supply the required current. Remember, the reason you Pi is restarting (or browning out) is due to the supply voltage dipping because the batteries are unable to supply the current the motors require. Adding capacitors will help with surges in currents (such as motors accelerating), but obviously won't solve long term high current draw.

• Hey thanks! Would a 1000uF 50V capacitor be good? I know you said get a double but I assume getting double or more is OK, and if so would the charge not stack up till it reaches 50V and wouldnt that then discharge at 50V or would it stick to 6V given the source is only 6V. – HAL9000 Nov 15 '13 at 14:36
• Sure, the larger the voltage rating the better. The voltage rating would have an effect on the physical dimensions of the cap, the larger the voltage rating the larger the cap. The capacitor voltage rating indicates up to what voltage the capacitor can safely be operated, not to what voltage the capacitor will be charged (that is dependent on your input voltage). In other words, if your supply voltage is nominally 6V, the capacitor will not charge up beyond 6V (ie, not to its rated voltage). – EDDY74 Nov 15 '13 at 21:40
• Using just a capacitor em parallel, it will discharge with the motor load. It will probably get better results putting a diode and the the capacitor. But this will add the voltage drop to the capacitors, so a low forward voltage drop is important. – Diego C Nascimento Jan 12 '14 at 1:55

It sounds like you're experiencing a "brown out" caused when the excessive current draw from the battery causes a drop in the supply voltage. This is due to the fact that batteries have internal resistance (a.k.a output impedance).

In this example, if the load drops to $0.2\Omega$, the internal resistance of the battery will cause the output voltage to be divided equally with the external resistance -- the load will only see 5V. It's possible that your 6V supply is dropping to 3V (or less) under load, in much the same way.

A capacitor will delay this effect, but what you really need is a voltage regulator -- many are available in an integrated circuit (IC) package. Some voltage regulators will step up voltage when insufficient, but most simply lower a supply voltage to the voltage needed by a component like your RPi (in which case, your battery voltage would have to be increased so that it never dipped below 5V under full motor load).

Alternatively, you could use a separate battery pack for the RPi. This is a common solution for mobile robots, because it ensures that when the robot is immobilized due to lack of power, radio communication with the onboard PC will not be lost.

• IC From? sorry not good with abbreviations and google spurts out alot of stuff for "IC" – HAL9000 Nov 15 '13 at 23:03
• Integrated circuit, or chip etc. Texas Instruments' TPS family is an example of a popular switching converter available on the market. – EDDY74 Nov 16 '13 at 6:33
• We already have a Voltage Step down (goo.gl/8YviO4), which converts the input of 6V to 5V. So the V going into the Pi is more than enough it is still sucking more than it needs, Maybe replacing the ESC to better handle full power surges might be a good idea. Or would a high V battery help? – HAL9000 Nov 17 '13 at 14:41
• I've updated the question with a bit on "internal resistance", which should help answer your questions. A higher voltage battery may help prevent the problems you see, if the problem is based on heavy load. Note that you get maximum power when the internal and external impedances are equal, so you should never have a reason to cause your battery voltage to drop to less than half of its nominal voltage. Some batteries are rated for even less load than that. – Ian Nov 17 '13 at 23:14

I must agree with the other two answers, however the main issue is that you do not have enough voltage into your regulator (I see from your comment to Ian that you are using a Pololu D15V35F5S3 Regulator). If you refer to the Pololu D15V35F5S3 Product Description, down at the bottom you will find the following graph:

Looking at the red line for 5V output: Note for all currents greater than zero, the dropout voltage is greater than 1V. (The minimum input voltage necessary to achieve 5V output is 5V + dropout voltage.) The more current used by your 5V loads (Pi), the greater the dropout. The problem is compounded by any voltage drop in your 6V source due to current surges (see Ian's answer).

You either need a higher input voltage, a lower dropout regulator (this may be difficult and insufficient), a different regulator (buck-boost), or a different power source for the Pi.

• Ah, very true, didn't see the reference to the Pololu converter (I originally thought he was referring to the on-board LDO). Although, it does seem strange that the Pi is even starting up, since the board supposedly consumes 500 mA at 5V with no external peripherals (and according to the graph 500 mA requires about a 1.5V drop, but I guess the converter is right at its limit). – EDDY74 Nov 18 '13 at 14:09
• Then again, I'm guessing the 500 mA refers to peak current requirements, which is probably rare enough. – EDDY74 Nov 18 '13 at 14:19
• @EDDY74 I think the main thing to notice here is there is no headroom. Any dip in input voltage or fluctuation in output current will likely result in a voltage change. Without an increase in input voltage, it's not really working as a voltage regulator. – Tut Nov 18 '13 at 14:35
• Hey thanks, This helps alot, I can try increasing V that should be the easiest solution currently – HAL9000 Nov 19 '13 at 0:35