To save time, breadboard pins or just lack of knowledge people try to skip adding even one decoupling capacitor to a circuit. Either on IRC or in Forums you can almost always see it coming: “randomly, my circuit stops working” And then, “what do you mean a decoupling capacitor?” question.
While working on breadboard Arduino, I came across some unexpected measurements. Initially, the only capacitors on the breadboard were the two 22pF from crystal to ground and the capacitor connected to RESET for Auto-RESET.
Keep reading to find out what happen when I added a 100nF and a 1µF cap. A bunch of scope traces and surprising results follow.
I powered the chip from an FTDI adapter plugged into a Macbook Pro running on battery. From there, I flashed a “blank” sketch. This program is the “Bare Minimum” sketch from in the Arduino’s Examples folder.
Figure 1 shows the noise floor while holding the Uno’s RESET button. Figure 2 illustrates the noise on the 5V line with the “blank sketch.” It’s in quotes because it is an endless for()-loop.
With the baseline established, the code was changed to toggle Pin 13 as fast as digitalWrite() could toggle it.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, LOW);
}
Visually, the LED I added didn’t seem to flash. It was toggling at 94 KHz, so, of course, I wouldn’t see it change. Look at Figure 3 to see how the noise on the 5V line is now over 300mV! Also, check out those noise spikes!
Channel 2, the Blue channel, is measuring Pin 13. The waveform shows the pin is switching on and off. Notice what Channel 1, the Yellow channel, is showing. When Pin 13 switches on or off, there is a noticeable noise spike on the 5V pin.
A decoupling capacitor can eliminate that noise!
100nF Decoupling Capacitor
The first capacitor added is a 100nF ceramic capacitor, shown in Figure 4. It was attached as close as possible to pins 7 and 8. On the ATmega328, this is the VCC (7) and GND (8) pins. Amazingly, the noise and spikes dropped significantly. Even though I don’t suggest changing connections while powered, this is a pretty fun change to watch in real-time.
So.. if 100nF worked well, adding more will work even better, right? Look at what happens when I add the 1µF aluminum electrolytic capacitor.
1µF Decoupling Capacitor
Now check out Figure 5. The noise from before is worse now! Granted at these low levels would it matter? Maybe not. However, this short experiment makes a point. Smaller decoupling capacitor values are just as important as bigger values when it comes reducing noise spikes on a voltage rail.
Conclusion
Hopefully, these simple experiments illustration that bigger isn’t always better. In other words, don’t be in a hurry to add a 470µF capacitor, without some measurements. Also, make sure you put a smaller 100nF in parallel with the big ones.
12 Comments
Did you replace the 0.1uF cap with the 1uF cap or did you have both of them? Why does this cause an increase in noise spikes?
One then the other.
The ESR and ESL of the electrolytic cause the noise spikes.
You can’t! compare ceramic and aluminum electrolytic capacitors. They have TOTAL different frequency response and ESR at high frequencies.
While true, you need to be careful when comparing at high frequency, that’s not the case here. The switching noise of the pin toggling is well inside of a typical Aluminum’s frequency response.
The bigger contributor is not the frequency response. The magnitude of the ESR does have an effect on the magnitude of the ripple–which was the basis for the comparison here.
Someone that doesn’t understand ESR’s effect on ripple voltage might just assume “oh, a bigger capacitor will help.” It won’t.
If you measure the rise time on the output pin, you’ll find it is around 5ns, or around a 100Mhz fundamental frequency. Therefore a *smaller* should reduce the spikes more. I’d suggest trying a 22nF, perhaps in parallel with a 47nF. As you saw from trying a 1uF and a .1uF, when the capacitance is more than 2:1, it can make things worse.
http://www.cypress.com/?docID=31807
bigger is not better because aluminium cap has more ESR at 90 khz. try to connect tantal caps. they are best for noise problems. but 100nf may not solve your problems all the time. because there may be different frequencies of noise in your circuit. so the real solution on digital circuits using more than one cap for bypass. 100nf+1uf+ 100uf.
I agree its the ESR contributing, but I don’t agree you’d see better results with a traditional MnO2 Tantalum. Their ESR can be significantly worse than a web electrolytic. Polymer-Tantalum, on the other hand, would be a different story.
MLCC or film is the way to go!
Just remember that different capacitor values work for different frequencies.
I have always thought the term decoupling a bit misleading, “reservoir” or “balast” caps works better for me.
Agree. I struggle with “filtering” and “decoupling.” I think in the industry they get mixed up quite often.
De-coupling is really that… disconnecting from another source. While filtering is really what I show around Figure 4… creating a filtering network that removes noise.
I think ‘Cengiz’ makes the point well. There is usually a bit of maths required to cover the filter requirement.
> “De-coupling is really that… disconnecting from another source. ”
But they rarely are. The caps are tracked to the power rails and the chip they are ‘protecting’, so they are coupled. Diodes would give some isolation but you have to go to the expense of a DC-DC converter to truly “decouple” a circuit.
True the decoupling cap is storage device it holds a small amount of the charge in the circuit but does not stop the circuit working. In short it is a band pass filter taking the unwanted noise in the circuit to ground in most cases and allowing the wanted singals to get through.