Author Topic: Constant current confusion  (Read 11927 times)

0 Members and 1 Guest are viewing this topic.

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Constant current confusion
« on: July 14, 2016, 11:11:50 pm »
I'm working on a project that needs to drive 4 100ma LEDs with a 12v supply (along with a micro and a few jellybean parts)(Datasheet http://www.mouser.com/ds/2/602/DS146-748694.pdf). Not only this, but each LED needs to be able to turn on and off independently from the others (ie, LED1 needs to be on while LEDs2-3 need to be off). I looked into using an LM317 as a constant current source, but I couldn't find any information on multi LED configurations. I thought about using Darlington transistors to allow the micro controller to control each LED, but other than that, I'm stumped. Any ideas?
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Constant current confusion
« Reply #1 on: July 14, 2016, 11:36:37 pm »
Hi

So, you want to turn LEDs on/off by micro control. The LEDs are driven by 12V
The easiest way is outlined on this page
http://www.w9xt.com/page_microdesign_pt7_transistor_switching.html
Just use ohms law to set the current throught the LED, ie work out R2.
(R2 = 12V - 1.4V /desired current)
R1 is pretty easy, just work out what value will push say 5mA into the base, turns transistor full on.
This will give rough constant curent control, but good enough for driving LEDs.

If you really must do accurate constant current control, look at this
http://electronics.stackexchange.com/questions/141935/opamp-misbehaving-in-constant-current-source-circuit

To set a fixed current by the micro, make Rset = Viohigh/desired current.




 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #2 on: July 14, 2016, 11:56:00 pm »
Hi

So, you want to turn LEDs on/off by micro control. The LEDs are driven by 12V
The easiest way is outlined on this page
http://www.w9xt.com/page_microdesign_pt7_transistor_switching.html
Just use ohms law to set the current throught the LED, ie work out R2.
(R2 = 12V - 1.4V /desired current)
R1 is pretty easy, just work out what value will push say 5mA into the base, turns transistor full on.
This will give rough constant curent control, but good enough for driving LEDs.

If you really must do accurate constant current control, look at this
http://electronics.stackexchange.com/questions/141935/opamp-misbehaving-in-constant-current-source-circuit

To set a fixed current by the micro, make Rset = Viohigh/desired current.

