Go Down

### Topic: Basic maths: 10k? resistor, 5V voltage, 100µF cap=0.76 second LED fadeout (Read 5959 times)previous topic - next topic

#### mace ##### Aug 20, 2013, 07:40 pm
As an exercise in basic EE and basic maths, i want to fade out a LED with a capasitor. I wonder if anybody could peer-review my calculations?

http://www.youtube.com/watch?v=Rea1_hrf1Gw

Given i am using a 10k? resistor and a standard LED in series, and in parellel with a 100µF cap, all in a 5V circuit, shouldn't my timeout be 0.76 seconds?

• Mr. Ohm (V=IR), thus I=V/R

• Mr. Kirchhoff (V=V1+V2), thus a 1.2V front voltage LED turns off at 5V=1.2V+VacrossCap=VacrossCap=3.8V.

Charge C = F*V
Charge C = I*t
Time t = F*V/I = 0.0001F*3.8V/(5V/10000?) = 0.76s + = ?

#### DVDdoug #1
##### Aug 20, 2013, 08:43 pm
Take a look at this page.

Have you had calculus yet?   A capacitor discharging through a resistor is an exponential function.  (Since the current is not constant, you cannot use C = I x t except for "one instance" in-time.)

The non-linear LED further-complicates things.    ...It's over my head, and it's been long time since I've had calculus.   It might be as simple as a discontinituity when you hit the LED cut-off voltage (with an "ideal" LED) and the current suddenly drops to zero, but I'm not sure.   Or, it might involve two simultaneous equations until you hit the discontinuity? #### mace #2
##### Aug 20, 2013, 09:27 pm

Take a look at this page.

That was good, thanks. Stack Exchange is fantastic.

Have you had calculus yet?

LOL i admit my calculus is rubbish, after so many years since highschool. That's why i'm doing such basic math now, and also looking for peer support here. Thanks for it DVDdoug, i appreciate it! This is great exercise.

Now that the day is drawing to night, and it's getting darker, i can empirically see that the 0.76 seconds is too short a time for my LED's fadeout; it seems to be above 1 second.

A capacitor discharging through a resistor is an exponential function.  (Since the current is not constant, you cannot use C = I x t except for "one instance" in-time.)

That's right, it makes sense; the LED is fading, and that is exactly the reason why it's getting less and less bright; the current is dropping... and thus it's bleeding the charge in the cap slower and slower.

My amended calculation, assuming an exponential decay of current, is -10000?*0.0001F*ln(1.2V/5V)=1.43s. That seems to correlate better with sense-based observations. Next, maybe i should build a tool, using Arduino, a light-dependant-resistor and millis(), that would measure the time it takes for the LED to fade #### mmcp42 #3
##### Aug 20, 2013, 09:37 pm
suggest build it and just try a few values!
there are only 10 types of people
them that understands binary
and them that doesn't

#### Erdin #4
##### Aug 20, 2013, 10:25 pm
I agree what mmcp42 wrote.

Some leds are very well visible with only 0.5mA or even less.
I think that one led can be 10 times longer visible than an other led.

#### AmbiLobe #5
##### Aug 20, 2013, 11:56 pm
The circuit schematic is too far away, but let me guess :
The capacitor is in parallel with the LED.
The switch is in parallel with the LED.
The resistor is not used.

#### mace #6
##### Aug 21, 2013, 12:00 pm

The circuit schematic is too far away, but let me guess :
The capacitor is in parallel with the LED.
The switch is in parallel with the LED.
The resistor is not used.

@AmbiLobe: Do you mean how my circuit was built? The resistor was used; the cap is in parellel with LED and the resistor, which are in series together. See the attached schematic.

#### AmbiLobe #7
##### Aug 21, 2013, 12:31 pmLast Edit: Aug 21, 2013, 12:36 pm by AmbiLobe Reason: 1
The RC time constant is 1 second.

Thank you for the schematic diagram. The math is like this after the switch is released:
There are three nodes : S1 Anode GND
The LED Anode has about 2v as a diode drop. Treat it as a voltage source of 2v.
The resistor has 3 volts time = t = 0 seconds
The peak current at t=0 is i(0) = v/r = 3/10k = 0.3mA
The current decays exponentially

i(t) = i(0) * e^(-t/rc)
rc = 10k * 100uF = 10^4 * 10^-4 = 1 second
e = 2.7182 a constant from science education

e^-1 = 1/e = .632

e^-2 =  1/(e*e) = .632 * .632 = .40
e^-4 = .16
e^-8 = .0256

after 1 second i = .3mA * .632 = .189 mA
after 2 seconds i = .3mA*.16 = 48 micro amps (uA)
after 8 seconds i = .3mA*.0256 = 8uA

Conclusion : your math was wrong. The LED will be dim with .3mA.
Its power is 2v*.3mA = 0.6 milliwatts
This is a dim bulb.

#### MarkT #8
##### Aug 21, 2013, 06:01 pm
Quote
See the attached schematic.

You short the supply into the capacitor - add a small value resistor in series with the
switch if you want to avoid welding it shut and resetting the Arduino!
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### mace #9
##### Aug 23, 2013, 11:00 pm

Quote
See the attached schematic.

You short the supply into the capacitor - add a small value resistor in series with the
switch if you want to avoid welding it shut and resetting the Arduino!

Oh, so it's not good to let caps suck in energy as they please, without controlling it? As explained f.ex. here. Hmm i guess (V=IR) if at the beginning time t0 the voltage jumps to 5V, the resistance is (theoretical) 0, then the current is infinite, until the capasitor starts to build resitance as it's charge increases. Is this it?

Thanks MarkT for bringing this to my attention!

I love these little electronics and Arduino, it's such a great way to get (back) into math and so many other wonderful things #### RoyK #10
##### Aug 24, 2013, 04:19 am
This discussion reminds me of this classical problem.

The charge on a capacitor is given by q=CV
The energy stored in a capacitor is 1/2 C*V*V (one half C Vsquared)

Assuming perfect capacitors, perfect wires (0 resistance), and a perfect switch.

We charge a 1 farad capacitor to 1 volt and disconnect it from the charging source.
Its charge is then C*V = 1 coulomb and its energy is .5 * 1 * 1 * 1 = .5 joules.

Now we use a switch to connect the capacitor in parallel with another 1 farad capacitor. Since charge must be conserved our 1 coulomb of charge is now divided between the two capacitors. So the voltage on each is q/C or .5 volts and the energy stored in each is then .5 * 1 * .5 * .5 = .125 joules. So the total energy in the two capacitors is .125 * 2 = .25 joules.

Question is what happened to the missing .25 joules of energy?

#### mrburnette #11
##### Aug 24, 2013, 06:07 am
The math is all fun, but when you need to quickly play, you need SPICE

http://www.falstad.com/circuit/

#### AmbiLobe #12
##### Aug 24, 2013, 06:45 am
"Question is what happened to the missing .25 joules of energy?"

During the time that current flowed from one capacitor into the next capacitor, a magnetic field was changed. The energy went into that magnetic field during an impulse. A resonance then occurs without damping, and the oscillation lasts forever. The missing energy is tossed about forever, outside of the capacitive energy.

#### CrossRoads #13
##### Aug 24, 2013, 07:36 am
The ESR of the capacitor also comes into play, which limits the current flow out of the cap to some extent.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### cjdelphi #14
##### Aug 24, 2013, 07:52 am
How come you're not using a transistor ?  You can make it fade out nicely then!

Go Up