Smooth LED fading via PWM


Closed Thread
Results 1 to 40 of 55

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,617


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Ah, I misunderstood - again...
    Yes, more resoultion might help but I honestly think the problem is the lack of current limiting resistors. Can you just give it a try, something lowish like 47ohms or so.

    /Henrik.

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Hi Henrik,

    As you can see, the board I'm working on a pcb I knocked up ....so a bit of hacking involved, but I'll give your suggestion a go tomorrow....I've just tried 9 bit PWM which was better but a duty value of 1 is still too visible.

    To my other question - does anyone know how to turn 512 linear values into log values (so I can put them in a LUT)

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Hank, how fast is the "1" pulse hitting the LED? think of it this way, what is the duration of that single pulse? at what value does the LED max out to the eye? I don't think the issue is number of steps, but rather the duration of the step.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Hi Bert,

    I'm using a HPWM frequency of 31.25KHZ (8Mhz clock & HPWM PR2 value of 63), so I'm figuring a duty value of 1 should only result in a pulse width of approx 125ns ?

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,166


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    1. Bright LEDs light even with nA current. I had a 5 meter LED stripe that some of the LEDs were ON while not connected to any power source!!! (Yeah, from static charge).

    2. LEDs are not like lamps, so you cannot control them by a simple PWM idea. LEDs are current dependant devices so, you have to control them by current source and NOT by voltage as you do now.

    My suggestion is not to bother with more resolution an try to control, by PWM, the current of the LEDs. Then you will have the exact same effect like simple filament lamps.

    Ioannis

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Quote Originally Posted by Ioannis View Post
    1. Bright LEDs light even with nA current. I had a 5 meter LED stripe that some of the LEDs were ON while not connected to any power source!!! (Yeah, from static charge).
    I reckon this is the issue here....high brightness leds, with a lens that intensifies even the smallest amount of light = looks too 'on' even when almost off!

    Quote Originally Posted by Ioannis View Post
    LEDs are not like lamps, so you cannot control them by a simple PWM idea. LEDs are current dependant devices so, you have to control them by current source and NOT by voltage as you do now.
    Yeah, I know led's are current driven devices, but what gives...if the rated forward voltage is say 3.4V, but I run them at 3.1V regulated (because they yield sufficient brightness even at that voltage level)..then PWM principles ought to work fine (in fact, PWM does work just fine without the resistor...I'm running it here now!)....& there's always the internal series resistance of the PIC OP pin (5 ohms? not a lot, but resistance nevertheless)

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,166


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    For this specifically LED it might work and as long as the voltage is absolutely stable.

    But I insist on using a current source. You will be able to control the brightness for a really 0 to 100%.

    Even for a test it is interesting.

    I have a client that for more than a year is refering to his power (chinese) LEDs as 24Volts... And I reply with the current of your LEDs is....

    Ioannis

  8. #8
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Quote Originally Posted by Ioannis View Post
    1. Bright LEDs light even with nA current. I had a 5 meter LED stripe that some of the LEDs were ON while not connected to any power source!!! (Yeah, from static charge).
    Static charge is by nature static and won't power LEDs. Do you have a wireless router? There is a known issue with early LED Christmas lights illuminating by acting as rectifying antennae. I have a set - turn off my wireless router and they extinguish. Of course, you might live next door to a ham operator as well... but walking across the carpet won't do it.

  9. #9
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Counting from 0 to 255, with the LED on from 0 to 1 then off from 1 to 255 should work nicely, and extending to 512 should make it dimmer yet, I agree. I'd use resistors, but what you are doing "should" work too. The only part of what you are doing that is different from what I've seen work in the past is having the fundamental of the cycle at 32 KHz. It might work, but I've had issues in the past trying to switch LEDs too fast - you might want to drop that down to a couple hundred Hz. But like most of the suggestions, this is only a guess.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts