Help with LED fading in

Thread Starter

goblue

Joined Oct 18, 2011
5
Hi all,

I'm a circuits novice (I've taken one circuits class). I'm working on a project where I need an LED light to start off and then gradually increase in brightness when I push a button. I am trying to do this by putting a capacitor in parallel with the LED, but it is not fading in. Maybe it's fading in too quickly but it looks like it just comes on immediately.

I just need it to be very simple i.e. I press button, light fades on. Ideally I would like to be able to have it fade in in about 5 seconds or so. Is there a good way I could do this?

Thanks a lot.
 

ErnieM

Joined Apr 24, 2011
8,377
A back of the envelope calculation leads to a cap of 40,000uF to effect a LED using 10mA for 1.2V for 5 seconds. Big cap. That's .04 Farads.

Plus the turn on isn't going to be a nice linear increase in brightness. NOTHING happens for a few seconds, the the LED comes up fast. Kind of what your experiment showed.

Lemmy get back here later. PWM is the way to go but it's not simple (well, was for me but I had a little mirco running things). Lemmy see if I can think of a simple current source ramp.

What LED, and what power source are you using? Can you wire up some simple parts, say some resistors and transistors (all stuff from Radio Shack if you like)?
 

steveb

Joined Jul 3, 2008
2,436
I'm working in a remote location and my internet access is limited. Here is a quick sketch I did without too much thinking. It could form the basis for a simple approach.

There may be some errors, but if this looks interesting maybe some other people can help you further. For, example you would need a single supply opamp for this implementation, and the circuit values may need to be tweaked based on your LED current.

Basically this is a simple current source controlled with a logic level input. The RC time constant is isolated from the LED through the opamp.
 

Attachments

ErnieM

Joined Apr 24, 2011
8,377
Here's a way to control a LED using a PWM by SgtWookie I just don't know how much this will teach you, it's jumping ahead a few steps.

Let's start at the very beginning, a very good place to start. We'll look at a LTL-4266N made by Lite-on.

A LED is a diode, and it conducts current like other diodes:



Reading across the bottom we see this LED just turns on with about 1.4V, and by the time we get to 2.2V the devices is screaming hot with current. That is just a 0.8V range... so maybe we don't want to use voltage to control this thing.

Let's look at how much light comes out of these:



Now looking at the light (intensity) output for a given current we can see a nice linear change as we go from 0 to 40 mA.

So the question I am thinking over is how to make a nice linear current ramp with the fewest parts possible. Something simple so you can follow how every part fits and what it does.

I think I can do it in 5 parts. I'll sketch that out in the morning.
 

Thread Starter

goblue

Joined Oct 18, 2011
5
Thanks a lot Ernie, Steve and Ionic!

Ionic, I tried a resistor in series with the capacitor and it appeared that it didn't do much.

Ernie, thanks a lot for the background info and thanks in advance for your sketch in the morning.

Steve, thanks for giving it a go with your limited internet. That looks interesting and something I could possibly give a shot.
 

Wendy

Joined Mar 24, 2008
23,415
Part of the reason I asked for a schematic is I wanted to see what you are trying. I am one of the draftsmen on this site, I draw quite a few schematics. If you show me what you are trying to do I'll try to show you how to clean it up.
 

Thread Starter

goblue

Joined Oct 18, 2011
5
Bill, is there a good tool you know of online to draw circuit schematics?

edit: used the falstad circuit simulator to draw this schematic

It looks like the capacitor is just charging up too quickly.

Anyway, that's what I've been trying but like Ernie said, that is probably not the best way to go about it.
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,377
If you go to Express PCB they have a free schematic editor (and PCB layout program too for "that day") that I find very simple to use, and I have a $10,000 professional schematic program here. That's is the program I used to draw this:



I've added a few parts to get the "charging cap" idea to drive the LED. Here's how it works:

SW1 (which can just be some jumper wire) when at zero leaves R1 and C1 uncharged. Move it it the plus battery supply and C1 now starts to charge thru R1. The time constant is R1*C1 = 10K * 100uF = 1 second, or 5 seconds to complete. That should be a good place to start.

It would be wonderful if that was a nice linear increase, but it isn't. Hey, can't have good cheap and fast all together, right? It should e good enough to get a dimming action.

Now onto that "other stuff."

Q1 is a darlington transistor. From the outside it looks like a regular transistor but actually has two devices inside. I used it to get a lot of current gain (at least 1,000) so the base doesn't steal (much) current from R1 going into C1.

Q1 is basically what is called an "emitter follower," meaning the voltage on the emitter VR1 follows the voltage on the base VC1. However, since there are two transistors inside, it follows it with about a 1.4V offset.

The current thru R2 is thus:

I(R2) = VR2/R2 = (VC1-VBE)/R2 = (VC1-1.4)/330

As VC1 can vary from 0V to 9V the max current in R2 is:

I(R2) max = (9V-1.4V)/330 = 23mA

Now if you look down the right side you can see that IR2 is just about the same as IQ1 which is the same as ILED, so by setting the base voltage on the transistor we can set the current in the LED.

Actually, that assumes the LED can run off zero volts, so the max current is actually a little less.

So when you change SW1 to the power side, at first, nothing happens. We need to let it charge to 1.4V to turn Q1 on. Then the LED starts to get brighter and brighter, but as it gets brighter the change will decrease since that is how C1 is charging.

Once the LED is on, you can switch SW1 back to 0V and watch the LED get steadily dimmer and dimmer till it goes out.

I picked parts that Radio Shack sells. They don't sell much, they are expensive, but they are available in lots of places.

I hope this little thing helps you along in learning circuits. Ask away if you have any questions.
 

Thread Starter

goblue

Joined Oct 18, 2011
5
Thanks Ernie, that is an enormous help. I will try building that probably Friday or Saturday so I may have more questions then.

For now, just a quick question: Is there a way I can minimize the fading out time while keeping the fading in (getting brighter) time the same?
 

Wendy

Joined Mar 24, 2008
23,415
You are over complicating it. Hand draw a schematic, then either scan it with a flatbed scanner or take a picture of it. I use a set of templates I created I call PaintCAD if you want to draw it with M/S Paint. I draw mine with copy and paste. I do a lot of schematics. I use Ernie's method when I need to translate the schematic into a home made PCB.

Introduction and PaintCAD

LEDs, 555s, Flashers, and Light Chasers

Chapter 12 - Special Effects

It already has a lot of solutions already laid out, including power PWM drivers, fading LEDs, and comet trails.

I'm more interested in your attempt at a solution, since there are many, many ways of doing this. Going through the threads there have been a lot of people doing the same thing.

Ernie, those built in resistors are going to kill your idea. Do the same thing with individual transistors, in other words, make a Darlington transistor instead of buying one off the shelf. I had the same problem with the basic fading LED circuit in Figure 12.1.
 
Last edited:
Top