Current Surge Capacitor Calculator

Hello friends...

I'll jump right into the deal here.. I pranked a friend by putting a raspberry pi into a yoda head like the one on his desk. There's an intro video: and the prank itself: if you are intrigued.

Everything in the head runs off 3 AAA batteries. 1 raspberry pi zero w, 1 small amplifier, 1 motor control board & dc motor. I can't tell you how much current it really uses; but I can tell you 3 AAA works well for about 15 to 20 minutes.

Now that the prank has ended I want to run yoda off of an AC/DC adapter instead of the batteries. When building I was able to use a 12V AC/DC adapter (~4 amps I think) through a 5VDC regulator and everything ran fine then. I found a 2A, 5VDC AC/DC adapter and hooked that in place of the batteries. Everything works until you make Yoda talk (uses motor, speaker, pi processor all at once) and the raspberry pi reboots.

I'm thinking that there isn't enough current to keep voltage up and the pi basically powers down and back up again. I don't know much about electric engineering, but a friend at work said to put a capacitor inline with the power but couldn't tell me what size.

I've googled quite a bit to find a calculator to figure out what I may need, but can't find anything. Any ideas? Thanks. Sorry for the long post.

anorlunda
Staff Emeritus
Unless the power peaks are very short in duration, a capacitor won't help. You probably need just a bigger power supply.

If you tell us the exact model of raspberry pi you have, we could look up the power requirements.

Baluncore
Capacitance = Charge / Voltage; C=Q/V.
Charge = Current * time; Q=I*t.
So; C = I * t / V.

If you need 0.5 amp for 1 second and cannot have the voltage drop by more than 2 volts then you need at least;
C = 0.5 amp * 1 sec / 2 volts = 0.25 farad.

That capacitance must be on the unregulated supply before the voltage regulator.

@anorlunda This is a great guide to show approximate current draws of the raspberry pi, but it's way more than that. The motor is pulling the most current, probably then followed by the audio amplifier, then by the h bridge to run the motor in two different directions. A larger power supply would be great but it's pretty hard to find a small one with more than 2A. Maybe I can find an old printer one that has multiple voltages with one being +5... Hmm.

@Baluncore Thank you for the formulas, I will soak those in and put them next to ohm's law in my head. I'm guessing since one AAA battery could produce 1-2 amps, I would need 6 amps (that seems wrong right off the bat), I'd say 5 seconds @ 5 volts... 6 farad - isn't that one of those giant ones you use in car stereo applications? Maybe a cap is not the right way to go...

Tom.G
Adding more caps is not the right way to go. You should check the power consumption of the motor and also: do some software tweaking to allow some kind of soft-start for the motor.
The high current draw at 0 RPM will just deplete any (sane sized) cap anyway and bring the input voltage below the starting level of the CPU board.

Alternative is to use a 12V 2A PSU and put the motor on a separate regulator. The power stored in a cap grows with U2, so you would have ~ six times of power to start the motor in a 12V cap.

Ui.: it is also a possible solution to put a diode on the power in of the Pi and add caps after the diode. That would keep up the voltage on the module while the motor starts up. But you have to check the undervoltage threshold of the module first.

Last edited:
Borek
Mentor
3 AAA won't give 5 V, so you start with voltage under specification, any load and voltage will drop even further, no wonder it reboots (actually I am rather surprised it starts at all).

If memory serves me well Zero W needs a bit over 1 A. I would think about going LiPo and switcher (capable of delivering several amps) route. 2S LiPo gives 8.4 V when freshly charged, can be safely used down to about 6.6 V, so 2S should be enough.