# Capacitor LED test?

#### Mathematics!

Joined Jul 21, 2008
1,022
I am testing this simple circuit that when the switch is off the light slowly dims out instead of going out.

What I am wondering is when the capacitor is fully charged and switch is off does the current flow out of the negative or positive side of the capacitor?

The reason why I ask this is because I have the LED cathnode (short leg)
on the side of the - of the capacitor. It works but if I do it the other way around cathnode to postive Doesn't work.

I thought current in a LED flows from anode (long leg ) to cathnode (short leg). Because I would think since LED are special diodes they won't work if the current is flowing in the cathnode direction.

So the only thing I can think of is current must flow out of the positive side of the capacitor?
i.e electrons are flowing out of the positive side ?

In a battery, current (electrons flow from negative side to positive side )
Maybe I am getting something with conventional flow as oppose to actual flow.

Can anybody clear up this simple issue.

Also how can you figure out how long the light will stay on with a capacitor. Like if I had a 10uF capacitor how could I figure out how long it would take to fully discharge? i.e turn off the light.

Some of my capacitors also give a voltage number as well as the capacitance. For example I have 220uF 16v. Is this voltage to calculate the total charge the capacitor can hold C = Q/V => 220uF * 16v = Q
If this is true how can we calculate the time it would take to completely discharge. Won't this depend on the rate at which the current is flowing. How can we do it just from knowing 220uf , 16v.
Because I would like to beable to determine when the capacitor is fully discharged and how long it takes to fully charge it. So I know how long the led is going to stay on.

Last edited:

#### beenthere

Joined Apr 20, 2004
15,808
An LED is a diode, and obeys the same polarities as any other diode. Current flows cathode to anode. Your experiment confirms this.

#### SgtWookie

Joined Jul 17, 2007
22,201
Also how can you figure out how long the light will stay on with a capacitor. Like if I had a 10uF capacitor how could I figure out how long it would take to fully discharge? i.e turn off the light.
This part gets complicated. As the forward voltage decreases across an LED, the current through it decreases at nearly an exponential rate. Initially, the LED will seem to dim rather quickly, but can remain dimly lit for quite a long time. Dimming of LEDs in automotive applications is frequently performed using PWM.

Some of my capacitors also give a voltage number as well as the capacitance. For example I have 220uF 16v. Is this voltage to calculate the total charge the capacitor can hold C = Q/V => 220uF * 16v = Q
No, the voltage rating is the absolute maximum voltage rating for the capacitor. If the capacitor is subjected to higher than the rated voltage, it's leakage rate will become excessive. In the case of electrolytic capacitors, this will cause the electrolyte to overheat, possibly forcibly rupturing the case.

The standard "rule of thumb" for capacitors is to always use a cap rated for twice the expected voltage in the circuit.

#### Mathematics!

Joined Jul 21, 2008
1,022
This part gets complicated. As the forward voltage decreases across an LED, the current through it decreases at nearly an exponential rate. Initially, the LED will seem to dim rather quickly, but can remain dimly lit for quite a long time. Dimming of LEDs in automotive applications is frequently performed using PWM.
Yes but how can I determine how long a capacitor will take to completely discharge? I have done LC, RLC, etc circuits and solved the differentail equations for these but from the capacitors I have they only tell you the capacitiance and voltage rating. How can I from this find the exponential curve for the discharging of the capacitor.

If I add capacitor's in parrell will it take longer for the light to stay on after the switch is open. What I mean is adding more capacitance does it make the light stay on alot longer or is the discharging more dependent on the tau in the exponential curve. How can you make the light dim more gradually. Because right now I am using 10uF and it flashes and goes out pretty quick.

PWM you mean pluse width modulation how is this suppose to dim a light gradually. I thought PWM was just for signal and transmision stuff.

#### SgtWookie

