When to put in a capacitor - Page 1
Forum section: electronics / beginners

author: KNSSoftware
author_rank: Regular Contributor
timestamp: September 26, 2017, 11:17:18 pm
content: I think I have a basic understanding of the point of a capacitor; smoothing, coupling,.. etc, but I cannot find any sort of 'protocol' for when to actually stick one in. My concern is, 'power side aside' (when I can see when to put one in), I feel like I could design any circuit without giving them a second thought, which means I don't really understand them. I look at circuits, and they seem 'thrown in' by the handful. Is it just a case of ''suck it and see' at first, and if parts of your design starts to misbehave and fluctuate for example, consider putting one in? Then presumably, when you do a similar circuit in the future, you can better predict when you will need them??? In my opinion, this component doesn't feel as clear cut as most of the others, so finding it one of the hardest to get my head around.

author: innkeeper
author_rank: Unknown
timestamp: September 27, 2017, 12:14:50 am
content: to quote a line from kung fu panda "there is no secret ingredient"I think you actually gave your own answer. it is like any other component. you use them when you have need for one.what is really going to bend your brain later on is what type of capacitor to use.The only place i can think of were you might appear to be "thrown in" are bypass caps on the power near various components. but like any other component, there not just thrown in, they serve a purpose and are there because they perform a function.if you see a cap in a circuit, and you don't know why it is there, then take it as something to learn about and find out why it is there. plenty of people here are happy to explain too if you post a circuit snippet.

author: bjcuizon
author_rank: Frequent Contributor
timestamp: September 27, 2017, 02:39:55 am
content: This might be useful:

author: KNSSoftware
author_rank: Regular Contributor
timestamp: September 27, 2017, 08:38:17 pm
content: Thanks guys, but maybe I am not making my point clear.When it comes to things like resistors, generally you can predict exactly when you will need them for any part of your design, and you can calculate what you will need, long before you reach for the breadboard. I am trying to work out whether I should be able to do this for capacitors?As previously stated, I can totally predict their requirement on the power side of the system, to do their part of smoothing ac to dc. I can also totally buy why you might split it over a number of caps, rather than one big one (already seen that vid, and get it).It is just how do you predict it elsewhere? How do you know what combination of components are going to require the addition of a cap before hand? Or is that the case, and you don't, and this side is just trial and error on a breadboard until you learn the hard way?So far I can only see two approaches, unless someone can give me the magic formulae/'ingredient':1) Start with none, and assume you don't need any. If things don't work out, debug until you find out where inevitably will need some, and use trial and error and maybe some math to work out which ones to use?2) Don't be shy with the caps, and as long as they are not too big, and you don't go ridiculous, it will be a good start. Point being, they will be pretty benign, but a bit wasteful if not needed, but the rest will do their job nicely and keep the circuit in check. If any are found to be an issue, just rip them out?I just find it hard to believe that in a EE world governed by so many rules and laws, that this little sucker doesn't a clear cut rule book, such as:- If you have components A + B in series, then you are probably going to need a cap. In this case use Rule C to calc' which one you will need.Apologies if I am making less sense to you guy's, than the caps are to me!

author: Avacee
author_rank: Unknown
timestamp: September 27, 2017, 08:52:42 pm
content: Component datasheets will have suggested capacitor values (and type + placement) and its strongly recommended you use them as a starting point and then debug your circuit from there.Starting with none is asking for trouble (things can oscillate themselves to death pretty quickly) and there is no "magic formula" as every circuit and construction is different. If there was a magic formula it would have already been posted and reduced to an algorithm :pEdit: You could model your circuit in something like LTSpice but that's not a 100% guarantee of the capacitors effects due to differences in construction.Start with the datasheet's recommendation and work from there.

author: KNSSoftware
author_rank: Regular Contributor
timestamp: September 27, 2017, 09:13:09 pm
content: Thanks Avacee, good point, I didn't think about the datasheets for guidance. Seems obvious once someone spells it out.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 27, 2017, 09:23:46 pm
content: I'm honestly not sure which ones you're referring to that are not a part of the power system and whose value can't be calculated before hand. Could you give an example?Basically every time I use a cap it fits into one of three categories: 1) It's on a power line for either bulk capacitance on a rail or local decoupling on an IC power pin, 2) it's part of an analog filter or RC type network and its value can definitely be calculated, 3) whatever IC I'm working with specifically says "put a 0.01uF ceramic cap from pin 5 to ground". That's about it...there's the odd DC blocking application which technically fits #2, but whose value really doesn't matter (as long as you aren't on the extremes), but the same can be said for many resistor applications as well (eg: pull up/down).

author: KNSSoftware
author_rank: Regular Contributor
timestamp: September 27, 2017, 09:47:04 pm
content: @suicidaleggrollThanks but cannot give an example, as my point is, I am not sure when to use them, let alone have an example to demonstrate my own ignorance. I watch Dave's tear-downs and they seem everywhere. I know this is woolly, but that is where my understanding ends. I wanted to make sure that i didn't bury my head in the sand and try and ignore them. But fair point, when i am adding components, if they need any caps to work as designed, they will probably specify them, and I just need to incorporate them.

author: MK14
author_rank: Super Contributor
timestamp: September 27, 2017, 10:26:52 pm
content: Quote from: KNSSoftware on September 26, 2017, 11:17:18 pmThere are often rules of thumb, for the types of circuit you are designing. These rules of thumb are gained by experience, reference books, databooks/datasheets/application-notes, talking to other engineers/hobbyists and other sources.Then when you actually try/test the circuit out, you can refine it and if necessary add more, to improve the circuit. E.g. a binary counter may NOT be counting properly/reliably in a circuit. Every few seconds, it seems to unexpectedly flip bits. So you add more decoupling capacitors, until the problem is fully eliminated.E.g. A logic series databook design guide, may recommend putting at least one 50nF to 200nF capacitor, every 3 or 4 ICs (or even every 1 or 2 in very electrically noisy environments), for general logic gates. And maybe one capacitor per IC for more sensitive logic, such as flip-flops, binary counters etc.There are many things which you can't calculate as such. E.g. How many screws do you need to fix the PCB inside a case. Some use two screws, others four or six, and some use so many, I lose count, but there are probably 50 or 100 of them. E.g. Completely disassemble an old CRT TV apart, and count how many screws there were, altogether.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 28, 2017, 01:59:36 am
content: If all you're doing is static DC, or combinatorial (static digital logic), maybe you won't ever need them...Let's reflect on the definition!Resistor: V = I*RVolts and amps, static, DC (or instantaneous, anyway -- doesn't care if AC or DC, it's all the same, just a V and an I).Capacitor: I = C * dV/dtOr if you swap it around, dV/dt = I * 1/C so it looks like a resistance too. Volts and amps, but not actually volts, but the rate of change over time. What?If you don't know any calculus, dV/dt doesn't mean much to you, or worse, it looks like this horrible nonsense from high tier math...Just understand it's a velocity, how voltage changes over time. DC by definition has dV/dt = 0, it's static, it's unmoving. And thus, by definition, AC is moving, dV/dt != 0. (Well, it's okay for dV/dt to be zero from time to time -- a sine wave starts and stops periodically -- but it's not zero for all time, see.)And finally,Inductor: V = L * dI/dtThe change in current over time.Anywhere you need to store and release energy, you use one of these. Anywhere you need a time constant, anything to do with AC, with frequency or time dependent stuff.In a digital circuit, you might also need delay, because even a combinatorial circuit has race conditions. Propagation delays of gates, and different delays between gates, often result in 'runt' pulses, where some part of the circuit finishes "deciding" its state before others. During those pulses, the output is invalid (i.e., not equal to the static value of function(input)), and that invalid output state might go on to trigger other logic, inappropriately, and so on.Indeed, the more fundamental concept is delay; an ideal (abstract) capacitor or inductor or resistor has no length or delay (or assumes infinite speed of light), which is silly. The delay of a signal down a wire manifests as equivalent inductance and capacitance (equivalent at low frequencies), and you can directly use this fact to create inductors and capacitors of modest value, or conversely, to use the L/C properties of a circuit to determine its size, or how small it needs to be for a particular purpose, etc.Tim

