View Full Version : LM317 LED Driver
jrock64
10-08-2008, 12:20 AM
Ok I have pieced together a lot of posts and here is what I have come up with.
An LM317 can be used as a source of constant current.
http://www.doityourselfchristmas.com/forums/attachment.php?attachmentid=2156&stc=1&d=1223437260http://www.doityourselfchristmas.com/forums/attachment.php?attachmentid=2157&stc=1&d=1223437941
A simple constant current circuit looks like this.
http://www.doityourselfchristmas.com/forums/attachment.php?attachmentid=2158&stc=1&d=1223437459
An example in the national data sheet includes this logic driven circuit.
http://www.doityourselfchristmas.com/forums/attachment.php?attachmentid=2159&stc=1&d=1223437459
So I thought why not feed a ULN2803 with a constant current to feed a pair of LEDs and eliminate the dropping resistors.
I want to drive 8 pairs of 3.3v LEDs at 15ma from a stand alone PIC.
The power supply will be a 9Volt battery.
A voltage regulator will drop the voltage for the PIC.
Its not a real practical application but it is more about learning PIC programming and driving individual LEDs.
Later this will be adapted to renard and other drivers.
Someone calculated the resistor at 80 ohm.
Formula is R= E/I or 1.2V/.015 = 80 Ohms
Does this change if the input voltage changes?
Is this a good way to drive lots of individual LEDs at constant current?
Is there a better way? that I can understand.
I have a different circuit in mind for the high power ones.
Joel
dmcole
10-08-2008, 01:36 AM
What have you got against resistors?
\dmc
mrpackethead
10-08-2008, 02:18 AM
Someone calculated the resistor at 80 ohm.
Formula is R= E/I or 1.2V/.015 = 80 Ohms
Does this change if the input voltage changes?
Ok, a LM317 is actually a 'voltage regulator', however you can use it as a current source as well, as you have found out..
The LM317 will 'regulate' itself, by making sure that the voltage between Vadj and Vout is always 1.25V. Effectively meanign that the voltage drop across the series resistor is 1.25V The current flowing in that resistor is for all practical purposes the ratio between Voltage and Resistane ( I = V/R ).. in your case 1.2/80 or 15mA.
The input voltage does not affect the current.. However... the LM317 and the resistor are going to drop quite a bit of power, often much more that you will use in the powered device..
Not sure what LED's you are using, but say they drop 1.5V.. the LM317 and the reistor have to drop 9-1.5V ( 7.5V ).., ie, 7.5V x 0.015mA or 0.11W... If you moved that up to say .5A or even 1A, you'll be dropping lots of power and things will get hot.
While this works, you need to be careful about applying it to the right situation.. I 'm sure in the application notes for the IC, there will be lots of helpful notes on this.
Hi Joel
I don't think it will quite work as you have laid it out. You have constant current there.... but its being split between 2 parallel lines of LEDs. Won't each of the LED's only be getting half the constant 15ma current that you want?
Not sure why you'd want to use resistors in this config though (other than just experimenting)? The constant current circuit would be good if you were using different combinations of leds in series or different coloured leds which drop different voltages but it doesn't seem to add much here you couldn't do without simpler, cheaper parts for the config you have here.
The second circuit you posted form the national datasheet does make use of constant current, but for a different purpose to what you need here. As the logic turns on those transistors it creates parallel paths for the constant current to flow through which changes Vout. So it looks like a Digital to Analogue convertor cct. It converts a digital signal into an analogue (voltage) - as you change the digital signal the voltage changes.
jrock64
10-08-2008, 08:58 AM
dmc
Just trying to explore alternatives for a universal circuit that does not require setting each individual resistor by LED color.
Mr P.
They are cone top whites that I have measured at 3.3v so 2 would be 6.6v
dmcole
10-08-2008, 12:28 PM
Just trying to explore alternatives for a universal circuit that does not require setting each individual resistor by LED color.
Ah, I missed that completely. Now I understand ... admirable goal.
\dmc
mrpackethead
10-08-2008, 03:18 PM
dmc
Just trying to explore alternatives for a universal circuit that does not require setting each individual resistor by LED color.
Mr P.
They are cone top whites that I have measured at 3.3v so 2 would be 6.6v
At 3.3V each , with a 9V battery, you'll run into a different problem.. The LM317 will drop at least 3V across itself.. 9V-3.3 = 5.8.. You'lve got to drop another 1.25V across teh reistor.. ie; 5.8 - 1.3 = 4.5V.. You're not going to have enough forward voltage to turn them on. I'd still suggest you try this out, theres a lot you can learn by trying it.. A LM317 is a $1 or so, and resistors are cheap enough..
If your looking for a multi channel constant current LED driver, theres some more modern chip sets that will do exactly what you want ( 4/8/16 addresable channels as well ), and very efficently. Heres just one example.. ( http://www.national.com/pf/LM/LM2756.html ).. that woudl be easy to interface to a PIC micro, and you coudl dim up to eight channels as well.
jrock64
10-09-2008, 01:04 AM
I don't think it will quite work as you have laid it out. You have constant current there.... but its being split between 2 parallel lines of LEDs. Won't each of the LED's only be getting half the constant 15ma current that you want?
OK Tim
I think I may have made a bad assumption.
I thought that I could drive multiple strings in parallel, and the circuit would maintain 15ma to each string.
Your telling me that the 15ma gets divided among ALL the parallel circuits?
At 3.3V each , with a 9V battery, you'll run into a different problem.. The LM317 will drop at least 3V across itself.. 9V-3.3 = 5.8.. You'lve got to drop another 1.25V across teh reistor.. ie; 5.8 - 1.3 = 4.5V.. You're not going to have enough forward voltage to turn them on.
Next bad assumption.
I thought that two 3.3v LEDs is series dropped 6.6v and the LM317 would only drop another 1.5v for 8.1v total leaving a comfortable margin with a 9v supply voltage.
if your looking for a multi channel constant current LED driver, theres some more modern chip sets that will do exactly what you want ( 4/8/16 addresable channels as well ), and very efficently. Heres just one example.. ( http://www.national.com/pf/LM/LM2756.html ).. that woudl be easy to interface to a PIC micro, and you coudl dim up to eight channels as well.
Nice chip. More to learn. If the renard or pixel program could be modified to output the SPI protocol (I know the PIC16F688 does not support SPI but lots of others do.) the MAX6969 starts to look real good for low power LEDs and they can be ordered direct from Maxim.
Ok have a look at http://www.instructables.com/id/Circuits-for-using-High-Power-LED_s/
step #8 photo 2 for circuit diagram for computer controlled.
parts list and explanation are in step #6
Its only a power NFET and a small NPN transistor and two resistors for a constant current circuit.
Would you use it to drive high power LEDs?
Still learning all this stuff.
Three years ago I had never picked up a Soldering iron or programmed a PIC.
JOel
The best thing about this sort of thread is that lots of us are learning stuff (and having to think about it)! Keep going!!!
Tim
mrpackethead
10-09-2008, 04:08 AM
The instructables circuit is a pretty text book circuit.. And its a good one to learn about how and why it works..
Woudl i use it to drive high power LEDs.. No.. Theres other ways of doing this as well.. For only a fraction more cost, you can make much more efficent Switching Supply's, however this circuit is ncie because its simple to understand and a valuable buiding block for many other
Basically what happens is when the voltage drop across R3 > 0.7V, Transistor Q1 turns on, and pulls the input to the FET (Q2) low, turning it off.. The voltage then drops across R3 to below 0.7V and the fet turns on again.. Because we know what voltage will drop across the resistor we can set the value to pick the right current.
A more modern way is to use something like a LM3404 or simlar.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.