0

Logarithmic PWM dimming of LED drivers
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Logarithmic PWM dimming of LED drivers

by Systembolaget on Thu Jun 28, 2018 5:49 pm

Many constant current LED drivers allow PWM dimming.

When using a Metro Mini, is it better in terms of speed/memory to do this programmatically on the fly or by pre-computing an array?

Doing it programmatically would allow for a smooth "eye-perception-correct" dimming over any period of time, whereas a pre-computed array would result in perceivable discrete steps when drawn out over a few seconds - or am I wrong?

Thanks!

Systembolaget
 
Posts: 113
Joined: Wed Mar 08, 2017 1:01 pm

Re: Logarithmic PWM dimming of LED drivers

by adafruit_support_bill on Thu Jun 28, 2018 6:03 pm

Speed-wise, a lookup table is quickest. You can store that in Flash to conserve SRAM.

Either way you do it, you are restricted by the 8-bit resolution of the AnalogWrite() function. Dimming linearly, you get 256 discrete steps. Dimming logarithmically, you get some subset of that - depending on what log base you select.

One alternative is to dig into the timer configuration for your processor. But that has all sorts of other limitations and complications.

You may want to review this guide on the subject: https://learn.adafruit.com/led-tricks-g ... /the-issue

adafruit_support_bill
 
Posts: 70061
Joined: Sat Feb 07, 2009 10:11 am

Re: Logarithmic PWM dimming of LED drivers

by Systembolaget on Thu Jun 28, 2018 6:34 pm

Thanks!

Only 8 bit... uh! That won't look good at all indeed. Before I begin fiddling with timer configs - is there maybe a small external IC breakout board I can attach to the Metro Mini that would provide, say, 12 bit PWM resolution?

Just found your PWM breakout board; could I use that between the Metro Mini and PWM pin of LED drivers, although I only need one of its many channels?

Systembolaget
 
Posts: 113
Joined: Wed Mar 08, 2017 1:01 pm

Re: Logarithmic PWM dimming of LED drivers

by adafruit_support_bill on Thu Jun 28, 2018 6:58 pm

You could use the 12-bit PCA9685 boards you found.

We also have the tlc59XX breakouts with as much as 16 bits of PWM resolution. https://learn.adafruit.com/tlc5947-tlc5 ... t?view=all

adafruit_support_bill
 
Posts: 70061
Joined: Sat Feb 07, 2009 10:11 am

Re: Logarithmic PWM dimming of LED drivers

by Systembolaget on Thu Jun 28, 2018 7:12 pm

I see... but the TLC59711 cannot be used as a "dumb" high-resolution PWM provider like the board I linked to in the previous comment? High power LEDs from Citizen, Bridgelux, Nichia or Lumileds usually require 32 - 35V DC at 120 - 360mA and thus a buck/boost driver like this one, for example.

Systembolaget
 
Posts: 113
Joined: Wed Mar 08, 2017 1:01 pm

Re: Logarithmic PWM dimming of LED drivers

by adafruit_support_bill on Thu Jun 28, 2018 8:35 pm

The TLS59xx boards are constant-current outputs designed for driving low-power LEDs directly. If you are using the PWM output as input to a high-power driver, the PCA9685 boards are a better choice.

adafruit_support_bill
 
Posts: 70061
Joined: Sat Feb 07, 2009 10:11 am

Re: Logarithmic PWM dimming of LED drivers

by Systembolaget on Fri Jun 29, 2018 1:33 am

Alright, thanks!

Systembolaget
 
Posts: 113
Joined: Wed Mar 08, 2017 1:01 pm

Please be positive and constructive with your questions and comments.