Pages: [1] 2 3   Go Down
Author Topic: "Fooling" constant-current control loops in LED driving?  (Read 6501 times)
0 Members and 1 Guest are viewing this topic.
Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear all,

Has someone tried to drive LEDs by switching the output of a constant-current supply (like a lab power supply or a constant-current LED driver) with the PWM from Arduino? I tried to switch the current from a benchtop lab power supply with the Sparkfun MOSFET Power Control Kit (https://www.sparkfun.com/products/10256), and clearly the constant-current mode did not like it and the output current did not stay stable.

I understand that the LED driving scheme could be designed from a scratch or simply use commercial LED drivers such as BuckPuck (http://www.ledsupply.com/buckpuck.php), XP Power (http://www.xppower.com/productSelection.php?groupid=100019&lang=EN) or Allegro (http://www.allegromicro.com/Products/Regulators-And-Lighting/LED-Drivers-For-Lighting/A6211.aspx) that allow dimming using a PWM dimming. However I would like to increase the dimming range by adding the switching stage in cascade with the already existing constant-current supply, and at some point modulate the constant current for sinusoidal output with the PWM.

I thought of doing a "brute force" non-elegant tryout circuit with NPN and PNP transistors so that the HIGH signal of PWM would switch on the NPN and turn on the light and during the LOW signal of PWM the PNP is turned on and the constant current can go through it so that the sum current is always the same independent of the duty cycle. I failed to find any example circuits really for such an idea so I was hoping that maybe some forum reader could help? Could LED be driven efficiently with Dual npn-pnp complementary bipolar transistors? Or are there more elegant solutions?

Thanks
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Sparkfun MOSFET Power Control Kit (https://www.sparkfun.com/products/10256), and clearly the constant-current mode did not like it and the output current did not stay stable.

You do realize that that particular kit is not a constant current driver, right? However, if you add a small npn + a resistor to it, you can easily make it into a constant current drive.

Alternatively, you can find a switching mode power supply and pwm its on/shutdown pin to pwm dim the leds.
Logged

Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You do realize that that particular kit is not a constant current driver, right? However, if you add a small npn + a resistor to it, you can easily make it into a constant current drive.

Yes I realized that it was not a constant-current driver but had that available and thought of trying it with the benchtop power supply (ISO-TECH DC Power Supply IPS 3303S, http://radionics.rs-online.com/web/p/bench-power-supplies/6842998/). Do you think there is a more elegant way to switch the output from constant current supply such as those from benchtop lab power supply or from commercial LED drivers

[edit] The basic circuit that I know just sets up the current with the R3 resistor (http://www.instructables.com/id/Power-LED-s---simplest-light-with-constant-current/step2/Specs-Function/) but as I would already have the constant current source, I would like to tinker the circuit so that I could add the switching stage.
« Last Edit: October 18, 2012, 05:38:06 pm by petteri_t » Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am not sure what you are trying to do , but you could drive a simple constant current driver with the pwm to vary the brightness while limiting the max current to 20mA
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am not sure what you are trying to do , but you could drive a simple constant current driver with the pwm to vary the brightness while limiting the max current to 20mA

Basically I just to want to increase the dynamic range of the light intensity. So if I would for example have a constant current supply (DC output) with 16-bit resolution, I could then the switch off then that output with 8/10-bit PWM of Arduino Uno or 16-bit PWM from Digilent Uno32 for example so I would in theory have 32-bit resolution for light intensity. So with that design idea I could replace independently the constant current and switching parts if better components become available. And my max current to be switched is at the moment 1 A.

So in other words the current sensing part of the constant current source would not probably in general like that the output current is switched ON and OFF and I was looking for ways to make the feedback loop to think that the current output from the constant current source is always the same even though the current passing through would not be the same, i.e. it would be determined by the PWM duty cycle outputted from Arduino. And when the PWM would be LOW the current would go through the PNP-transistor.
« Last Edit: October 18, 2012, 06:48:58 pm by petteri_t » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
with 16-bit resolution, ...
have 32-bit resolution for light intensity.

A couple of questions:

1) What kind of eyes do you have that require that kind of resolution?

2) What kind of computing power is required for that kind of resolution?
Logged

Offline Offline
Edison Member
*
Karma: 32
Posts: 1286
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Uh...  Yeah.... Dynamic range is the difference between full-bright and fully-dark.   You can't get any more dark than "off", so you can only go brighter ...  and you can't (or shouldn't) go over the device's maximum current rating on the bright-end.

16-bits (converted to decimal) gives you a range from 0 to 65,535.     I'm sure you can't tell the brightness-difference difference between 0 and 1, between 65,534 and 65,535, or between 30,000 and 30,001, etc.!   
Logged

Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
with 16-bit resolution, ...
have 32-bit resolution for light intensity.

A couple of questions:

1) What kind of eyes do you have that require that kind of resolution?
2) What kind of computing power is required for that kind of resolution?


1) 32-bit resolution would give me 4.29 x 10^9 levels, thus around 9.6 log levels of light intensity which would be little less than normal ambient light levels experienced by humans [1]. So when designing a visual stimulator like that one for example in optimal case you would like to have the whole ambient light level intensity under electronic control and not having to play with neutral density filters for example. For example, using the same system when the subject is light-adapted and after full dark adaptation when retinal sensitivity is significantly increased [2].

[edit] So if you would only want a normal operating range of 256 intensity levels (8-bit) your retinal sensitivity would have increased around 4 log units during full dark adaptation (~45 minutes in full darkness, http://webvision.med.utah.edu/book/part-viii-gabac-receptors/light-and-dark-adaptation/) then it would not be possible at all to have the same operating range of 256 intensity levels in this new condition without using attenuating filters such as normal neutral density (ND) filters. That is why the high dynamic range was desired initially.

So the work by Demontis et al. [3] for example gave ~4.5 log units of resolution which is kinda nice for most of the applications, but if you would start modulating the output with a sinusoidal or other waveform envelope [e.g. 4], a little leeway could be nice.

[1] Fain, G L, H R Matthews, M C Cornwall, and Y Koutalos. “Adaptation in Vertebrate Photoreceptors.” Physiological Reviews 81, no. 1 (January 2001): 117–151. http://www.ncbi.nlm.nih.gov/pubmed/11152756.

[2] Lamb, T. D., and E. N. Pugh. “Dark Adaptation and the Retinoid Cycle of Vision.” Progress in Retinal and Eye Research 23, no. 3 (May 2004): 307–380. http://dx.doi.org/10.1016/j.preteyeres.2004.03.001.

[3] Demontis, Gian Carlo, Andrea Sbrana, Claudia Gargini, and Luigi Cervetto. “A Simple and Inexpensive Light Source for Research in Visual Neuroscience.” Journal of Neuroscience Methods 146, no. 1 (July 15, 2005): 13–21. http://dx.doi.org/10.1016/j.jneumeth.2005.01.007.

[4] Gooley, Joshua J., Ivan Ho Mien, Melissa A. St Hilaire, Sing-Chen Yeo, Eric Chern-Pin Chua, Eliza van Reen, Catherine J. Hanley, Joseph T. Hull, Charles A. Czeisler, and Steven W. Lockley. “Melanopsin and Rod–Cone Photoreceptors Play Different Roles in Mediating Pupillary Light Responses During Exposure to Continuous Light in Humans.” The Journal of Neuroscience 32, no. 41 (October 10, 2012): 14242–14253. http://dx.doi.org/10.1523/JNEUROSCI.1321-12.2012.


2) Computing power meaning what exactly in this context? I could control a LED driver with DMX input and DC output with 16-bit resolution using a DMX shield and then switch that with a Uno32's 16-bit PWM for example so not very special hardware would be required

Uh...  Yeah.... Dynamic range is the difference between full-bright and fully-dark.   You can't get any more dark than "off", so you can only go brighter ...  and you can't (or shouldn't) go over the device's maximum current rating on the bright-end.

16-bits (converted to decimal) gives you a range from 0 to 65,535.     I'm sure you can't tell the brightness-difference difference between 0 and 1, between 65,534 and 65,535, or between 30,000 and 30,001, etc.!  

So maybe I was not specific-enough about the application so it would be for a generic-purpose visual stimulator to be used in vision research. So I agree that in general the difference that you mentioned would not be of a huge aesthetic difference but especially if you start using the system with other species than humans, the same logic might not apply anymore.
« Last Edit: October 18, 2012, 06:47:59 pm by petteri_t » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so not very special hardware would be required

You probably want your pwm sessions to end fairly quickly. Say 50hz, or 20ms.

Each tick of a 32-bit pwm train would be then 20ms / 2^32 = 5e-6 us. or about 200Ghz.

Good luck with that.
Logged

Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so not very special hardware would be required

You probably want your pwm sessions to end fairly quickly. Say 50hz, or 20ms.

Each tick of a 32-bit pwm train would be then 20ms / 2^32 = 5e-6 us. or about 200Ghz.

Good luck with that.


I think the 80 MHz clock signal provided by the 32-bit timers of Uno32 (http://chipkit.org/forum/viewtopic.php?f=6&t=988&start=0) should be enough for my purposes at this point. So the duty cycle resolution does not have to be necessarily 32-bit and I can compromise duty cycle resolution for temporal resolution and vice versa.

So I was thinking of combining 16 bit for constant current control and then another 8-16 bits for PWM duty cycle resolution to increase the already 16-bit resolution of the DC (unswitched current). So I did not really get the requirement for a 200 GHz frequency?

[edit] So if I did not quite misunderstood the PIC32 tutorial there: http://hades.mech.northwestern.edu/index.php/PIC32MX:_PWM_Motor_Control with 80 MHz you can have a PWM frequency of 20 kHz with 4000 duty cycle steps?

Code:
// init Timer2 mode and period (PR2) (frequency of 1 / 20 kHz = (3999 + 1) / 80MHz * 1
OpenTimer2( T2_ON | T2_PS_1_1 | T2_SOURCE_INT, MAX_DUTY);
« Last Edit: October 18, 2012, 06:55:51 pm by petteri_t » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
4000 duty cycle steps

That's about 12 bits, on a 80Mhz mcu.

From there, it goes up exponentially.

If I were you, I would try to understand what you are trying to do, and what can be done realistically and decide where to compromise.
Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I got lost with the numbers, but what about having one pwm output from the arduino, switching a MOSFET as a normal switch mode with inductor and filter to feed to the LEDs a variable DC, and then another pwm pin to the drivers for the normal duty cycle brightness?

Should give you 255 x 255 levels of brightness ( OK perhaps not 255 as you would have to play with the variable DC not going below the min V of the LEDs, and that side wouldn't be linear brightness wise)
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
4000 duty cycle steps

That's about 12 bits, on a 80Mhz mcu.

From there, it goes up exponentially.

If I were you, I would try to understand what you are trying to do, and what can be done realistically and decide where to compromise.


I get the impression that I was not very clear what I wanted to do, so maybe a simple scheme would illustrate the idea a bit better.



So I already have a LED driver that I can control with DMX512/RDM signal at a theoretical 16-bit resolution and when measuring the light output with a power meter, some bits are lost but the resolution is still quite good in practice. And that driver can combine to 8-bit DMX signals as HI and LO bytes (or coarse and fine) so that part is already under control with the digital output pin of Arduino and a DMX shield (http://www.arduino.cc/playground/DMX/DMXShield)

So now my problem is that I cannot really switch the output current from that LED driver with a single transistor as the control algorithm of the LED driver would like to keep the output current constant. So I thought of adding the PNP transistor to the scheme so that it would conduct when the PWM signal from Arduino is LO (basically short circuit) to "fool" (thus the title) the LED driver to sense non-changing current even though I would be changing the current going through the LED.

I could then independently set the DC current from LED driver with DMX at 16-bit resolution and add to that the switching stage with 8-16 bit resolution of duty cycle which would be totally satisfactory for me and I would not need to go to the 200 GHz clock frequency ever.

In other words

ResolutionSUM = DMX(8 bit + 8 bit) + PWM(8-16 bit) = 16 + (8 to 16 bits) = 24 to 32 bits
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

16-bits (converted to decimal) gives you a range from 0 to 65,535. I'm sure you can't tell the brightness-difference difference between 0 and 1

Using PWM? You probably can...the difference between 0 and 1 is very hard to eliminate.

, between 65,534 and 65,535, or between 30,000 and 30,001, etc.!   

Brightnesses in that range are a bit more difficult.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Troy, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Finnish in USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

, between 65,534 and 65,535, or between 30,000 and 30,001, etc.!   

Brightnesses in that range are a bit more difficult.


And as my main interest for such a system is scientific, so if the power meter detects a difference between 30,000 and 30,001 or more importantly between 40 and 41 then it is a useful property for me. And then you could for example use the setup for a psychophysical experiment to actually measure which step differences are actually perceived smiley-razz
Logged

Pages: [1] 2 3   Go Up
Jump to: