# How do I calculate the correct resistor, capacitor for a low pass circuit?

I'm looking through an article on www.allaboutcircuits.com and www.electronics-tutorials.ws in an attempt to learn more about how low pass noise filtering on for example a circuit that needs to supply 3.3V would be designed.

I don't have an oscilloscope, and I am most certainly not a mathematical or electronics genius, this stuff is all to make these weaknesses stronger, by learning.

So in a circuit like the following:

...how does one calculate the correct capacitance to use, determine which direction they need to be hooked up, and whether to use polarised or non-polarised caps?

Would I rather need to hook up the Vin supply to determine what noise there is in the first place, and decide from there, what I want to make my cut off frequencies?

I tried simulating this in iCircuit, but with some capacitor values, the frequencies fluctuated, and the voltage on my circuit increased in a stepping sinusoidal wave manner, so i clearly have no idea what I am doing. ;)

-
Also, is this what is referred to as a decoupling circuit? – josef.van.niekerk Jan 11 '13 at 9:41
The caps are called decoupling caps. Good to see someone from SA around here :) I miss home! – stacey Jan 11 '13 at 12:44

The use of decoupling caps is hugely dependant on the circuit in question. Any circuitry that generates a lot of high-speed switching is going to generate a noisy EMC profile. FPGAs, microcontrollers and high-speed interfaces all perform a lot of high speed switching and so require decoupling caps.

Usually a device datasheet will specify recommended cap values, locations and even dialectrics. These values are usually chosen specifically for the device in question. Sometimes these caps are optional, to be added at the user's discretion based on surrounding circuitry. If a voltage regulator is going to be used in a noisy EMC environment, then the caps may be included, otherwise they may not be necessary (the datasheet will indicate this), however decoupling is generally good practise.

Often devices will have several caps in parallel of different values. Each cap filters up to a specific frequency based on the impedance (Z) of the circuit. The cut-off frequency is calculated as follows:

$f_c = \dfrac{1}{2 \pi Z C}$

However, the impedance of the circuit is the most difficult factor to calculate. It's based on your allowable noise margin and the amount of current that's going to be switched at once. This really useful TI application report gives details.

If you're building a classic first order low-pass RC circuit then the Z turns out to be the R value and the maths is a lot easier.

This is the reason why most ICs give recommended cap values, they've done all the maths for you. If you'd like a practical example, the application note above gives a nice example on how to calculate a required cap value.

In terms of testing, if you have a power supply on its own, you probably won't see much noise at all. It would be necessary to measure the power supply noise when you're using it to power a microcontroller or similar device and choose cap values based on what the application note for the device says. Also, give trial and error a try. Try different cap values and see what you get.

-
This is super informative Stacey, thanks for answering! – josef.van.niekerk Jan 11 '13 at 12:59

Filtering you need greatly depends on your input voltage source - if it's some crappy switching power supply from China (no big transformer) you probably might want to connect a LC "pi" or "t" filter (kinda more complicated stuff, you have to avoid resonance) or just put a ferite bead in series to atenuate high frequencies that pass right thru LM7805. Another way is to add a RC filter made from small (somewhat 10 ohm) resistor and a capacitor, corner frequency of this can be calculated by 1/(2*pi*R*C); this way is tricky too as you have to consider amount of current you will be drawing and voltage drop that will be developed over a resistor.

In particular circuit the capacitors can be considered to be acting in several different modes - one thing, they are shunting high frequencies to ground (capacitor acts as a resistor for high frequencies, higher the frequency, lower the resistance) another thing - they decouple the circuit making a "local energy storage" for momentuous current demands from the circuit this circuit is powering. And finally they could be considered as stabilising components for internal voltage regulation circuit in LM7805.

That beeing said, you don't really have to calculate values for this particular circuit. By "rule of the thumb" you just put a ceramic capacitor in the range from 100nF up 1uF (1uF ceramics are available and cheap already) - this cap acts as stabilising capacitor and shunts high frequencies. Parallel to that you usually put electrolytic capacitor of 10uF - 100uF it's positive terminal connected to greater potential rail (+5, +7.5) - this cap acts as a local energy storage, it's slow and does not perform greatly in high frequencies.

If you see short high spikes from a switching power supply, put a freite bead in series on the output (you have to choose one that can put thru the current you need)

-