Firstly, a resistor with a fix voltage is a horrible way to current limit a high power LED. It has no feedback whatsoever, and is highly inefficient, not to mention I'll have to use high wattage resistors for the LED's. As for the opamp, I'm looking for something that can drive multiple LED's in parallel (so they operate independently), not something I can duplicate 4 times over (unless I have to, in which case I'd probably go with the LM317 solution). It looks to me like the opamp design only drives 1 load, unless I'm reading it wrong (which I probably am, I pretty new to constant current and LED drivers)
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Constant current confusion
« Reply #3 on: July 14, 2016, 11:56:59 pm »
If you want to control 4 LEDs independently, you will need 4 separate current control circuits - one for each.

If you only want to have one current source, then have all 4 LEDs in series with each other and the current source, with a mechanical switch across each LED - like this:


Presuming there is sufficient voltage.

Don't know about MCU control, though.
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #4 on: July 15, 2016, 12:04:56 am »
Perhaps I could use darlington transistors or BJT's to replace the switches? Are you sure the switch method with 1 constant current source will work? Also, speaking of enough voltage, what about the voltage drop across each LED. The forward voltage of each LED is ~2.3 volts -I'm using 3 different colors of LED, 3 have a FV of ~2.3, the other has a FV of ~3.3. If I do the math, that's 10.2 volts. Should I increase the voltage of my power supply, which is currently (pun not intended) 12 volts?
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Constant current confusion
« Reply #5 on: July 15, 2016, 12:14:50 am »
Quote
  a resistor with a fix voltage is a horrible way to current limit a high power LED. It has no feedback whatsoever, and is highly inefficient, not to mention I'll have to use high wattage resistors for the LED's
Not really, classic way for doing simple current control. Correct there is no control of the current, it works because the load does not change much which it should not do for LEDs. It use to be the way to do simple cc control for battery charging. Yes, the resistors will need to be power resistor but probably max 1 watt, you need to work out the power dissipation.

Quote
It looks to me like the opamp design only drives 1 load, unless I'm reading it wrong
Correct, 1 opamp will be needed per LED. This is a simple to understand cc control circuit. You can do it with transistors only but it is more complicated and harder to understand (for me at least, hate all the calculatiins needed to bias transistors properly >:( )
The problem with LM317 is it does not have any way to turn on/off the cc. It is just a regulator.

Feel free to look at alternatives, just throwing you some ideas.
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #6 on: July 15, 2016, 12:44:34 am »

Quote
It looks to me like the opamp design only drives 1 load, unless I'm reading it wrong
Correct, 1 opamp will be needed per LED. This is a simple to understand cc control circuit. You can do it with transistors only but it is more complicated and harder to understand (for me at least, hate all the calculatiins needed to bias transistors properly >:( )
The problem with LM317 is it does not have any way to turn on/off the cc. It is just a regulator.

Feel free to look at alternatives, just throwing you some ideas.
It's not a problem that the cc can't be turned off on the LM317, because I should be able to control the LED's directly via a transistor of some sort.
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #7 on: July 15, 2016, 12:45:55 am »
Do you really think that a 1 watt resistor would work? Would I need a heat sink of some sort for the resistor?
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: gb
Re: Constant current confusion
« Reply #8 on: July 15, 2016, 01:02:59 am »
Do you really think that a 1 watt resistor would work? Would I need a heat sink of some sort for the resistor?

Work it out.  You've mentioned that "a resistor is a horrible way to limit current" and for large voltage differences between supply and LED forward voltage, yes, its less than ideal - but it also proves you understand ohms law.  You can work out the power dissipation of any resistor you use and rate it accordingly.

As for have control over individual LED's then the suggestions posts so far pretty much cover it, unless you want to get into using buck regulators.  You could just use a single buck that is capable of providing > 500mA to provide a lower voltage and use transistors to switch the LED's - preferably just above the maximum Vf of the LED's so the power dissipation in the current limiting resistors is smaller.  Ebay and even amazon have plenty of buck modules that are quite efficient in the 200-500mA range (but crap at <100mA and> 2A).
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #9 on: July 15, 2016, 01:20:50 am »
Oh, I like the idea for the buck converter. What kind of IC would I use for that? I'm putting this into a PCB, so I can't really use anything from Ebay.
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Constant current confusion
« Reply #10 on: July 15, 2016, 01:29:50 am »
Allow me to just pull a 4-bit constant-current LED driver out of a hat: http://www.digikey.com/product-detail/en/stmicroelectronics/STP04CM05XTTR/497-6942-1-ND/1880319

Linear mind you.

I take it these are fairly high forward voltage LEDs?
« Last Edit: July 15, 2016, 01:33:20 am by Monkeh »
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #11 on: July 15, 2016, 01:40:05 am »
3 have a FV of ~2.3, the other has a FV of ~3.3.
Forward Voltages^

Hmmmmm, I'm looking at the driver, and it looks a bit too complex for my taste. I think I should just go for the resistor set up...
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Constant current confusion
« Reply #12 on: July 15, 2016, 01:43:48 am »
So you're talking about dumping a watt each for those three. Abandon 12V unless you want a space heater.

Grab a buck reg, run it at about 3.6V, and you might even be able to run your micro off it.

There's way, way too many for me to come up with a recommendation off the top of my head right now, so.. go nuts:
http://www.digikey.com/product-search/en/integrated-circuits-ics/pmic-voltage-regulators-dc-dc-switching-regulators/2556570
« Last Edit: July 15, 2016, 01:46:10 am by Monkeh »
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #13 on: July 15, 2016, 01:49:40 am »
Would this generate a lot of heat on the IC? Anywhere else I would need to know?
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Constant current confusion
« Reply #14 on: July 15, 2016, 01:50:32 am »
Would this generate a lot of heat on the IC? Anywhere else I would need to know?

No, that's the whole point of using a buck converter.

They are layout sensitive. Be careful.
 

Offline tyguy2Topic starter

  • Supporter
  • ****
  • Posts: 303
  • Country: us
Re: Constant current confusion
« Reply #15 on: July 15, 2016, 01:52:16 am »
Thanks for bearing with me, I appreciate the help!
[Sarcastic comment] clever joke [/sarcastic comment]
Bitcoin:
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
 

Offline Connoiseur

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: Constant current confusion
« Reply #16 on: July 15, 2016, 02:15:25 am »
If you are using a micro, then why not PWM the leds?

The attached picture shows the basic idea.
Adjust duty cycle in a loop till required current is obtained (get the current through ADC as shown).
You can simply double the reference value for two leds and keep on increasing it; as the number of leds turned ON increases; in software.

PS: use a rail to rail opamp or a dedicated current sense amplifier for acceptable results.
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4535
  • Country: gb
Re: Constant current confusion
« Reply #17 on: July 15, 2016, 04:06:35 am »
If you are using a micro, then why not PWM the leds?

The attached picture shows the basic idea.
Adjust duty cycle in a loop till required current is obtained (get the current through ADC as shown).
You can simply double the reference value for two leds and keep on increasing it; as the number of leds turned ON increases; in software.

PS: use a rail to rail opamp or a dedicated current sense amplifier for acceptable results.

Are you sure about that particular circuit ?

There is apparently no resistor (ignoring the very low valued Rsense resistor) between the LEDs and the 12V power supply. Therefore a potentially huge current would attempt to flow, during the on parts of the PWM cycles. This could easily exceed the LEDs datasheet specifications. The transistors will probably limit the current to an extent, depending on the base resistor values, but that would be very hit and miss.

A quick look at the LEDs datasheet, seems to say that there would be about 2 volts (depending on colour) across them (at about 100 ma), and around 300 ma (pulsed) is the maximum.
You would probably see amps flowing (depending on the 12V and other things), in your circuit, as it stands.

I guess a series resistor could be included to fix that issue.
« Last Edit: July 15, 2016, 04:13:03 am by MK14 »
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Constant current confusion
« Reply #18 on: July 15, 2016, 04:16:25 am »
Are you sure the switch method with 1 constant current source will work?
Yes (Again, assuming the voltage available is adequate).  There's always a current path, so whether all 4 switches are open (4 LEDs lit) or all are closed (short circuit and no LEDs lit) the same current will flow.


Quote
Perhaps I could use darlington transistors or BJT's to replace the switches?

If Vce of the transistor < Vf of the LEDs, then I would think so.  You'd have to account for the varying offset of the base voltages for each transistor, but for off/on operation then that's not too onerous.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16614
  • Country: us
  • DavidH
Re: Constant current confusion
« Reply #19 on: July 15, 2016, 04:42:07 am »
Unless you pulse width modulate the LEDs, controlling the current is going to require heat dissipation in a current limit resistor or transistor or both.

You do not say what voltage your microcontroller is operating at however you have everything you need to make simple switched constant current sources using one bipolar transistor and output port per LED.  Put the current limiting resistor in series with the emitter of each transistor to ground and drive the bases directly from the output ports.  Connect the LEDs between +12 volts and the transistor collectors.

With 5 volt outputs, the voltage across the resistors will be 5 - 1 Vbe = 5 - 0.6 or 4.4 volts.  4.4 volts / 100 milliamps = 44 ohms @ 440 milliwatts so use 1 watt resistors.  Transistor dissipation will be 12 - 4.4 - Vled = 12 - 4.4 - ~3 =  4.6 volts * 100 milliamps so 460 milliwatts.  You might get away with 625 milliwatt 2N4401 transistors but I would use something in a TO-126/TO-225 package like a 2N4921/2N4922/2N4923 or BD135/BD137/BD139.

If you do want to use TO-92 transistors (or SOT-23s, whatever), add another resistor in series with the collectors to take up some of the heat dissipation.  Alternatively, lower the +12 volt supply to the LEDs.
« Last Edit: July 15, 2016, 04:44:17 am by David Hess »
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4535
  • Country: gb
Re: Constant current confusion
« Reply #20 on: July 15, 2016, 05:01:26 am »
Oh, I like the idea for the buck converter. What kind of IC would I use for that? I'm putting this into a PCB, so I can't really use anything from Ebay.

You are better off converting (lowering) the voltage (as you are mentioning above) or using a low voltage supply to begin with. Then the circuitry will be much easier for you, and you will have much less wasted heat energy produced.

PWM produces about the same amount of wasted power in the form of heat, as a non-PWM solution. For loads such as your LEDs, with series resistors.

I.e. 12V down to about 2V, wastes power and produces heat in the resistors and/or transistors, regardless of PWM or DC. You have to use switching voltage converters (such as the buck converter), to minimize wasted energy, which causes heating in the components.

Alternatively putting all four LEDs in series, would also save a lot of energy (when all four are simultaneously on). But it would be very difficult to switch them on and off, via the MCU, without rather complicated circuitry. So I don't think it is a good solution, unless you are happy with the mechanical switches, someone shows earlier in this thread.
« Last Edit: July 15, 2016, 05:06:27 am by MK14 »
 

Offline rudika79

  • Regular Contributor
  • *
  • Posts: 68
  • Country: gb
Re: Constant current confusion
« Reply #21 on: July 15, 2016, 05:30:23 am »
You can use switch mode led driver IC. At any part distributor you can found hundreds of different type. I design once RGB led driver with three led driver. You have one control pin for adjusting brightness and switch on/off the LED. Later when I will be at my workplace I can give you the part number and the circus diagram if you want.
« Last Edit: July 15, 2016, 05:32:10 am by rudika79 »
 

Offline MK14

  • Super Contributor
  • ***
  • Posts: 4535
  • Country: gb
Re: Constant current confusion
« Reply #22 on: July 15, 2016, 05:58:57 am »
You can use switch mode led driver IC. At any part distributor you can found hundreds of different type. I design once RGB led driver with three led driver. You have one control pin for adjusting brightness and switch on/off the LED. Later when I will be at my workplace I can give you the part number and the circus diagram if you want.

That sounds like a very good idea!

It will be very efficient, easily handle the 12 volt supply. Accurately control the LED currents, producing low amounts of heat, and four channel ones in a single IC are available. I don't know which is the best one for your purposes.

Example:

https://www.maximintegrated.com/en/products/power/led-drivers/MAX16814.html

« Last Edit: July 15, 2016, 06:00:54 am by MK14 »
 

Offline rudika79

  • Regular Contributor
  • *
  • Posts: 68
  • Country: gb
Re: Constant current confusion
« Reply #23 on: July 15, 2016, 06:59:06 am »
See attached picture for schematic. I use ZXLD1350 IC. It's comming in sot23-5 type package. On R-LED pin ypu can switch on/off and supply PWM signal for brightnes. LED you connectrd to J1 connector. I had three off this IC on PCB.
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Constant current confusion
« Reply #24 on: July 15, 2016, 08:07:33 am »
I'd use 4 x jelly bean BJTs in current sink configuration. The SOT23 would be more than adequate for 100mA. This way the LED current would be independent of supply voltage and beta.
If you want to be super accurate then there are SOT23-4 current mirrors available (a pair of BJTs).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf