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,604


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    So why not turn it off (0% dutycyle) when you want it to be off? Why do want to drive current thru it and NOT have it light up at all?

  2. #2
    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 HenrikOlsson View Post
    So why not turn it off (0% dutycyle) when you want it to be off? Why do want to drive current thru it and NOT have it light up at all?
    Because I seek a smooth fade from max brightness through completely off.

    What I'm observing is that a duty cycle of 1 seems too discernibly 'on' still (I'd have thought you'd have to get up real close to it at such a duty cycle to see if it is on or not?), the 'jump between 0 & 1 from a brightness perspective, whilst small, is still too big which is why I'm thinking more resolution may help?

    (before you think why don't I just try it myself ...well, firstly I want to ask others if when using 256 steps of pwm, whether a duty value of 1 normally easily visibly shows the LED to be on.....and secondly, I've got to wrap my head around 10 bit HPWM bit mapping - the pesky registers are spread a little).
    Last edited by HankMcSpank; - 4th September 2011 at 18:40.

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Smooth LED fading via PWM

    Just to give you a flavour, this is a duty setting of 1...



    Now LED3 & LED6 happen to be faulty (I can't be bothered to swap them out right now - they're way duller than others and clearly have an issue), but I reckon with a duty cycle value of 1 the led brightness should actually be more their level!

    Now LEDS are notoriously difficult to photograph...the LEDS don't actually as bright as they do in the photo 'in the flesh', and these being high brightness have a lens that accutely magnifies any LED light but nevertheless I think they're too bright for a duty value of 1!
    Last edited by HankMcSpank; - 4th September 2011 at 19:12.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    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.

  5. #5
    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)

  6. #6
    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!

  7. #7
    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 ?

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