Author Topic: Temperature independent constant current with fast transient response to PWM ?  (Read 2641 times)

0 Members and 1 Guest are viewing this topic.

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
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.  |O Thought posting on the forum as one last shot. Hoping someone might come up with a easy solution.

Thanks anyways.
« Last Edit: August 15, 2020, 05:10:10 am by Heisen »
 

Online Dabbot

  • Regular Contributor
  • *
  • Posts: 198
  • Country: au
Isn't electronics fun?  ;D

It's all about trade-offs, especially when you have a budget.

Question: Do the LEDs absolutely have to be driven by the PWM waveform?

Why not turn this circuit into a voltage controlled current source by RC filtering the PWM signal before the op-amp input. The current will still be set by that PWM signal and, by extension, the regulator powering your microcontroller.
 
The following users thanked this post: Heisen

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13218
The only problem with the first circuit is that the Vbe of Q1 falls with temperature.  The solution is simple - lift the emitter voltage of Q1 proportionally with temperature.   You only need one compensation voltage circuit for all 32 LED drivers.   To avoid interaction, between LED drivers, you'll probably want each to have a PNP emitter follower driving Q1 emitter, with its base fed by the shared compensation ciruit, which unfortunately adds a bit over a volt to the LED driver dropout voltage and increases the dissipation in R2, which must be increased to maintain the same target LED current.  Its easily possible to stabilise the current to better than 1% over a -25 deg C to +125 deg C temperature range.  See attached LTspice sim.
 
The following users thanked this post: Heisen

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Why not turn this circuit into a voltage controlled current source by RC filtering the PWM signal before the op-amp input. The current will still be set by that PWM signal and, by extension, the regulator powering your microcontroller.



I think that will add more delay. In the video you'll see this is what I am generating with pure PWM signals. These LEDs are not just turning on and off, they are dimming from high to low or vice versa. Hard to see in 60fps video. In reality it's more smoother.
« Last Edit: August 15, 2020, 08:31:58 am by Heisen »
 

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
The only problem with the first circuit is that the Vbe of Q1 falls with temperature.  The solution is simple - lift the emitter voltage of Q1 proportionally with temperature.   You only need one compensation voltage circuit for all 32 LED drivers.   To avoid interaction, between LED drivers, you'll probably want each to have a PNP emitter follower driving Q1 emitter, with its base fed by the shared compensation ciruit, which unfortunately adds a bit over a volt to the LED driver dropout voltage and increases the dissipation in R2, which must be increased to maintain the same target LED current.  Its easily possible to stabilise the current to better than 1% over a -25 deg C to +125 deg C temperature range.  See attached LTspice sim.
Ian.M

You did it. I have yet to understand how all this actually works, I'll get back to you. But for now in simulation it's working flawless. Can't believe this was that easy for someone else.

Ian.M for the win.  :-+

Thank you very much.
 

Online Dabbot

  • Regular Contributor
  • *
  • Posts: 198
  • Country: au
I think that will add more delay. In the video you'll see this is what I am generating with pure PWM signals. These LEDs are not just turning on and off, they are dimming from high to low or vice versa. Hard to see in 60fps video. In reality it's more smoother.

That comes down to your PWM frequency and RC selection. Not to worry though, as Ian.M has provided quite a handy solution.  :-+
 

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
That comes down to your PWM frequency and RC selection. Not to worry though, as Ian.M has provided quite a handy solution.  :-+

I guess you right Dabbot. Yeah about Ian.M. Dude came out of nowhere *drops mic* and gone. lol  :-DD
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13218
I'm not gone, 'cause I've got an even better version for you.  It eliminates the 32 individual PNPs driving Q1 emitters, at the expense of a single RRIO OPAMP in the compensator circuit.   Its also much more effective at stabilising the current as it can hold better than +/- 0.1% over -50 deg C to +150 deg C.  Its also easier to adjust for best results:  Trim the current by varying the voltage at OPAMP In+ [a] by adjusting the R3,R4 potential divider, taking care not to rail the OPAMP output [b] at minimum temperature.  Tweak R5 for best temperature compensation over full temperature range required.  Depending on your choice of OPAMP, C1 may need tweaking for stability - inject a pulsed 1uA current at [a] and look at the step response at [b].
 
The following users thanked this post: Heisen

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13218
Finally to gild the lilly, adding a silicon diode (or another diode connected transistor) in series with R7 (to improve the matching to Q2's Vbe drop) looks like it will improve it to better than +/- 0.01% over -50 deg C to +150 deg C. 

However I doubt that's anywhere near achievable in real life, even with an aluminum core sub-PCB with all of the Q1 transistors and the thermal compensation diode transistor Q5 on it, in a little foam thermal shielding box, to ensure they are as close as possible to the same temperature.  (Don't put the Q2 transistors on the thermal coupling sub-PCB - the massive and varying dissipation they introduce would be very unhelpful there!)
« Last Edit: August 15, 2020, 08:04:36 pm by Ian.M »
 
The following users thanked this post: Heisen

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Okay looks even more stable than before. But I have few questions for Mk2 version.

Earlier I would just change the value of sense resistor (R2) to set the current.

Correct me if I am wrong.

So now I would change R2 for setting current, R5 for temperature compensation, I saw how it effects minimum and maximum current over temperature range, but under what circumstances I would change R3 and R4 voltage divider? Which I see is currently set 1.8v.

Could you show how would you set up constant current let's say at 70mA and 300mA with .step temp list -40 150 (minimizing the constant current difference between the two temperatures), what values would you change? So that I can grasp the working.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13218
Coarse set the current by changing the sense resistor R2.  There's currently 12R and 1.8V across it so try 27R for nominally 66.6mA.  Fine trim the current to 70mA using the potential divider (+/-0.1V there is approx +/-5% ILED).  Uncomment the .op and fine temperature sweep and comment out the .tran and coarse temperature sweep to let you assess the effect of R5.  Hint: it helps to manually add a trace 150mA or whatever your desired LED current is to make it easier to see how close to the target it is.  It may well not even need changing.  In real life, you'd ball-park it in the sim, then set up a resistor substitution box to let you change R5 with the unit in a freezer, at room temperature and in a hot-box, so you could test several values without having to heat and cool the board each time.  Changing R5 also changes the current a bit, so once you've found the value that's most stable across the desired temperature range you'll need to tweak the divider to bring it back on target.
« Last Edit: August 15, 2020, 04:37:31 pm by Ian.M »
 
The following users thanked this post: Heisen

Offline HeisenTopic starter

  • Contributor
  • Posts: 42
  • Country: in
Finally, I got it. Works so good.
Thanks once again.
 
The following users thanked this post: Ian.M

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Hi,

What is the accuracy required here?

There is variation in light output from LED to LED even at the same current (even with binning).

There is variation in light output with the junction temperature of the LED.

A constant current with temperature may not be required or desired if you want to maintain constant LED brightness.

Regards,
Jay_Diddy_B
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1327
  • Country: gb
    • bitdynamics
Why do you actually need the LED current to be "square"?  What is the purpose of the LED array (in what you say is an automotive environment)?  If it is a "visual" array, ie it will be seen by the human eye, then you very much need to account for the response of the human eye to "brightness" which is both highly non linear but also acts as a low pass filter (our eyes effectively integrate photons).

So given that you'll need to tune "apparent brightness" to "duty cycle" why do you care what the profile of the current looks like?


(obvs if this is some form of LED array for data transmission, reflectometry, or similar then yes, you may well care about the exact current profile)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf