# LED Fade in and out - timed.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
I am building an led fade in / out circuit. It fades in when powered and out when the power is removed. I have found a circuit on the www but the website chap hasn't been so forthcoming with more information. I don't currently have a bottomless reserve of varying resistors and capacitors to help find out what I need to change the time taken to fade. I have been told to replace the 100k resistors and 100u capacitor but haven't been told to what. The circuit I am building is exactly as shown in the attachment. I don't know what the rate is either for the given values shown but from a whole days research am guessing its only a few seconds. Also from what I have found out on similar circuits that its only the capacitor and the resistor (shown to the right of it, I believe this is generally known as the draw down) that should be changed. Inevitably I will build the circuit and end up experimenting but would appreciate it if I could get a better idea of where I should be going with the values.

Thanks in advance.

#### Attachments

• 42.4 KB Views: 199

#### wayneh

Joined Sep 9, 2010
16,102
The time constant of an RC tank is simply R in ohms times C in farads. So your 100µF capacitor will charge thru the 100k resistor with a time constant of: 10E-4 times 10E5 equals 10 second.

Your Darlington will need about 1.2V on its base to begin conducting. When the cap is fully charged to 8V, the base will see 4V (ignoring current through the base, which will pull that voltage down to 1.2V).

Note that this won't fade if power is removed, only when the switch is opened. Removing power will cause the lights to immediately go out.

Last edited:
Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
Ok. Bit heavy for me that one! Are you saying if the values were multiplied by 10 the fade would be ten times longer? I know about the switch needing to be opened and not removing power. In the circuit I'm building it into the switch will actually be a relay operated by a timer.

#### Ron H

Joined Apr 14, 2005
7,012
Pulse width modulation would give you a lot more flexibility and control on your fade times. It shouldn't be too difficult. What sort of fade times are you shooting for?
Do you really want to control it with a switch?

#### wayneh

Joined Sep 9, 2010
16,102
Are you saying if the values were multiplied by 10 the fade would be ten times longer?
It would become 100 times longer if you make both R and C 10X larger. There are practical limits of course, but certainly you could play around with the values to get the timing you like.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
It would become 100 times longer if you make both R and C 10X larger. There are practical limits of course, but certainly you could play around with the values to get the timing you like.
Thanks. That's what I needed to know.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
Pulse width modulation would give you a lot more flexibility and control on your fade times. It shouldn't be too difficult. What sort of fade times are you shooting for?
Do you really want to control it with a switch?
I've seen pwm controls but couldn't find a circuit diagram anywhere for it. Also I'm using a timer not a switch. The idea is to switch on at a given time, fade in then several hours later switch off and fade out. I'm ideally looking for around 30 minutes fade but would be happy with 10.

#### wayneh

Joined Sep 9, 2010
16,102
I'm ideally looking for around 30 minutes fade but would be happy with 10.
Whoa, I don't think an RC tank is a good choice for such long times. Ten seconds maybe, 30 minutes, no way. You might be able to do it by using an op-amp in between the RC and the power transistor. Still, 10-30 minutes is a long time for an RC timer.

Do you want the fade to take that long, so that for instance you are at 50% brightness after 10 minutes, or do you want a delay and then a fade out over a second or two? The former requires PWM to be practical.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
I'm after a long fade period, not a delay then a short fade. If I can get a 10 minute period I would be happy. Ive seen several circuits about. 1 has a base power supply maintaining a minimal voltage at the capacitor so dimming starts straight away so you dont have to wait fir there to be sufficient charge in the capacitor - im avoiding discussing this though as that can easily be added later.

I've seen pwm circuits but they've all been based on a manual potentiometer to adjust the brightness. I need this to be automatic. Another circuit using pwm used an LDR.

Ive also seen this for sale where the period is near 15 days. http://www.ebay.co.uk/itm/Aqua-Marine-Aquarium-lunar-cycle-control-unit-4-coral-fish-/221167259418?_trksid=p5197.m1992&_trkparms=aid=111000&algo=REC.CURRENT&ao=1&asc=14&meid=4655917476808728261&pid=100015&prg=1006&rk=1&sd=221167259418&

Last edited:

#### Ron H

Joined Apr 14, 2005
7,012
A microcontroller would be the sensible way to do PWM with such long fade times. I don't think you will be able to do it without some sort of digital circuitry.
Here is an interesting (to me, anyhow) article about electrolytic capacitor leakage. Note that leakage is is a complicated function of rated voltage, capacitance, and time.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
Thanks. I really need to find a circuit for pwm. The original circuit I posted was just a starting point.

#### Phitur

Joined Sep 7, 2009
11
Roxy, I have an idea of what you are trying to do and it is something that I would like to do as well. I want to build a circuit of LEDs for my reef tank and have a fade in and fade out for varying banks of them to mimic sun up and sun down going across the tank. I believe I'm going to have to incorporate some sort of program with an IC to do it. I have a Raspberry Pi that I was going to experiment with to get the functionality that I wanted, possibly through some Arduino combination. Once I figured out the circuitry and logic, I was thinking I'd write python code to put into firmware on an IC (after learning Python, if I can even put python on the chip. I'm pretty sure C++ would work. There are also some stock Arduino program that Steve (below) says will work on his controller.) At least, that's the hope. It's mainly a goal at this point, because I haven't purchased any of the components I need just yet.

There is a site called Steve's LEDs where he has a driver for LEDs. They have a PWM input on them for fading and automation. From what I've read in forums, he has the best prices out there. He also has general information here.

I'm interested in what your application is and how it progresses. I'll also share my insights from what I learn in my pursuit, but I can't promise timeliness (seeing as how I haven't started my own project yet....

Cheers

#### thatoneguy

Joined Feb 19, 2009
6,349
Don't forget that during the fade, the transistor will be dissipating a LOT of heat. The transistor would eventually fail, unless it is connected to a large heatsink.

Programming PWM has gotten far easier for hobbyists with microcontroller products like PICAXE (Very low cost, <$5, BASIC programming language) and the Arduino ($30, C like programming language) to give good PWM for virtually any period of time you would like. The switching transistor also dissipates far less power as it is either switched on or off, rather than behaving like a resistor.

Good non-microcontroller methods for PWM can be found using the 555 timer IC.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
Don't forget that during the fade, the transistor will be dissipating a LOT of heat. The transistor would eventually fail, unless it is connected to a large heatsink.

Good non-microcontroller methods for PWM can be found using the 555 timer IC.
Im aware of the heat dissipation requirements, its the same for the led arrays I will be using.

Ive seen the 555 pwm circuits but there is still little info on how to use it as a fader or alongside a fader circuit.

Any hoo, Im investing in a circuit module that I have found and the designer is happy to reprogram the code to give me an 18 hour fade time, 9 hours up and 9 down. The circuit will be powered via a timer kicking in at 3am, then there will be sufficient light from the leds when the main lights kick in and vice versa at the other end of the day.

Im, still going to have a play with this circuit though, just out of interest!

#### Wendy

Joined Mar 24, 2008
21,840
Actually, this article shows how to do fade in/fade out using PWM. It is very simple, a 555, LM393, transistor, and a few discrete parts. Using PWM the transistor will not get hot, just don't exceed the current requirements.

LEDs, 555s, Flashers, and Light Chasers

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
Actually, this article shows how to do fade in/fade out using PWM. It is very simple, a 555, LM393, transistor, and a few discrete parts. Using PWM the transistor will not get hot, just don't exceed the current requirements.

LEDs, 555s, Flashers, and Light Chasers
Ive been through that site a few times but cannot find anything about lengthening or shortening the fade times, as there are no times stated for the shown diagrams.

#### Wendy

Joined Mar 24, 2008
21,840
The duration of the 555 (and the formula is shown as part of the schematic) is the duration of the fader. This is explained in the theory of operation. Reading is your friend.

I have helped a friend develop a sequential fader using a similar technique, complete with PCB layout. It is also posted here.

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
The duration of the 555 (and the formula is shown as part of the schematic) is the duration of the fader. This is explained in the theory of operation. Reading is your friend.

I have helped a friend develop a sequential fader using a similar technique, complete with PCB layout. It is also posted here.
Maybe a link to the exact page I need to look at could help.

#### Wendy

Joined Mar 24, 2008
21,840
Look at Figure 5.3, it is the base setup.

Figure 10.4 shows how to do this with high current setups, MOSFET are typically better than regular transistors (called BJT).

Are you wanting only fade in/out once, or cycle?

Thread Starter

#### Roxy2

Joined Jul 4, 2012
26
Thanks. I'll have a look at those. The idea is to fade up. Stay on until power removed around 11 hours later when it is needed to fade down. I'm familiar with adapting circuits to run larger powered LEDs via optocouplers. I did that to a project last summer when I converted a 'dice' circuit to run 3watt LEDs.

I've seen fade circuits but they only fade over a couple of seconds. I can adapt the circuit for power but its the timing I am unsure of. Hopefully I can work something out from the paragraphs you suggest.

Last edited: