Hello Everyone,
I am designing a LED driver. My board consists of one microcontroller which gives 32 individual PWM signals independent of each other. Each PWM signal drives a channel. So making my board
32 channel LED driver. Each PWM signal not only varies by duty cycle but also by frequency. The maximum frequency at one point comes to about 3kHz. Each channel will drive a bunch of LEDs in series.
So these LED channels getting individual PWM signals, turning the load on and off, I want to limit the current while they are in
ON state. So each channel will be configured in
constant current.
I need all LED channels to have a common VCC, which makes the system constant current sink. I went with linear constant current not switching type. I can deal with heat and want less parts also but most importantly,
I want quick transient response of current waveform matching with the pwm signal. So while the PWM signal is low the channel is off but when the pwm signal is high the channel is in constant current mode. Just like the response you get when you PWM a LED directly from a microcontroller GPIO with current limiting resistor.
So that makes it a constant current with PWM combination for each channel. I am using the below mentioned Dual NPN general constant current circuit for each
PWM Channel.

Observe the (Red) PWM signal (which is at 3kHz frequency at 50% duty cycle) and (Green) current waveform response to that.
Let's see at 99% duty cycle.
Zooming in on the 1% off time. Looks like this.
Everything seems to be working fine at this point except that this circuit is
temperature dependent, due to vbe of Q1 being temperature sensitive. Current changes through the LEDs due to temperature change, which is a problem for me. I am trying to push this thing to be workable in automotive enviornment.
To overcome this problem I went with another general circuit which does the same thing but with an op amp and a transistor. Here is what it looks like.

As this circuit ensures change in temperature will not affect the constant current through the LEDs but with a trade off of
delayed transient response. Let's observe that.
3kHz frequency at 50% duty cycle. (Red) PWM signal. (Green) Current waveform.
Let's see at 99% duty cycle, which makes it worse.
Zooming in on the 1% off time. The transient response looks like this.
As you can see the current waveform can't keep up with the PWM signal. This might be due to the slower slew rate of the op amp. So the solution to overcome this might be a faster op amp, which are expensive considering I have to use 32 of them.

I was looking for a solution to this problem which uses jellybean parts. General components. No matter what circuit I find and try
I loose either the fast transient response or temperature independence. Can't have both at the same time with low overall cost, due to circuit being replicated 32 times. One for each channel.
I already gave up trying to make this work.

Thought posting on the forum as one last shot. Hoping someone might come up with a easy solution.
Thanks anyways.