PWM resolution and tiny On-Time for 8-Bit LED-Dimming - Page 1
Forum section: electronics / projects

author: jusaca
author_rank: Unknown
timestamp: March 30, 2025, 12:31:42 pm
content: I was just doing some rough estimations for implementing a PWM-Controller for an RGBW-LED strip. To be honest, I was quite shocked that I completely underestimated the requirements for fast switching.I want to be able to have at least 8-Bit color mixing. Primarily to mix in small amount of RGB into the white, to shift the white-point to a warmer or colder tone.And if I want to be able to keep the color-tone constant while also reducing absolute brightness, the resolution for the colors shouldn't be to small. So I set the min. requirement for me kind of randomly to 8 Bit, but even these 8 Bit are not really great when I run the LEDs with a small overall brightness.But in that case the minimum On-Time (and due to that the needed switching speed) needs to be astonishingly fast! If I use a PWM frequency of 500 Hz (which seems really rather slow for flicker-free lightning purposes) the On-Time for the smallest step (1/255 = 0,4% brightness) with a gamma correction factor of 2.2 results in only 0,0005% Duty Cycle or 10ns! And that with only 500 Hz PWM. If I increase this to 1 kHz PWM I would need a minimum On-Time of 5 ns.These seem to be pretty harsh switching requirements to me. If I implement it like this and run LED-strips over 2m or maybe 3m with a decent current, the EMI will probably be quite tough, won't it?Are there any more intelligent ways to implement this which would reduce the need for such fast switching? Or is it unreasonable to implement high-resolution brightness/color control with PWM alone?

author: incf
author_rank: Frequent Contributor
timestamp: March 30, 2025, 01:03:43 pm
content: constant current drive?wouldn't be hard to add an inductor, a flyback diode, and a shunt resistor.

author: spostma
author_rank: Regular Contributor
timestamp: March 30, 2025, 01:06:14 pm
content: RGB LEDs usually have a poor light spectrum, so making a well-defined white tint is almost impossible,regardless of PWM resolution.I would suggest to use either RGBW or RGBWW LEDs to control the color temperature (tone) more precisely.The RGBWW types have both warm-white and cool-white LEDs.The broader light spectrum also will yield a higher color rendering index (CRI).https://store.yujiintl.com/products/cri-max-cri-95-5-in-1-rgbww-full-gamut-led-flexible-strip

author: jusaca
author_rank: Unknown
timestamp: March 30, 2025, 01:25:07 pm
content: Quote from: incf on March 30, 2025, 01:03:43 pmUnfortunately basically all LED stripes are constant voltage. This makes sense, because there are a variable amount of parallel segments, but this makes the use of a CC drive not really possible.Quote from: spostma on March 30, 2025, 01:06:14 pmThanks for the tip, but I already use RGBW. I want to use 3000K white and shift the white point to either colder or warmer with the RGB. Because the white already starts with CRI > 95, I should be fine with adding small-spectrum colors (see attachment with the white-point measurements of the manufacturer).

author: incf
author_rank: Frequent Contributor
timestamp: March 30, 2025, 01:44:42 pm
content: Quote from: jusaca on March 30, 2025, 01:25:07 pmYou are already doing open-loop current regulation using PWM, smoothing out the rising/falling edges with an inductive element isn't outside the realm of feasibility. Nor is going to some sort of software controlled closed loop drive scheme.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: March 31, 2025, 01:09:59 am
content: Quote from: jusaca on March 30, 2025, 12:31:42 pmModern LED drivers I've looked at use a combination of linear current DAC drive, and PWM.Higher resolution PWM really only means finer edge control the number of edges does not change.500Hz is 1000 edges / second but you can move those edges to 10ns granularity.Note that you are asking for almost 18 bits of precision, but 16b PWM is much more common, so more practical might be an 8-10b DAC coupled with 16b PWM.Slowing down the switching edges also helps, and you do lose resolution, but only at the extreme limits.ie a 500ns rise time, can still modulate in 10ns steps, but at very close to 0% and 100% the threshold & slew affect the actual effective setting.To keep the EMI manageable, you can also locally drive the LEDs eg using tiny MCUs and some drivers stagger the edges, so that all LEDs do not switch at once.That eases the inductive effects.

author: mtwieg
author_rank: Frequent Contributor
timestamp: March 31, 2025, 11:18:58 am
content: Quote from: jusaca on March 30, 2025, 12:31:42 pmYeah getting 8 bits of photometric output (i.e. lumens or candelas) is way harder than 8 bits of radiometric output (i.e. amps or watts).Even if you have a way of generating pwm with 5ns precision, you'll have a hard time making a current source which can be switched so fast with good linearity.At some point I suspect the LED itself will become a source of nonlinearity (i.e. ratiometric output not scaling with average current for very narrow pulses).QuoteIn theory, adding a very large lowpass filter between the LED and driver might allow you to reduce the PWM frequency while avoiding flicker, but this is somewhat impractical.Best practice is to combine PWM with another method of modulation (something that changes the amplitude of the output current as well as the duty cycle). For example, you could have two current switched current sources, one set to 1/32 the current of the other. By muxing the PWM to either of them, you gain five bits of radiometric resolution.

author: Kasper
author_rank: Frequent Contributor
timestamp: March 31, 2025, 02:52:25 pm
content: Quote from: PCB.Wiz on March 31, 2025, 01:09:59 amThat's sounds more pleasant on the eyes. Do many products do that?

author: jusaca
author_rank: Unknown
timestamp: April 02, 2025, 11:13:42 am
content: Quote from: PCB.Wiz on March 31, 2025, 01:09:59 amHow do you arrive at 18 Bit PWM precision? 8 Bit for color + a few bits for brightness might be enough already.But the consens seems clear to me, some form of additional current limiting might be necessary. To bad, I hoped I would get away without to much component overhead or lossy linear current regulation.I will look into some form of control to minimize the losses in the linear part of the regulation by using as much dimming wiht PWM as possible and only use the linear part in cases where loss of resolution would ne to high otherwise

author: inse
author_rank: Super Contributor
timestamp: April 02, 2025, 11:25:08 am
content: Because you delivered the figures, and 10ns in 500Hz is 1/200000.And 18Bit is 262144

author: jusaca
author_rank: Unknown
timestamp: April 02, 2025, 11:31:22 am
content: Oh you are absolutely right.

author: mtwieg
author_rank: Frequent Contributor
timestamp: April 02, 2025, 07:18:29 pm
content: Quote from: jusaca on April 02, 2025, 11:13:42 amAlso 8*2.2 = 17.6

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 02, 2025, 07:42:14 pm
content: Quote from: jusaca on April 02, 2025, 11:13:42 amParts like 12Ch Nexperia NEX13120 have low dropout linear LED sourcing drivers with a combination of current DAC and PWM.The low dropout means you can pre-regulate a LED supply to minimize overall power loss.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 02, 2025, 10:36:05 pm
content: In any case, note how much the exact gamma correction affects the minimum pulse duration:$$\left(\frac{1}{255}\right)^{2.2} \approx \frac{1}{196965}$$but$$\left(\frac{1}{255}\right)^{2.0} \approx \frac{1}{65025}$$and$$\left(\frac{1}{255}\right)^{1.8} \approx \frac{1}{21467}$$These are all commonly used gamma correction values that I personally would happily accept from a human-controlled lighting device or backlight.The easiest of these is obviously \$\gamma = 2.0\$, because \$x = 0 \dots 255\$ yields \$x^2 = 0 \dots 65025\$, so you can use a PWM period of 65026 cycles for the intensity adjustment. To avoid audible noise, you'd use 30kHz or higher PWM frequency, which corresponds to a PWM clock of 2 MHz or higher, with minimum on-state duration below 0.5µs = 500ns.I definitely like the idea of using an analog potentiometer to set the maximum/PWM current, and having a MCU or other thingy adjust the relative intensity only. You'll still want to gamma compensate both, but they don't need to be the same; anything between \$\gamma =1.8\$ and \$\gamma = 3\$ seems to feel "natural" to me.Regarding constant current LED drivers:I use small display modules with white LEDs in parallel, so forward voltage in the 2.8V – 3.4V region, and current draw in the 70mA – 120mA range. I recently discoveredTI TPS92201A, synchronous buck-type LED driver for parallel (white) LEDs at up to 1.5A of current (note maximum input voltage is 5.5V, so no series LEDs!), running at 1.5 MHz switching frequency, and supporting PWM dimming at up to 200 kHz. For my low current needs, the TPS92201A switches to pulse frequency modulation (PFM) at light loads. They're also silly cheap atMouser. I haven't used these yet, but Ireallylike the idea of adjusting the maximum current draw using a potentiometer (as the current-limiting resistor), i.e. the maximum brightness, and my MCU only adjusting therelativebacklight brightness.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 04, 2025, 09:05:24 am
content: The OP has not given the I-V needed for their RGBW LEDs but these just popped up on TI's websitehttps://www.ti.com/product/LP58164 channel 8-bit current DACs 0.1mA or 0.2mA steps for LEDs 10c/1k, with inbuilt PWM mode as well.Looks to have reasonable match/dropout, tho only 5v5 tolerant. i2c, but no mention of how to change address ?

author: jusaca
author_rank: Unknown
timestamp: April 04, 2025, 05:54:01 pm
content: Quote from: PCB.Wiz on April 04, 2025, 09:05:24 amThe IC has a fixed address (0x2C, p. 17).Thanks for the suggestion, interesting IC, but I probably will have to build something by my own, as I don't want to drive single LEDs but strings of variable length.This is the LED-strip I currently have here for some tests of color quality:https://shop.led-studien.de/led-streifen-sets/led-streifen-farbe/rgb-ww-fuer-raumbeleuchtung-helles-weiss-60-60-leds-m/lk04-6o-masThey run with 24V and have the following current ratings:White: ~ 500 mA/mRed: ~ 100 mA/mGreen: ~ 160 mA/mBlue: ~ 160 mA/mI intend to make the driver compatible with variable strip lengths, so I can use it with 0,5m, 1m and 2m pieces.Again, I would prefer to avoid linear current control as much as possible (efficiency + shift of color point with different current values). But I will see how great that works

author: tooki
author_rank: Super Contributor
timestamp: April 04, 2025, 07:37:16 pm
content: Try using a PCA9634 driver with external switching MOSFETs. It has lovely 97kHz 8-bit PWM. I've used it in a few projects and it's great.There are related chips in NXP's portfolio with 16-bit PWM, but at much lower frequencies. See:https://www.nxp.com/docs/en/brochure/LED-DRIVER-SELECTOR-GUIDE.pdf