LM317 Constant Current Circuit: Common Anode (high current) RGB star help..

I need to make a quick circuit to blink/toggle a 'high powered' RGB led.. (meaning not an accent led of 20mA or so).. it will NOT remain on for a long period of time.. (but I'm sure I'll heatsink the star itself)

actually this is the RGB in question,...the notoriously 'backwards' labeled DealExtreme 3W RGB star:

http://dx.com/p/3w-led-emitter-on-star-multicolored-rgb-4530

Its a common anode RGB.. (read comments)

dealing with large current like this is a bit out of my comfort zone.. so I figured Id post and talk it through here first. :)

I plan to wire it up like this, (well not that many RGB's,...just the one): http://dmstudios.net/misc/RGB_transistor_commonAnode_diagram2.jpg

keeping the board/components somewhat simple..and easy for me to handle/understand..

the circuit/board will have:

voltage regulator, decoupling caps.. some PNP resistors.. some pads for the battery pack to be soldered to.. some pads for the Arduino signal wires to be soldered to..

Open questions/concerns: (or things I need to be walked through better) :)

1.) the steady +3.3v powering the RGB.... The Green & Blue should be fine.. with out any resistor on it..(although I was taught always use a resistor).. however the red will need one.. as its fV is 2.5v-3.0v,... if the link is to be believed....

as this large of a current.. I'd need like a 1watt resistor or something?? (kinda bulky..and defeating the SMD purpose of this little board/circuit then)

another/better way for this?

2.) the 1K resistors on the Arduino lines.. not sure how to bets figure out the correct values for here (I know its some magic equation of some sorts?) HAHA..

these are used to be able to saturate the transistor enough to get the FULL POWAH!! through it yes?... I was thinking.. could I calculate these values to NOT be able to saturate the transistor fully and hence 'resistor' it that way enough for the red?

the pins I use most likely will be digital on/off pins..(not PWM pins)

any other improvements..or things I should make note of?

Lastly..

components?

  • I am not sure what +3.3v regulator I should use that is SMD still in nature.. but has more than the the typical 150-200mA current limit.. needs to be able to at least give 350mA at a time to any 1 channel of the RGB star/led..

  • then of course a PNP type transistor choice??.... (usually only have used NPN for common cathode led arrays...etc..and again those were fairly small current needs of only 60-140mA)...

I know there is a bit of a voltage drop across one...but what spec/rating do you look at on a datasheet to know if it can OUTPUT enough current through it?..

for NPN type, SMD sized transistors.. I have used these: BC81725MTFCT-ND http://www.digikey.com/product-detail/en/BC81725MTF/BC81725MTFCT-ND/1305367 * Vebo / Emitter-Base Voltage = +5v (this is the MAX INPUT voltage from the Arduino pin.. +5v is fine..as its a +5v based logic board) * Ic / Collector Current (DC) = 800mA (this is the MAX OUPUT current the transistor can pass/putout....correct?) * Ices / Collector Cut-off Current = 100nA (anything UNDER this rating given to the collector and the collector will NOT open/will close) * Iebo / Emitter Cut-off Current = 100nA (anything under this comign form the GND of the battery source and it will not work/open)

now for the PNP type I need for this project...???

do I need to be checking the Ic/Collector Current ratings to ensue I can pass enough current through it to power the RGB star/led?

any other specs to be aware of that might effect this?

here is my current schematic to start with and to go along with the thread:

I think I'll stop there before I confuse myself more by over thinking things! LOL

thanks!

Your green/blue are rated with a Vf of 3.2V to 3.8V so feeding them 3.3V won’t work when you consider the additional voltage drop across the transistor.

Your datasheet states that the NPN BC807/BC808 are the complement to the PNP version BC817/BC818.

IC is the peak current that the transistor will handle. Both NPN and PNP versions report 800ma.

I’ll provide an example how to run these numbers. Using the green Vf as an example, the LED will drop 3.2V (minimum). Fig 5 of the BC817 datasheet shows that the voltage drop across the transistor is .8V at 300ma. Subtracting 3.2V + .8V from Vin the resistor then takes the remainder of the voltage. So if Vin (AKA Vraw) were 5V, then 5V - (3.2V + .8V) = 1V. If you’re passing 300ma current then the resistor would be R = V / I = 1 / .3 = 3.3 ohms.

Now we know that (for Vin of 5V) the LED is dropping 3.2V, the transistor is dropping .8V, and the resistor is dropping 1V. The current through the circuit is 300ma. To calculate the power dissipation of each part you multiply the voltage by the current, so the LED dissipates (3.2V * 300ma) = .96W, the transistor (.8V * 300ma) = .24W, the resistor (1V * 300ma) = .3W. The transistor datasheet states it can handle .31W dissipation and the resistor you use must be greater than .3W rating.

As an aside, this circuit is wasting .31W (the transistor) + .3W (the resistor) = .61W of power as heat. That’s your inefficiency.

Will this work well? Probably not. Again looking at the green LEDs maximum Vf (3.8V) if we re-run the numbers then the resistor will drop .4V. With the same 3.3ohm resistor the current will be I = V / R = .4V / 3.3 = 121ma (too dim!). The lesson here is that when you calculate a resistor value less than ~50 ohms you don’t get an accurate current regulation when varying Vf or Vin is considered. You have to re-run the numbers and try again.

thanks for the reply..

(a bit above my head though with all the maths for now) :(

somewhere in there I'm guessing is an answer though.. LOL..

and the general stance is it wont work..

I understand that because of the voltage drop.. the +3.3v regulator wont be enough now.... (and only because you stated.. the +5v wont work either.. is this because of loss of power as heat? this will really only 'blink' very fast on-off.. never a steady on.. or a PWM..anything.. just to re-iterate the usage to see if it' can get by'.. as the wasting of power as heat is NOT a concern at this stage..if ever on this portion) :)

so trying to keep things small/smd and very LOW component count.. what is the answer? or what is the better approach here?

also thanks for pointing out the matching PNP transistor version:

Complement to BC807/ BC808

I completely missed that. :)

(is this line backwards?.. "Your datasheet states that the NPN BC807/BC808 are the complement to the PNP version BC817/BC818.")

did you mean the datasheet says the PNP BC807/BC808's are the compliments to the NPN BC817/BC818's?

sorry.. I want top be clear (not picky) :) .. to a noob like myself.. (who already has trouble knowing when to use PNP or NPN types)...Im trying to keep things straight. ;)

what about moving to a non-smd sized transistor? like a TIP42 or something? or maybe in-between in size? lol..

thanks for the help so far!

take care

-xl

Yeah I got the NPN/PNP thing backwards.

With high power LEDs, where dimming is needed, there really aren't any easy and efficient solutions. There are linear regulators in through-hole versions like the CAT4101 or TLC5940 that will work but you want to keep Vin close to the Vf of the LEDs. The AMC7135 is a popular/simple SOT89-3 that does 350ma with a low .2V dropout; for PWM just switch the power to it with a transistor (preferably a FET) but it only allows 6V input max.

For a switching regulator you can find the guts to MR16 bulbs on eBay. The PT4115 (in a pseudo SOT89-5 package) seems to be the most commonly used, and looking at the datasheet for that chip you should be able to figure out how to modify the circuit to solder on a wire and add PWM dimming. A big YMMV here though. ledsee.com also sells a single channel or six channel circuit using this chip.

whew.. (glad it was backwards.. i started to second guess myself.. etc..)

also.. (as mentioned)

there will BE NO DIMMING

there will BE NO PWM

there will BE NO LONG periods of time where ANY channel of this LED will be on for more than a fraction of a second at a time.. (simple BLINK, no fade when a button is manually pressed..1 press = 1 blink) someone has had of used these cheapie 3W RGB leds from DealExtreme before with an Arduino, in some easy/noob fashion I can use as a starting point.....haha..

ok.. searching a round a bit.. perhaps switching to a CURRENT regulator set-up.. vs a voltage regulator set-up?

(ie: constant current regulator/driver...yes?)

I found this;

http://led.linear1.org/a-cheap-current-regulated-luxeon-star-driver-design/

which 'looks' to be set-up to give 320mA?

which is fine by me.. :)

I have never design./created/laid out a constant current driver before though?

I know the link has a bit of a disclaimer at the top? but also states it works?

thoughts??

me again…