author: george.b
author_rank: Frequent Contributor
timestamp: September 28, 2017, 09:29:06 am
content: As, perhaps, a bit of an extension to T3sl4co1l's answer: it might be enlightening to look into the concept of impedance, which is a generalization of resistance. Capacitors (and inductors) might make more sense in that context. Or maybe not, depends on how good you are with complex numbers.Your question is kinda like asking "when do I need a resistor". I don't really know how to answer that with anything other than "you need it when you need it". Probably not the most helpful answer, but it really depends on what your circuit is doing. If it needs an element that behaves as a resistor does, then you go and put a resistor. If it needs an element that behaves as a capacitor does, then you use a capacitor.For example, a resistor won't do much if you want to, say, filter out some range of frequencies that go into a loudspeaker. A resistor's behavior (ideally) doesn't depend on the frequency; a capacitor's behavior, on the other hand, does. That is one instance when you'd need a circuit element such as (but not only, or even not necessarily) a capacitor.What size of capacitor? Then you'd use your circuit analysis skills to figure it out, just as you would in order to choose a resistor.Sure, rules of thumb like "one decoupling cap for every one or two chips" will often get you through, but when they don't, then you should know what you're doing.I think the thing is, you should learn more about the actual behavior of capacitors (and of inductors, while you're at it), then you might start getting a better idea about what you can do with them.

author: LukeW
author_rank: Frequent Contributor
timestamp: September 28, 2017, 10:09:58 am
content: As a very rough, very general rule of thumb, if you don't have any datasheet or reference design that says otherwise, put one 0.1uF cap as close as practical to the main power pin of the IC, one capacitor for each IC.

author: tszaboo
author_rank: Super Contributor
timestamp: September 28, 2017, 10:30:59 am
content: The rule of thumb is simple. When in doubt, place a capacitor. When you dont know, which type is required, place more capacitors. When you want to filter different frequencies, place more capacitors. When you dont know, if you should place an 1nF a 10nF and a 100nF capacitor, place all of them, the smaller the closer. When a datasheet said that it is stable with a 2.2uF capacitor, place a bunch of them.If you dont know, if low ESR is really a requirement, place a low ESR.It is always easier to leave out something than to design in something. Caps can behave unexpectedly, like ringing, but it doesnt happen very often. Having more capacitance 99% of the cases doesnt hurt the circuit. A reel of 0603 100nF costs about 10 EUR. It takes multiple reels to make me think about leaving it out. My time is worth more than that.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 28, 2017, 11:27:24 am
content: Quote from: NANDBlog on September 28, 2017, 10:30:59 amThis is a good example of advice to watch out for...Remember, this is only the internet and you get what you pay for.QuoteIn a production situation, it's good to include extra footprints, in case you need to add components there. Easier to have extras, and never place them, than to have to bodge a component on top where it was never intended to be. This applies more to termination resistors on logic pins, and filtering components on connectors (for EMC purposes), but if you're optimizing a power distribution network (PDN), it applies equally well to bypass caps.Tim

author: A Hellene
author_rank: Frequent Contributor
timestamp: September 28, 2017, 01:00:53 pm
content: Quote from: T3sl4co1l on September 28, 2017, 11:27:24 amExactly!This is a standard proceidure when prototyping.For example, there are a few dummy component footprints at thevoltage doubler lead-acid batteries desulfator prototypeI am currently working on (which is designed to be delivering up to 350A pulses of varying frequency and duration to the battery):Voltage-doubler lead-acid batteries desulfator prototypeSuch dummy (omitted) components are the following:1. R15 (betwen R14 and Q4) that terminates the Shunt resistor (RSh) voltage drop transmission lines (the two parallel traces from RSh to the voltage amplifier and level shifter below R15, wheredtis extremely narrow in the order of a few tens of nanoseconds to a few microseconds --depended on the battery condition), which actually measures the current being sent to or being drawn from the battery. R15 value should be in the range of 50..130 ohm; but it can be omitted if the ADC S/H point is slightly moved by a few tenths of a microsecond before/after the falling/rising edges, by way of hunting the sweet spot between accuracy and complexity.2. R14 (on top of R13 and R12). This is not necessarily a resistor in parallel to R13, in order to trim R13's value: It could be a small capacitor to be smoothing the ADC input signal rising and falling edge spikes being present across R13. It could also be a zener to be protecting the ADC input from any nasty spikes that might exist at the output of the Q4 amplifier & level shifter. The trial and error method in action!3. DZ5 (on top of U1) that protects U2 Vcc from any possible voltage spikes. Most probably unneeded when everything else will be found to be working as expected..4. A few PCB extra wired holes, in case of a component with a slightly different pinout (see: L2 and L3); or an alternative M3 positioning in the case it will be needed an extra heatsink on board (that is not actually keeping cool the one and a half milliohm transistors M2 and M3; it cools down the shunt resistor and both the inductors in order to be keeping the capacitors bank in a healthier temperature!)....and a couple more capacitor footprints (already been populated) in order to be filtering the supply lines from higher frequency components, by helping their in-parallel bulkier decoupling/reservoir capacitors.In a few words,when in doubt, there is no doubt.-George

author: Brumby
author_rank: Unknown
timestamp: September 28, 2017, 01:38:22 pm
content: It seems to me that there has been a major oversight in this thread on the use of capacitors.Certainly we have DC power filtering and we have power line decoupling ... but there are other circuit topologies that have not been excluded by the OP (as far as I can tell).Filtering and frequency dependent circuitry; oscillators; timing circuits; AC coupling/DC decoupling and lots of other uses.For these, there are much more deliberate selection processes.

author: cdev
author_rank: Super Contributor
timestamp: September 28, 2017, 01:53:01 pm
content: In the bypass context people do throw them in because they know that they're going to need them. Not out of laziness.In the RF context they are the inverse of an inductive reactance.