Joined Jul 17, 2007
22,201
Yes but how can I determine how long a capacitor will take to completely discharge? I have done LC, RLC, etc circuits and solved the differentail equations for these but from the capacitors I have they only tell you the capacitiance and voltage rating. How can I from this find the exponential curve for the discharging of the capacitor.
I don't have a formula for you offhand, however this plot I made of a 1N4002's Vf vs current a few months back should help explain a bit:

Notice that as the diodes' Vf decreases, the current through the diode decreases at nearly an exponential rate. While the Vf vs current plot for an LED would be different (higher for a given current), it would be quite similar. Once an LED becomes forward biased, it actually continues to emit visible light down to very low current flow; you may have to be in a completely dark room to see it though. Attempting to calculate exactly how long the LED would emit visible light would depend upon a number of variables, including the ambient background light, LED's Vf vs current over a range, etc.

If you wanted the cut-off to be more definite, you could wire a fixed resistance in parallel with the LED to provide an alternative discharge path for the capacitor.

If I add capacitors in parallel will it take longer for the light to stay on after the switch is open. What I mean is adding more capacitance does it make the light stay on alot longer or is the discharging more dependent on the tau in the exponential curve. How can you make the light dim more gradually. Because right now I am using 10uF and it flashes and goes out pretty quick.
How did you wire in the capacitors? Posting a schematic of your circuit would be quite helpful.

PWM you mean pluse width modulation how is this suppose to dim a light gradually. I thought PWM was just for signal and transmision stuff.
Yes, pulse width modulation.

A voltage-controlled pulse width modulator circuit could dim the LEDs at a much more controlled rate.

#### Attachments

• 24.2 KB Views: 330

#### SgtWookie

Joined Jul 17, 2007
22,201
See the attached simulation.

The 1st two LED circuits are basically identical; just the current limiting resistor has been moved from the cathode side to the anode side.

In the 3rd circuit, a 1k resistor has been added in parallel to the LED.

The 1N5828 Schottky diodes are there to prevent the individual circuits and the signal generator (V1) from interfering with each other.

The voltage plots from points C and B (charge on C1 and C2) are identical; since C (yellow trace) was plotted after B (cyan trace), it was covered up.

Notice how both C and B discharged rapidly to the Vf's of the LEDs (1.7v in this case) and then the rate of decay became very low. Were the plot extended even far past 12 seconds, you'd see the rate of voltage decay continue to drop. You should be able to see how problematic it is to determine at what point the LED would actually extinguish.

Now notice plot A (violet trace); since there is a fixed 1k resistor across the LED, the time where the current falls to zero is roughly 1 second after power (plot D, green) is disconnected.

#### Attachments

• 59.9 KB Views: 74

#### Mathematics!

Joined Jul 21, 2008
1,022
If you wanted the cut-off to be more definite, you could wire a fixed resistance in parallel with the LED to provide an alternative discharge path for the capacitor.
Yes , but I don't understand why adding a resistor in parrallel would provide a more gradual dim of the light?

Correct me if I am wrong but no matter what size capacitors I use it will give the same fast flash diming of the light effect. So it's not the size of the capacitior that creates a more gradual diming? Big capacitance would just take longer to fully discharge but they would discharge so much voltage/current that the led would then be still on for a while but you couldn't see very easilly.

The only differents between using bigger capacitance is if you look very hard you can see the light very dim for a longer time but their will still be the quick exponential discharge of most of the voltage/current at the begain.

Correct me if I am wrong.

Anyway how is the resistor going to provide a more gradually diming?

And I have noticed you are using circuit maker. I am wondering is this software that is free to download. Because I am looking for good free software to create and test my circuits before I try them out on my solderless breadboard. The easy of use would also be a great help.

#### SgtWookie

Joined Jul 17, 2007
22,201
Yes , but I don't understand why adding a resistor in parallel would provide a more gradual dim of the light?
It doesn't provide a more gradual dimming; it provides a way where you can determine more readily where the LED will extinguish.

