Pulse Width Modulation for Dimming LEDs

Bulldozer2003

Member
May 12, 2002
93
0
0
I'd like to start using pulse width modulation on an LED lighting system (google "led bed", first hit) but am worried about getting fully-dim to fully-lit operation. Is it possible to use pulse width modulation to dim an LED to an almost off state without noticing flicker? Would I need some sort of high/low pass filter to even out the pulses?

As I understand it, you set PWM to a certain frequency then tell the chip to provide high 3/4, 1/2, 1/4, or 1/16 of the time, to small and you'll see the LED switching on and off below 30Hz or so.

Basically, will a high or low pass filter average out the voltage below a certain frequency?
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
If you're so worried about flicker, why not run it at a higher cycle rate? You can still use pulse width modulation to adjust the duty cycle, but just clock it faster.
 

PottedMeat

Lifer
Apr 17, 2002
12,363
475
126
a low pass filter following your PWM output should average the voltage depending on the PWM period, basically the higher the duty cycle, the closer the output voltage after the filter will be to its max value.

i dont know the threshold for a human eye seeing flicker, id suggest you just try it out with maybe a dual 555 circuit and an LED. Mess with the duty cycle and frequency until you're comfortable with the results. 555's are cheap, can handle up to 1MHz outputs, and operate i believe from 3.3 to 12V.
 

blahblah99

Platinum Member
Oct 10, 2000
2,689
0
0
You can see flickering of any light when it's switching at about 16 times per second... try it.
 

skene

Member
Oct 15, 2004
58
0
0
It's higher then that. You can notice it at around 50Hz and below in your peripheral vision. It's harder to notice if you look right at it though (not something I recomend with bright lights btw)
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Originally posted by: PottedMeat
a low pass filter following your PWM output should average the voltage depending on the PWM period, basically the higher the duty cycle, the closer the output voltage after the filter will be to its max value.

i dont know the threshold for a human eye seeing flicker, id suggest you just try it out with maybe a dual 555 circuit and an LED. Mess with the duty cycle and frequency until you're comfortable with the results. 555's are cheap, can handle up to 1MHz outputs, and operate i believe from 3.3 to 12V.

There is a fundamental problem with using a low pass filters. Here's some numbers so you can see it better. Assume you're using a 1V source and a 0.7V diode. Let's say you're aiming for a 10% of maximum brightness so you implement PWM w/ a 10% duty cycle.

When driven directly to the LED, yes, it will be on 10% of the time excluding the time it needs to turn on and off.

If you drive it through a low pass filter, the output voltage will be roughly 0.1V meaning the LED will remain OFF.

You don't want to average your PWM outputs.
 

harrkev

Senior member
May 10, 2004
659
0
71
Just do PWM, and try to get the frequency at 80Hz or greater, and you will be good to go. This is, in fact, done quite often. Been there, done that.
 

cerebusPu

Diamond Member
May 27, 2000
4,008
0
0
what you are talkign about is fixign the PWM duty cycle to 50% and changing the rate of pwm to change the brightness. what happens is at low rates (brightness) you'll see flicker.

what you can do is fixing the rate of pwm (high rate) and changing the duty cycle of the pwm.

hard to describe duty cycle without a drawing.
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Originally posted by: cerebusPu
what you are talkign about is fixign the PWM duty cycle to 50% and changing the rate of pwm to change the brightness. what happens is at low rates (brightness) you'll see flicker.

what you can do is fixing the rate of pwm (high rate) and changing the duty cycle of the pwm.

hard to describe duty cycle without a drawing.

ahhh... I was wondering why he was talking about flickering in the first point.
 

Bassyhead

Diamond Member
Nov 19, 2001
4,545
0
0
Originally posted by: imgod2u
or you could just use a variable resistor

A variable resistor would not work well. Even if one with a suitable current rating was used, realize that LED light output is not linear to the current used. The purpose of OP wanting to drive the LEDs with PWM is to allow the LEDs run at the highest voltage and current rated, and by regulating the brightness by changing the percentage of time the LED is switched off and doing so rapidly, giving the human illusion that the LED is merely dimmer because of our visual persistence characteristics.
 

FrankSchwab

Senior member
Nov 8, 2002
218
0
0
Yes, you can use PWM to dim an LED.

Create a signal such that a high voltage drives approximately 20 ma through the LED. This can be done by using a 5V signal with a dropping resistor; or, for some types of LEDs (e.g. white LEDs) a 3.3V signal can generally be connected directly. Change the high time of the signal and you should get a linear dimming, i.e. a 50% duty cycle should give 50% brightness, a 10% duty cycle 10% brightness. Your eye isn't linear, so it won't appear that way, but it should work pretty well.

You'll have to be real careful with commercial PWM chips; they don't create the output signal that you might think. An RC-type servo signal set at 50% is nowhere near a 50% duty cycle.

A second option uses a linear current regulator; see This PDF.
Page 17 at the bottom shows a circuit for a "Precision Current Limiter" which would allow you to set the current running through the LED with a potentiometer, which provides a fairly linear dimming method. The LM317 hooked up as a Current Regulator adjusts the output voltage to maintain a specific current, which is precisely what you need to control LEDs. Several advantages of this are:
1. LM317's are cheap.
2. They're capable of driving over an amp of current - that's about 50 LEDs in parallel.
3. They're capable of dealing with up to around 35V - that's about 10 led's (or strings of paralleled LEDs) in series. I'd have to run the numbers, but you might be able to run as many as 500 LEDs with one!

They can get quite hot if you're pulling a lot of current through them, or if there's a large voltage drop across them, so attach them to a heatsink in those cases.

Two LM317 posts in two days; I feel like a hardware engineer.

/frank
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
PWM is the recommended way to dim LEDs. It provides the best energy efficiency, and avoids the problems of unpredictable colour/brightness shifts that can occur if you run the LEDs at low (constant) current. You shouldn't smooth the ouptut, for the above reason.

Whether you will notice flicker depends on how the LEDs are used. If you cannot see the LEDs themselves only a diffused light on a wall, or ceiling - then you won't notice flicker until the PWM frequency starts to approach the integration time of your eyes (80-100 Hz should not have any visible flicker).

If you can see the LEDs directly, especially if the LEDs, or observer will be moving, then flicker becomes more obvious - because as the LEDs move through the observer's field of vision the LEDs will leave a broken trail.

I built a PWM controlled LED lighting system using very high power LEDs (luxeon LEDs), and using an 8 bit microprocessor to control the PWM I was able to get about 2 kHz with 8 bit resolution. This gave essentially no flicker under any circumstances, and a minimum power of 0.4% - just visible if you view the LED directly - essentially unnoticable with indirect illumination. An article about an old version here: Link