Saturday, February 12, 2011

LED Fade in / Fade out


I found a small project at another site about fading an LED in and out smoothly, without a microcontroller. I changed it a bit. In my version I removed one of the transistors and changed some resistor values. This is supposed to result in lower costs and smaller footprint. I know it's a very small difference, but still.

The circuit

In default state (when S1 button is depressed) capacitor C1 is discharged, so transistor T1 is closed, hence the LED is off. When the button is pressed, C1 gradually charges, which gradually opens T1 lighting up the LED slowly. When the button is released, C1 discharges through R1-R2, slowly closing T1, gradually fading the LED. (If we omit R2, the discharge process would take forever a very long time.) By changing the values R1, R2, C1 one can change the speed of fade in, fade out. The given values result in roughly 1.5 second for both fade in and fade out.
The simpified circuit