checked out the link:
http://www.ebay.com/itm/300mA-Constant-Current-Regulated-3-x-3W-LED-Driver-for-MR16/230913947650?_trksid=p2047675.m1982&_trkparms=aid%3D333005%26algo%3DRIC.FIT%26ao%3D1%26asc%3D17571%26meid%3D1107647698481892851%26pid%3D100009%26prg%3D8140%26rk%3D3%26rkt%3D5%26sd%3D171119708256%26

‘looks’ like it would fit the bill… and size it perfect more or less…

says 3 x 3w though?

meaning it has 3 outputs each having 300mA each?

also says 12v…

which wont work…

this more or less be driven by a +7.4v Li-ion pack…

again though… this will just be used for a quick ‘blink/toggle’… not run constantly…or for any length of time.

(its going in the barrel of a gun prop, for a muzzle flash effect…just would like to be able to choose colors through the code/transistor I open…etc)

xl97: says 3 x 3w though?

meaning it has 3 outputs each having 300mA each?

Its specs are incorrect. 12V in at 300ma would only be 3, 1W LEDs in series. But that's not too important; what is important is the 300ma current regulation. The chip will take 6-45V so long as all other components are capable of that voltage.

Also worth mentioning that these are designed to be capable of AC input and you can see the four diodes in a rectifying bridge on one side. You would want to remove those if you're using DC to prevent that voltage drop/waste.

The exact circuit is shown in the datasheet: www.micro-bridge.com/data/CRpowtech/PT4115E.pdf?

I'm thinking the LM317 route might be easier for me to get a grip on?

I also remembered I have a hand full of these laying around as well:

STCS2 LED driver chips

http://www.digikey.com/product-detail/en/STCS2ASPR/497-6917-1-ND/1880295

http://www.st.com/web/en/resource/technical/document/datasheet/CD00185795.pdf

Im really at a loss right now on a direction....

trying to build/design a constant current regulator/driver is the best approach...yes?

so I should forget all the talk/schematics posted in the original post.. re-group and focus on either:

LM317 adjustable current regulator? (I have seen mentioned a few times while doing quick searches)

or

focus some time/attention to this STCS2 driver chip.. and see if I can work something out using that in a tiny little pcb?

thoughts? lol.. I know for you, this is 101 stuff.. but I have never really worked with making/needing a constant current driver in my little Arduino projects..

always voltage regulation.. and the current limiting resistors..

so this is new still for to get grasp on

trying to learn but always quickly fab something useful & small. knowing the use of the led itself.. and that it wont be stressed or run for any length of time.

thanks!

The STCS2 and the other linear regulators mentioned all have a much lower dropout voltage than the LM317 would have – assuming you’re tailoring your input voltage carefully to match your LED Vf. But if you’re just using it for intermittent flashes from a battery varying between 8.4V and 6.4V (as a 2S Lipo would do) then the LM317 would probably be the most appropriate solution.

ok..thanks!

I'll start focusing on a LM317 adjustable current regulator circuit then.. :)

I was also thinking.. if I went the STCS2 route.. I'd have to use 1 for each channel/color...yes? (that would be over-kill for this little project)

and yes.. it only EVER be used as a quick little 'flash'.... never on for more than a brief second....milliseconds tops.

I'll post back when I have worked up a schematic for review.. :)

thanks again.

ok. Im going to (finally) start on the LM317 constant current regulator..

Q1: can I/should I still keep the diode in there for reverse polarity protection?

Q2: confused/need clarification..

Q3: no decoupling caps needed? like on a VOLTAGE regulator?

previously.. I was using a VOLTAGE regulator.. now I'll be using a CURRENT regulator..

however my LEDS are still common anode type..

do I still keep the PNP type resistors?

doing a schematic right now...

Im not even sure the correct LM317 I should bee looking for/at?

Q4: I thought I had read somewhere about these LM317 constant current drivers circuits that you need at least +3 volts HIGHER that your intended fV of the led?? (that correct?)

I see these: LM317CYR http://www.digikey.com/product-detail/en/LM317DCYR/296-12602-1-ND/443738

Voltage - Input 4.2 V ~ 40 V Current - Output 1.5A (Max) Mounting Type Surface Mount

and this one:

LM317MDCYR http://www.mouser.com/Search/ProductDetail.aspx?qs=JS6RUWRH9DWKuMPAAfpOMw%3d%3d or digikey: http://www.digikey.com/product-search/en?pv7=2&k=LM317MDCYR&mnonly=0&newproducts=0&ColumnSort=100001&page=1&stock=1&quantity=1&ptm=0&fid=0&pageSize=100&k=LM317MDCYR&filterAlwaysExpand=1

Voltage - Input 4.2 V ~ 40 V Current - Output 500mA (Max) Mounting Type Surface Mount

preference or better choice?

any channel on the led will not be getting more than 350mA...

package size seems identical? so would matter to me on that aspect..

whole project will be powered by a +7.4v Li-Ion rechargeable pack....

w/ changed schematic for review/critique… :slight_smile:

bump.. if anyone is around/bored :)

Since I only want one color/channel in use at any given time....

is this the correct approach? same as before but with an LM317 as constant current instead of LM7805 as voltage regulator?..

the VOUT from the LM317 still goes to the 'transistors'.. and then depending what pin/transistor I toggle..it will use that DIE on the LED? (there will no color mixing, ie: not more than 1 transistor open at any given time, these are not hooked up to PWM enabled pins.. simple digital on/off)

what about the RED DIE though?

being new to all this constant current circuit design stuff...how do I accommodate for the RED die having a lower fV (forward voltage) requirement than the other dies/colors?

normally (in a non-high current design).. I would just adjust the resistor to be a bit more than on the Green & Blue dies..

but in a 'constant current' set-up? Im not sure how this should be approached?

I know there are 2-3 posts to catch up on,...so thanks to anyone around & Chagrin as well :)

take care

ok… updated schematic…

I changed the transistors from PNP back to NPN type because of the switch from a VOLTAGE regulator to a constant CURRENT regulator…

I guess Im confusing/concerned between the differences in schematics here:

http://led.linear1.org/a-cheap-current-regulated-luxeon-star-driver-design/1/

& the datasheet:

(page: 10 & figure 23)

I see a few more resistors in the schematics in the datasheet… needed? (and more so… the purpose?)

I also see the DIODE in a different position (between output and input…instead of in series on the input like like for a LM7805 voltage regulator type design?

Project details:

  • +7.4v li-Ion battery pack
  • no PWM needed
  • no color mixing (1 channel on at a time)
  • will only be ‘blinked’ never -on- for any ‘length’ of time

anything else anyone can spot as being ‘wrong’? (or could/should be done better/different?)

thanks!

update:

I am now using only 1 cap on the input (none on output)..and one resistor between out and adj. (3.9ohm) (320mA output?)

seems to mirror the datasheet more or less...(still have my reverse protection diode on V+ line before the LM317)

here is my schematic:

in my mind.. I should have a steady 320mA going to the RGB transistor(s).. ready to be switched on/off (single color/channel) by the matching Arduino signal pin..

what Im still a bit unclear of is, my source voltage is a +7.4v li-ion pack..(which I think works/is within the range of needing 2-3 volts higher than your led fV you should have..if I understand things correctly)..............

how does this affect the RED die/channel?

do I need to do more so I dont burn that out? RED are a lower fV than the BLUE & GREEN.... but since this a constant current set-up and not voltage regulated with an in-line current limiting resistor....?? I'm not sure how to handle the RED die?

and lastly.. I have 1k resistor on the transistor >> Arduino pin... just a generic value... how do I calculate the correct value for those resistors? to ensure foll saturation/openness of the transistor(s)?

here is my schematic:

I think your circuit has a fundamental flaw as to current control to the RGB led. The regulator as you have implemented is a constant current source but the current path can be from 0 to 3 led sections wired in parallel. So what happens if you want all three colors turned on, how will the steady 320ma current be shared by the three led sections? For total control you need a constant current source dedicated to each RGB section.

Minor drawing error: Your arrows are pointing in the wrong direction for a NPN transistor(s).

Lefty

HI Retrofly - (thanks for the reply…was beginning to think it was a dead thread)

I have a new post ready to go so this one with all the BAD schematics wont lead someone down the wrong path. :slight_smile:

to address the question/flaw:

1.) its not designed or intended to be used with multiple colors, or more than one channel on at a time (but if so, which it wont…wouldnt it just be a dim ‘color’?)

