Use of capacitors?

Hi, Id say im pretty knowledgeable about electronics and arduino but capacitors always confuse me. I understand how they work but i dont understand how they discharge and can be used. Im taking a course on Udemy and he connected servo straight to the 5v pin on the arduino and then connected a >300uf capacitor also at 5v so it is connected to the servo. I am confused on why he did this and what is the general use of capacitors is. Can someone explain this to me

I guess it is for filtering. You can think about capacitor as "reservoir of charge". When the servo needs to move it takes some energy from 5V pin and some from the capacitor and when it stop working the capacitor is filled by the 5V line to be full again. If you remove the capacitor the drop of voltage caused by servo may be so large that it will do something bad with Arduino (reseting, executing wrong command etc.).

Smajdalf:
I guess it is for filtering. You can think about capacitor as "reservoir of charge". When the servo needs to move it takes some energy from 5V pin and some from the capacitor and when it stop working the capacitor is filled by the 5V line to be full again. If you remove the capacitor the drop of voltage caused by servo may be so large that it will do something bad with Arduino (reseting, executing wrong command etc.).

What happens when the servo uses all the power in the capacitor though?

m taking a course on Udemy and he connected servo straight to the 5v pin on the arduino and then connected a >300uf capacitor also at 5v so it is connected to the servo. I am confused on why he did this and what is the general use of capacitors is. Can someone explain this to me

Think of the capacitor as an energy storage device. Now consider that a servo is an energy "greedy" device and draws too much energy at one time from the arduino 5V but only for a very brief period. Now consider that the capacitor is like a reserve of energy that the servo can draw from during the brief period it is actually moving and the cap and recharge when the servo is not moving.

What happens when the servo uses all the power in the capacitor though?

The servo doesn't move constantly.

raschemmel:
Think of the capacitor as an energy storage device. Now consider that a servo is an energy "greedy" device and draws too much energy at one time from the arduino 5V but only for a very brief period. Now consider that the capacitor is like a reserve of energy that the servo can draw from during the brief period it is actually moving and the cap and recharge when the servo is not moving.The servo doesn't move constantly.

I get that thanks!
So is the general use for capacitors when a source of power is being drained too much and the capacitor is used too supply power instead, Is this what the 2 25v capacitors on the arduino uno do?

"So is the general use for capacitors when a source of power is being drained too much and the capacitor is used too supply power instead"
Yes, if they are used as decoupling capacitors.
" Is this what the 2 25v capacitors on the arduino uno do?"
Yes.
At other times, the caps may be used with resistors or inductors to make filters to let only selected frequencies pass (high pass, low pass, band pass).
At other times, the caps may let AC signals thru while blocking DC signals (AC coupling).
Etc.

CrossRoads:
"So is the general use for capacitors when a source of power is being drained too much and the capacitor is used too supply power instead"
Yes, if they are used as decoupling capacitors.
" Is this what the 2 25v capacitors on the arduino uno do?"
Yes.
At other times, the caps may be used with resistors or inductors to make filters to let only selected frequencies pass (high pass, low pass, band pass).
At other times, the caps may let AC signals thru while blocking DC signals (AC coupling).
Etc.

Okay, so aside from all of this filtering is there any other use for capacitors or is that it?

It's also often useful to think of a capacitor as resisting a change in the voltage between the two sides of the cap.

The common use cases are for power supply filtering, decoupling (always put 0.1uf ceramic capacitor between Vcc and Gnd on any digital IC, right next to the chip - unless the datasheet says not to), filtering, AC coupling. Sometimes they're used as part of an RC circuit for timing. You can use them in a charge pump...

There's lots of stuff - capacitors are one of the most basic and fundamental electronic components, and as such they see use in all sorts of contexts.

3ngineer:
Okay, so aside from all of this filtering is there any other use for capacitors or is that it?

For low current applications they can be used as batteries.

Google on super capacitor.
Can be used for powering RTC chips or memory standby applications generally.

3ngineer:
Okay, so aside from all of this filtering is there any other use for capacitors or is that it?

Hi,

