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


  1. Anonymous

    Well I did everything in the diagram I even did that 1k resistor short from V+ to GND. My transistor is a 2n2222. I used a 2200uf Capacitor and I'm running the circuit from 9V not 5V. (I don't think it matters anyway.)

  2. The capacitor should not make much of a difference, right. I know it sounds obvious, but can you double check the connections of the LED and the transistor? Also, when using 9V instead of 5V you might have to adjust the resistors.
    Can you tell me what exactly is the symptom? "Not working" can mean it doesn't switch on, or that it doesn't switch off.

  3. Anonymous

    Sorry Vitya i'm an eediot!!! I thought that it dims on and off by itself, I didn't realize that I have to press the button.

    Sweet site by the way, I really like your homemade bench power supply.

  4. Anonymous

    Hi, I am try to light up 13 steps on a set of stairs, each step has 2 LED's, one either side of the step, 26 LED's in total.

    I want each step to fade on gradually so the step 1 comes on, then 1/4 second later step 2 fades on, then 1/4 second later step 3 fades on and so on up to step 13.

    Then when the power is switched off each step fades off starting with step 1 up to step 13.

    I propose to use 13 of your above circuits, one for each step.

    Can you tell me what value of capacitors I need for each circuit and if I need different resistors?


  5. Wow. I just spent far more time on this circuit than I had been expecting to. Figuring out how it works intuitively is straightforward, as is calculating the steady-state voltages. Move R2 so that it branches off before R1, on the other hand, and the steady-state calculations get more interesting. (I say more interesting as a person who's just starting out learning electronics; I'm sure it's trivial that way too to someone who's been doing this for ages)

  6. Hi Vitya,

    I only have a 2N3904 transistor —having one heck of a time finding a 2N2222 transistor but not in 100+ quantities. Will the 2N3904 work in this circuit? And the capacitor, the best I have is a 470uF —I suppose this regulates the fade on/off time —am I correct? Anything you have to say will be greatly appreciated.

  7. Hey Jack,
    Any transistor should be OK, since there is nothing special to the circuit. It doesn't work on high frequencies etc.
    Yes, using a smaller capacitor will result in faster transition. However, you can use several 470uF capacitors in parallel to achieve greater capacitance. This is just an idea, obviously I don't know your setup, maybe you don't have room for more capacitors, but it is a common way of achieving greater capacitance with standard values.

  8. Thanks Viktor,
    I will give it a try. I have found a 1000uF capacitor and will buy it when I get the time to do so. Multiple 470uF's will take up to much space and the 1000uF appears to be 2/3 the size. New at this —4 weeks old —hobby. Understanding transistors on my own will take time.

    Thanks for the help,

  9. Viktor I was wondering I'm running a 12v led strip and want a fade in and out effect but don't want to cut voltage down at all. How would I got about the circuit to still get about a 3sec fade in/out. Thanks.

  10. There is nothing stopping you from experimenting with different R and C values in this circuit… 🙂

    However, for anything more complex than the above circuit I would go with a microcontroller, especially if the project has one anyway.

Your thoughts?

This site uses Akismet to reduce spam. Learn how your comment data is processed.