0
\$\begingroup\$

I understand how to fade out the LED with capacitor, but I don't seem to understand how to 'fade in' the LED. Can I also do it with capacitor or do I need to use resistor? because if I put a resistor, the led never fades in, just gets weaker. Thanks

\$\endgroup\$
1
  • \$\begingroup\$ Strap the capacitor to the other rail. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 20 '16 at 10:13
3
\$\begingroup\$

Can I also do it with capacitor or do I need to use resistor?

You need both:

schematic

simulate this circuit – Schematic created using CircuitLab

This will both fade-in and fade-out the LED as the 5V line is connected and disconnected.

\$\endgroup\$
1
  • \$\begingroup\$ Can't think of anything simpler, but be aware that the usual "time-constant" (in this case 0.1 second) won't give you a satisfying visual 0.1s fade in/out - it'll seem faster. \$\endgroup\$ – glen_geek Sep 20 '16 at 14:50
4
\$\begingroup\$

enter image description here

Use an emitter follower (Q1 - jelly bean NPN) to buffer the voltage across capacitor so you see the effect of the capacitor charging and discharging through R1. (R1C1 sets the time constant)

\$\endgroup\$
0
\$\begingroup\$

The analog proposal is not going to work well. The cap charge is exponential, and the LED needs a high enough Vf to work. So it will still look very binary or on/off.

Better way is to do this digitally with pulse width modulation. The LED is very fast, and your eye will average the amount of time on as if it were dimming. Several ways to do this exist, discussed here. https://www.maximintegrated.com/en/app-notes/index.mvp/id/5718

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.