Yes, you can also use them as the 'head' of an figurine built from electrical components soldered together where the arms and legs are resistors and the hands and feet are IC chips (with the pins as fingers and toes) .
I've actually seen things like this and they are quite cute and some are very clever.

I am sure you meant the electrical properties however :slight_smile:

One point you brought up was what happens if the device (servo) uses up all the energy in the capacitor. What happens then.
The short answer is that if the device ever used up all of the energy the designer of the circuit would have made the capacitance value larger (100uf instead of 10uf, 1000uf instead of 100uf, etc.) and that would have solved the problem before it even got to any consumer to use.
Interestingly however this is also what happens when a filter cap goes bad, as the series resistance goes up and the capacitance often goes down. This causes less filtering and so the device being operated often does not work right anymore and may shut off right after being turned on. The ripple out of the power supply goes up and this causes a problem for the device and some devices may just act very strange while others have a detection circuit that will detect this condition and turn the unit off.
That will happen with many times of devices like modern TV's and computer power supplies. To fix it we need to replace the capacitors with new ones that have the original capacitance.

A very rough analogy to this is like that of a faucet where we turn it on and off repeatedly yet we want a continuous stream of water. Using a bucket with a hole in it, we fill the bucket periodically while getting the water stream from the hole in the bucket. The bucket is sized so that when it drains somewhat we turn the faucet back on and that fills it back up quickly again. That's basically how a rectifier and filter capacitor work. The output stays much smoother than it would have with just the rectifier which by itself can not supply continuous power.

Then there is the RF applications where you use the reactance of the capacitor [1/2pi()fc] as an impedance element.

3ngineer:
What happens when the servo uses all the power in the capacitor though?

Servos have a large current drain and will drain the capacitor in thousands of a second.

Decoupling capacitors generally will allow large currents to flow for a short period of time.

Modern digital electronics use switches that have large current for a very short period of time(billionths of a second).

The wire or pcb track supplying that current has inductance which resists the flow of current so this can cause the potential at the chip to me depressed to a level at which the chip fails to operate.

Servos also use electric motors which can generate large spikes (noise).
A reverse diode is generally essential to avoid damage, a capacitor will also help to reduce spikes that can generate noise that will upset digital electronics.

There are different types of cap as well.

Electrolytic (high value in small space) have a low esr (equivalent series resistance) at low frequencies and can be useful for the likes of mains frequency power supply smoothing.
Poor at high frequencies though.

Often in power supply circuits several hundred uF electrolytic will be paralleled with a few nanofarads of ceramic cap as it has a very low esr at high frequencies compared to electrolytic.

Capacitors can also be used as integrators and differentiators.

differentiators - turn a level change into a pulse, sometimes called edge detectors.

integrator - just like the maths function of integration - that is turn a constant into a variable - that is a DC level is converted into a slope, the steepness of the slope is proportional to the size of the DC level.

Also they can be used to generate pulse delays and oscillators.

Now here's a challenge, what about inductors?

The differentiator is also "just like the math function".

Servos have a large current drain and will drain the capacitor in thousands of a second.

Ok, fine, then do you want to explain the use of those large caps to prevent negative spikes that could cause the BOD to trigger a reset ?

:slight_smile:
If the OP knows what a BOD is i will have a go.

EDIT

:smiling_imp:

And ill let you explain ground bounce :smiling_imp:

A decoupling capacitor is a capacitor used to decouple one part of an electrical network (circuit) from another. Noise caused by other circuit elements is shunted through the capacitor, reducing the effect it has on the rest of the circuit. An alternative name is bypass capacitor as it is used to bypass the power supply or other high impedance component of a circuit.

Decoupling Capacitor

Put another way decoupling capacitors for logic chips act to keep the supply voltage stiff on timescales of
nanoseconds to a few microseconds, which are the timescales at which all wiring looks inductive and voltage
regulators fail to respond fast enough to changes in load. Each capacitor acts as a point in the power
supply distribution network where the voltage is kept constant, minimizing the length of wire between
a chip and a quallty supply. Such fast decoupling capacitors need to be close to the chips they support.