to be more clear and give some background… the user has a config file located on an SD card… where they can set either R, G or B as one of the values for a default… this text file gets parsed…and then uses the appropriate color (pin) for the events in the sketch. (hope that clears it up?)

I also wanna keep it very small

that being said… maybe there are still other flaws? (I have a list of 5 questions at the end of the summary!) lol

(I have asked Nick Gammon to nuke this thread due to the dead-air and bad schematics.etc…etc…

//NEW post including question summary at end: (posting here to maybe help you get the details/fine points easier than digging through my trial & error process! LOL)

Project details:

  • high current RGB LED star (RGB in question,…the notoriously ‘backwards’ labeled DealExtreme 3W RGB star:

http://dx.com/p/3w-led-emitter-on-star-multicolored-rgb-4530)

  • +7.4v li-Ion battery pack
  • no PWM needed
  • no color mixing (1 channel on at a time)
  • will only be 'blinked,…never -on- for any ‘length’ of time (used for muzzle flash for gun prop)

Reference Material I used:
http://led.linear1.org/a-cheap-current-regulated-luxeon-star-driver-design/1/
& the datasheet: (figure 42 I believe)
http://www.ti.com/lit/ds/symlink/lm117.pdf

Calculate resistor value:
http://diyaudioprojects.com/Technical/Voltage-Regulator/
http://www.electronics-lab.com/articles/LM317/ <-------------------[what part does the R2 play in this type of set-up?]

Since I only want one color/channel in use at any given time…

the VOUT from the LM317 still goes to the ‘transistors’… and then depending what pin/transistor I toggle…it will use

that DIE on the LED? (there will no color mixing, ie: not more than 1 transistor open at any given time, these are not

hooked up to PWM enabled pins… simple digital on/off)

seems to mirror the datasheet more or less…(still have my reverse protection diode on V+ line before the LM317)

here is my schematic:

in my mind… I should have a steady 320mA going to the RGB transistor(s)… ready to be switched on/off (single

color/channel) by the matching Arduino signal pin…

what Im still a bit unclear of is, my source voltage is a +7.4v li-ion pack…(which I think works/is within the range of

needing 2-3 volts higher than your led fV you should have…if I understand things correctly)…

how does this affect the RED die/channel?

do I need to do more so I dont burn that out? RED are a lower fV than the BLUE & GREEN… but since this a constant

current set-up and not voltage regulated with an in-line current limiting resistor…?? I’m not sure how to handle the

RED die?

Im not really clear what VOLTAGE is going to the LEDs anymore using an LM317 as current regulator??

and lastly… I have 1k resistor on the transistor >> Arduino pin… just a generic value… how do I calculate the

correct value for those resistors? to ensure foll saturation/openness of the transistor(s)?

here is my schematic:

PARTS I HAVE FOUND:

LM317 I have found, asking for second ‘eyes’ if these are correct/acceptable?

I see these:
LM317CYR
http://www.digikey.com/product-detail/en/LM317DCYR/296-12602-1-ND/443738

Voltage - Input 4.2 V ~ 40 V
Current - Output 1.5A (Max)
Mounting Type Surface Mount

and this one:

LM317MDCYR
http://www.mouser.com/Search/ProductDetail.aspx?qs=JS6RUWRH9DWKuMPAAfpOMw%3D%3D
or digikey:
http://www.digikey.com/product-search/en?pv7=2&k=LM317MDCYR&mnonly=0&newproducts=0&ColumnSort=100001&page=1&stock=1&quanti

ty=1&ptm=0&fid=0&pageSize=100&k=LM317MDCYR&filterAlwaysExpand=1

Voltage - Input 4.2 V ~ 40 V
Current - Output 500mA (Max)
Mounting Type Surface Mount

preference or better choice?

Transistors:
Digikey#: BC81725MTFCT-ND
Mfg#: BC81725MTF

http://www.digikey.com/product-detail/en/BC81725MTF/BC81725MTFCT-ND/1305367

specs:
Transistor Type: NPN
Current - Collector (Ic) (Max): 800mA
Voltage - Collector Emitter Breakdown (Max): 45V
Vce Saturation (Max) @ Ib, Ic: 700mV @ 50mA, 500mA
Current - Collector Cutoff (Max): 100nA
DC Current Gain (hFE) (Min) @ Ic, Vce: 160 @ 100mA, 1V
Power - Max: 310mW
Frequency - Transition: 100MHz

Question Summary:

Q1: look ok over all?
Q2: how do I handle the RED channel/die in the led? (lower vF?)
Q3: (stupid one I know…but) What is the voltage going to the LEDS now in the configuration? (not sure how the voltage is

being regulated?)
Q4: parts I have chosen look acceptable/correct?
Q5: how to correctly calculate the resistors on the transistor pin >> Arduino pins to ensure proper saturation/opening of

transistor gate?

I hope I have made this as easy as possible to help me. :slight_smile:

thanks!

Question Summary:

Q1: look ok over all?

Yes, if you are only going to command one color (or none) at a time then your circuit should work.

Q2: how do I handle the RED channel/die in the led? (lower vF?)

No problem at all, as your regulator is wired as a constant current device it will regulate to the desired current no matter what the forward voltage drop rating is to any of the three color led sections.

Q3: (stupid one I know...but) What is the voltage going to the LEDS now in the configuration? (not sure how the voltage is

being regulated?)

Again the voltage is not being regulated rather the current. You could ground the output terminal of the regulator and it would still maintain a steady current to ground. The constant current regulator will automatically adjust whatever output voltage is required by the led section to maintain the designed constant set current.

Q4: parts I have chosen look acceptable/correct?

Looks reasonable, but I would have to read a data sheet on the regulator device to see if R4 is properly sized, and I'm feeling to mellow at the moment to bother. ;)

Q5: how to correctly calculate the resistors on the transistor pin >> Arduino pins to ensure proper saturation/opening of

transistor gate?

Well 'proper' means to look at the datasheet for the transistor and see what it's worst case Beta value is and then calculate the base resistor size equal to less to insure the transistor is always in saturation. Your 1K is probably a fine starting point, adjust if needed. Lefty

retrolefty: Question Summary:

Q1: look ok over all?

Yes, if you are only going to command one color (or none) at a time then your circuit should work.

Q2: how do I handle the RED channel/die in the led? (lower vF?)

No problem at all, as your regulator is wired as a constant current device it will regulate to the desired current no matter what the forward voltage drop rating is to any of the three color led sections.

Q3: (stupid one I know...but) What is the voltage going to the LEDS now in the configuration? (not sure how the voltage is

being regulated?)

Again the voltage is not being regulated rather the current. You could ground the output terminal of the regulator and it would still maintain a steady current to ground. The constant current regulator will automatically adjust whatever output voltage is required by the led section to maintain the designed constant set current.

Q4: parts I have chosen look acceptable/correct?

Looks reasonable, but I would have to read a data sheet on the regulator device to see if R4 is properly sized, and I'm feeling to mellow at the moment to bother. ;)

Q5: how to correctly calculate the resistors on the transistor pin >> Arduino pins to ensure proper saturation/opening of

transistor gate?

Well 'proper' means to look at the datasheet for the transistor and see what it's worst case Beta value is and then calculate the base resistor size equal to less to insure the transistor is always in saturation. Your 1K is probably a fine starting point, adjust if needed. Lefty

thanks bud!

I just used these calculators for the LM317 R4 value: http://diyaudioprojects.com/Technical/Voltage-Regulator/ http://www.electronics-lab.com/articles/LM317/

*this is my first constant current set-up..

so I wasnt clear on the relation between how a voltage regulator work vs current regulator works.. (outside of I know it either regulates voltage or current.. but wasnt clear on how it affected the other...if regulating current.. wasnt sure how voltage worked then?) but as you informed me...it will adjust the voltage to whatver the led needs in order to keep the current steady/constant.

thanks!

So in the end.. (after updating schematic to have correct NPN symbol/part.. not just names/values..

I am left with this:(attached)

and the last thing I need to do it grab the transistors datasheet.. and search for: "Beta value" ?

And use this in some magic equation. :)

(I'm off to grab datashet now)

thanks

off topic question: (like I need to confuse myself even more) haha..

is this was a common CATHODE based RGB led instead.... would I only have to swap out the transistors for PNP type..(and of course not have it wired to GND but to V++)

constant current stuff (LM317) would all stay the same...yes?

thanks..

you dont need C1. the battery itself is a voltage source, and wont need smoothing of its output which in effect is like a very large capacitor anyway.