# How do you calculate caps for voltage regulator circuit

In a voltage regulator circuit, how do you calculate which capacitors are placed before and after the regulator?

For example, if I'm pulling 50mA from a 5VDC regulator(L78M05) with a 9V input, how do I determine which caps are going to give me the least amount of ripple?

• Read the datasheet of the regulator. In your case, since neither the battery nor the LED will cause any ripple you'll be fine with whatever it proposes (and 78xx are benign compared to LDOs). Commented Jul 29, 2013 at 16:10

There is a wide latitude. In a big enough design where I'm using various size caps already, I usually use 10 µF on the input of such a regulator and 1 µF on the output. You can get away with a lot less, but there is little harm to having more, especially on the input where more is better from the regulator point of view.

The cap values have little to do with current, since for a ideal regulator and battery the voltages on them would not change. The purpose is to make the lines look low impedance at frequencies high enough that the active circuitry can't handle. The output cap is also part of the feedback loop of the regulator, and different regulators have different requirements. A 7805 will be fine with 1 µF ceramic close to its output pins. Other regulators may have specific requirements, including some minimum ESR for some of the older low-dropout types.

So the real answer is to read the datasheet and make sure you meet all the input and output cap requirements.

The larger the capacitor, the less the ripple. As an analogy, think of the capacitor as a water storage tank. The larger the water tank, the less impact drawing water from it will have on the water level. The ocean is an effectively infinite capacitor, so when water leaves the ocean, the water level doesn't change hardly at all. Also, you can see from the equation that the higher the load resistance, the less ripple. That's pretty obvious because the higher the resistance, the less current it will draw.

But obviously, you can't just throw in a massive capacitor. You should read the datasheet for your regulator to see what it suggests.

• Which equation are you referring to? Commented Jul 29, 2013 at 15:20
• Sorry, I originally referenced an equation for voltage ripple off a full-wave rectifier. Take a look at this page. electroschematics.com/7048/capacitor-input-filter-calculation Since you don't have a full-wave rectifier, it doesn't exactly apply. Still though, the principle should still be true that a larger capacitor will mitigate ripple more than a smaller one. Have a look at where the author solves for delta_v on that page, and you'll see that C is in the denominator. Thus, a larger capacitance means less ripple. Commented Jul 29, 2013 at 15:41
• Generally though, ripple only happens with AC sources. I've never really heard of ripple happening with a battery, and I can't imagine any internal characteristics of a battery that would cause it to behave like a fluctuating input source. Unless you are talking about load regulation, where your load may be having variations on how much current it draws. It looks like in that circuit though you are just lighting an LED. That won't have any sort of ripple or variation. Commented Jul 29, 2013 at 15:48
• In my case, I'm powering a ATMEGA328P-AU and I want to give it the cleanest signal I can to get stable reads from the ADC channels. The input would be a 9VDC wall wart and the output would be 5VDC. The MCU would average around 50mA. Commented Jul 29, 2013 at 15:59
• Capacitors as water tanks is a temping but very poor mental model of a capacitor. In a hydraulic analogy, real capacitors have no air in them, and it's not possible to put some water in without taking an equal amount of water out. Tanks aren't like this, leading people to nonsense like current can't flow through capacitors, or batteries produce charge. Commented Jul 29, 2013 at 17:20