LED dimmer

slackjack

Nov 2, 2005
177
Joined
Nov 2, 2005
Messages
177
Hey all,


I want to make an LED dimmer, that has about 5 LEDs hooked up to a 12VDC supply.  They should gradually  approach their (near) max brightness. But I want this to be done with user intervention. I just close the switch and the brightness increases (and also the opposite must happen when I open the switch). Can this be done by a capacitor whose charging time is controlled by a resistor? Please tell me the several ways of doing this.

--thank you.

 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
Here's one I knocked up. The trouble with LEDs is that their apparent brightness does not change linearly with current, so this design might not be as smooth as you want. But it works.

It's a ramp generator - press the switch and the voltage at Q2's collector slowly and linearly drops, gradually powering up the LEDs, release the switch and it rises.

Choose LED current limiting resistors as you would normally, for the supply voltage in use.

As it is, this circuit's output voltage changes at about 3V/s, meaning it completely lights up after 4s with the switch pressed, and takes another 4s to completely extinguish with the switch open again. You can choose a different capacitor value to change this duration:

C = 2.5e-6 * T

where T is the time taken to fully illuminate or extinguish.

I used a darlington pair, because I have no idea what kind of current your LEDs require. Q1 can be any small NPN signal transistor. I used a BC108. Q2 will depend on the total current you need for your LEDs. If you need more than a total of 50mA for all of the LEDs, I suggest you use a chunky transistor like a TIP31.

What I'd really like to do, to make the lighting and dimming more linear, is pulse power to the LEDs and change their brightness by modifying the pulse's duty cycle, a la PWM. So I'm going away now to play with that idea.

View attachment 39370

 

slackjack

Nov 2, 2005
177
Joined
Nov 2, 2005
Messages
177
Hey Cabwood, thanks for youre reply. But you said that the voltage linearly drops across the collector of Q2, do we really need to have the transistor in there. Couldnt this be accomplised by just the charging and discharging action of the capacitor? Also I dont understand the need for a dralington pair.

thanks again

 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
I can't imagine a way of causing the lights to slowly dim AND slowly light without the use of a huge capacitor (or two - each 20000uF or more) and a double pole switch. Even then the initial charge/discharge rate of the capacitors will be high, dropping off with time, meaning there won't be a smooth transition from light to dark and vice versa. The use of transistors simply makes everything smooth and small.

 

Theatronics

Jul 12, 2006
158
Joined
Jul 12, 2006
Messages
158
The human eye can only detect flickering up to about 40hz at max.
Above 100hz and humans see only a solid light.  (Neon and Vapor lights flicker at 60hz)

LED's can flash on and off MUCH MUCH faster, thousands of times a second.

Set up a LED flasher that flashes the LEDs at 1000hz.
Then control the 'Apparent' brightness with the duty cycle of the on cycle.

If the LED's are only on 1% of each cycle they will 'Appear' very dim.
if they are on 99% of the cycle they will 'Appear' very bright.

LEDs were designed to work at one voltage.  While some PN effect fails due to manufacturing errors thus allowing them to dim a little at lower voltages. A perfect LED would hardly light at anything below it's Knee Voltage.

Too much voltage and the current melts the die. 

Pulse Width is the key.

-Mike

 
Last edited by a moderator:

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
Hey Theatronics.

That's what I said. PWM. So that's what I did. But it's two transistors, a comparator, two caps and half a dozen resistors. I think one could wrestle a 555 into doing this, too. Slackjack wants simple, so I'll leave it at that.

I was thinking of another way though, which interests me - that is to use a photodiode to feed back to some amp a measure of the light intensity from one of the diodes, and use that to straighten out the luminosity curve. Just another "way".

 

slackjack

Nov 2, 2005
177
Joined
Nov 2, 2005
Messages
177
Thanks for the replies guys. I've got another question about the circuit that Cabwood  drew. Can the circuit be made with only one transistor? Also why wont the LEDS come on just like that, I mean the way I see it the anode is currently more positive than the cathode - shouldnt this cause the LEDs to light up wihtout any variations in brightness?

Set up a LED flasher that flashes the LEDs at 1000hz.
Hey Theatronics , do you by any chance have an example that I can look at (that may also include the PWM circuit)?
 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
You could pull out Q1 and connect Q2's base where Q1's base used to be (betwen R1 and R2). This might work - though if it does the ramp probably won't be very linear, and the lighting and dimming not very smooth. Try it!

As for the LEDs being always lit, they won't if Q2 isn't conducting. The whole idea of the circuit is to slowly bring Q2 into and out of conduction, thus slowly increasing and decreasing the current through the LEDs. This all has little to do with voltage across the LEDs, and is more about controlling the current the through them.

 

slackjack

Nov 2, 2005
177
Joined
Nov 2, 2005
Messages
177
This all has little to do with voltage across the LEDs, and is more about controlling the current the through them.
It makes sense now. Thanks for youre help  :)

btw, I noticed that you used some dashed lines in the schematic (LED section). Does this mean that I can have as many LEDs without changing component values?
 

audioguru2

Apr 6, 2004
12,026
Joined
Apr 6, 2004
Messages
12,026
slackjack said:
I noticed that you used some dashed lines in the schematic (LED section). Does this mean that I can have as many LEDs without changing component values?
Each LED that is added increases the current through Q2. It is obvious that if the current in Q2 is too high then it will melt.
 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
Yes, you can connect as many resistor/LED pairs as you like, limited only by the current and power rating of Q2. At full brightness each resistor will have about 10V across it (12V supply - 2V across diode). Use Ohm's law to work out the resistance and current for each LED. Knowing the current, multiply by the number of LEDs, and you have the total current flowing through Q2.

Example: 8 LEDs, each @ 20mA. The current limiting resistor will be (12 - 2) / 0.02 = 500 Ohms. Total current = 8 * 20mA = 160mA.

The power disspipated by Q2 peaks about half way between fully off and fully on, when it has 6V across it. This condition doesn't last long, of course, but you need a transistor that can handle it. To calculate the maximum power, multiply total current by half the supply voltage.

Example: 160mA * 6V = 0.96W

So, for these examples, choose a transistor that can handle 160mA, 1W.

 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
Sorry, max power will be about half supply voltage multiplied by half max current, like this:

(12V / 2) * (160mA / 2) = 0.48W

 
Last edited by a moderator:

slackjack

Nov 2, 2005
177
Joined
Nov 2, 2005
Messages
177
So, for these examples, choose a transistor that can handle 160mA, 1W.
Is this parameter known as PDmax?


The power disspipated by Q2 peaks about half way between fully off and fully on, when it has 6V across it.
I dont really understand why this is so. Also why did you use half the max current?
 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
PDMAX is the maximum power it can dissipate when cold. Since it's likely to heat up for a few seconds as the lights come on and off, You are more interested in the maximum it can dissipate without a heatsink, in air at 25 degrees C. This figure is quoted as "PC(Ta=25)". A good transistor for up to about 200mA would be the BD135, with a PC of 1.25W. With a small heatsink, you could increase this to about 350mA.

The voltage across the transistor traverses a range of 0-12V, during which the current rises almost linearly. The power dissipated in the transistor is the product of the current through it and the voltage across it (P = I x V). If you plotted a graph of that power against voltage you would see that it peaks at about 6V. It is clear that when the transistor has all 12V across it, and no current is flowing, P = I x V = 0. When the transistor is fully on, and maximum current is flowing, it has almost 0V across it, so P = I x V = 0. The peak power must therefore be somewhere between these extremes.

 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
That transistor is a limiting factor, for sure, but what Theatronics and I proposed was a PWM design which would not only make the on/off change smoother visually, but would also vastly improve the power efficiency, so heat (brute force) wouldn't be such an issue.

The trick is to have that transistor permanently either fully on, or fully off, so that its I x V is always near zero. So you make the LEDs flash (too quickly to see) alternately fully bright and dark, and change the ratio of light period/dark period to give the illusion of gradual dimming. With such a design, the only limit on the transistor used would be maximum collector current. For the BD135, that limit is 1.5A!

The design is more complex, of course. Does this interest you enough to have me draw one up, test it and post it?

 

slackjack

Nov 2, 2005
177
Joined
Nov 2, 2005
Messages
177
The trick is to have that transistor permanently either fully on, or fully off, so that its I x V is always near zero.
So youre trying to minimize power dissipation. So now I must ask how would you choose whether to leave the transistor fully on or off?

The design is more complex, of course. Does this interest you enough to have me draw one up, test it and post it?
Yes, that would great.

 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
In the picture, the blue sawtooth waveform is generated by an oscillator. 1kHz should be fine. The red signal is a ramp generated when you press the switch. When the switch is released, the ramp would rise instead of fall. The green waveform is generated by comparing the blue and red - when the blue voltage is greater than the red voltage, we derive a high signal, and low at all other times. This resulting green square signal would be used to switch on and off the LEDs. As you can see, the lower the red ramp voltage, the longer the LEDs would be illuminated by the green pulse during each cycle. This is the principle of Pulse Width Modulation - PWM. In reality we would have the ramp rise and fall slowly, over hundrerds or thousands of sawtooth cycles, not just the 7 shown here.

View attachment 39400

 

Cabwood

May 31, 2006
86
Joined
May 31, 2006
Messages
86
Well, I've made the PWM version, and guess what - the apparent rate of brightening and dimming is very similar to the circuit I posted before, which makes me wonder - does the eye perceive brightness in the same way the ear perceives volume? If so the relationship would be non-linear (perhaps logarithmic, like the ear) - to achieve an apparent unit increase in brightness, I need to double the current. Something like that. Instead of a linear ramp, I'll need a log curve, rising slowly at first and getting faster. A capacitor charging has this behaviour, which is perfect for dimming, but for lighting up the curve must be initially slow-changing. Ideas anyone?

 
Top