Correct me if I am wrong but no matter what size capacitors I use it will give the same fast flash diming of the light effect.
Not really. The larger the capacitor, the longer the LED will remain illuminated after the power is disconnected.

Note that in the three LED circuits, the capacitor was across both the LED and the current limiting resistors. If your capacitor is just across the LED, your LED won't be lit brightly very long at all once power is disconnected.

You have not yet posted your circuit. Please do so.
So it's not the size of the capacitor that creates a more gradual diming? Big capacitance would just take longer to fully discharge but they would discharge so much voltage/current that the led would then be still on for a while but you couldn't see very easily.
It depends on the size of the cap, the value of the current limiting resistor, the LED current, and the value of the resistor in parallel with the LED.

The only difference between using bigger capacitance is if you look very hard you can see the light very dim for a longer time but their will still be the quick exponential discharge of most of the voltage/current at the beginning.
That's what I showed in the plots in my last post.

Anyway how is the resistor going to provide a more gradually diming?
It doesn't provide a more gradual dimming; it provides a more predictable point where the LED will become dark.

And I have noticed you are using circuit maker. I am wondering is this software that is free to download. Because I am looking for good free software to create and test my circuits before I try them out on my solderless breadboard. The easy of use would also be a great help.
Circuitmaker Student is a discontinued product for which there is no support; it's 10 years old, has a limited library that you can't add to, and a limit of 50 components in any schematic.

http://www.linear.com/designtools/software/

I just use Circuitmaker Student for quick & dirty simulations like this, because I started using it a couple of years before I started using LTSpice. You'd be much better off to start with LTSpice, as it's a current (and free) product that has a lot of support.

#### Mathematics!

Joined Jul 21, 2008
1,022
Not really. The larger the capacitor, the longer the LED will remain illuminated after the power is disconnected
Yes , but what I was getting at is no matter what capacitor you use the light after power is turn off. The light will get exponential dimmer.
So it will go from bright to very dim very fast then depending on the capacitance, remain on very dim for a long or short time based on the capacitance being high or low.

Basically my scheme is just a capacitor connected in parrell with a LED and their is a battery and switch. When the switch is on it charges the capacitor as well as turns on the light. Then when the switch is turned off the light stay's on while the capacitor is discharging.

It happens to fully discharge very fast. What capacitor would you use if you wanted the led to stay on for a minute after the switch is turned off.

Note I am using capacitors in the uF are these to small?

In a RC circuit we have Q = Qo * e ^-t/RC
Where Qo is the initial charge on the capacitor.
R is the resistors resistance.
C is the capacitors capacitance.

Differentiation we get the current for the capacitor
Multiplying by R we get it's voltage

I would think if we can manipulate the 1/RC we could manipulate the diming of the light.

#### SgtWookie

Joined Jul 17, 2007
22,201
What I was getting at is no matter what capacitor you use the light after power is turn off. The light will get exponential dimmer.
So it will go from bright to very dim very fast then depending on the capacitance, remain on very dim for a long or short time based on the capacitance being high or low.

Basically my scheme is just a capacitor connected in parallel with an LED and there is a battery and switch. When the switch is on it charges the capacitor as well as turns on the light. Then when the switch is turned off the light stays on while the capacitor is discharging.
This is a good way to fry your LED(s), unless it has built-in current regulation.

You need to either have a current limiting resistor in series with the LED(s), or an active current regulator.

It happens to fully discharge very fast.
You need a current limiting resistor in series with the LED, and the capacitor across both the current limiting resistor and the LED.

What capacitor would you use if you wanted the led to stay on for a minute after the switch is turned off.
Once you have the value of the current limiting resistor and the Vf of the LED, and the resistor in parallel with the LED, you should be able to calculate the RC time constant. Right now, you have the capacitor directly in parallel with the LED, so there IS no "R" for your equation.

In order to increase the value for the current limiting resistor, you'll need to increase your supply voltage.

Are you still confused as to why the ON time is so short?