I am wanting to have an LED that fades out when power is taken away. (Look at the power LED on the big mac LCDs if you want to know what I'm talking about) Anyway, I figure the easiest way is with a capacitor, but I was wondering if there is a formula that would tell me how long it would take the power to the LED to fade after the power from the capacitor is gone. Thanks, Daniel
There is a pretty simple formula for calculating voltage across a cap given time and a resistance. I don't know it offhand, but any textbook will have it and you can google it quickly enough I'm sure. Since the led incorporates it's own voltage drop in addition to the series resistor, just use supply voltage divided by the current for your resistance. The led will go out when the cap voltage goes below the voltage drop. However, assuming you have a variety of caps on hand, some experimentation will probably be a faster way to get what you're looking for. Just a tip I read somewhere, if you want the fade to be longer, instead of using a big cap, just use a small cap on the base of a transistor, then it can be much smaller.
A cap is fully charged after 5 tau (timeconstant). Tau = R*C. C = (fadeouttime/5tau) / Rled I.e. 1 sec fadeouttime and R=470ohm Code: C= (1sec/5tau) / 470ohm C= 0.2 / 470 C= 425uF
ln(Vc) = ln(Vmax) – t/tau or ln(Vmax) – ln(Vc) = t/RC So a cap discharging from 12v to 2v would take about 1.8 time-constants.
Thanks y'all. I knew there had to be some simple formula for it, but I haven't had much experience with choosing my own caps for projects. Usually I'm either just replacing them while fixing something, or repeating something I've seen done before. Thanks again! P.S. Also, mattg2k4, that trick using the transistor is pretty slick, I can think of lots of uses for that.