Go Down

Topic: how to switch a LM317 voltage regulator / LED on and off? (Read 7048 times) previous topic - next topic

davivid

So I'm planning to use a LM317 regulator to provide a constant current supply to a high power LED (3.8v 700mA) from a 12v supply, by using an adjustment resistor of 1.8ohms (if my understanding is correct?).

What would be the best way of then turning this LED on and off, I don't require dimming.

thanks.

CrossRoads

Use a regulator with an enable pin. The LM317 doesn't have one.
Or put a transistor in front of the LM317 to cut off the 12V.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

davivid


Use a regulator with an enable pin. The LM317 doesn't have one.

Do you know of a similar regulator that does?

Quote

Or put a transistor in front of the LM317 to cut off the 12V.

What common transistor would you recommend?

CrossRoads

P-channel MOSFET, or PNP transistor.
Gate/base needs to swing up to 12V, so need an open collector NPN that the Arduino can control.
So something like this, with the LM317 wired up to suit your needs.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

davivid

Thanks for the example! I made up a quick circuit before I saw your reply which seems to function correctly - can you please tell me what issues it has, that should be addressed?

CrossRoads

That would work I guess, if that's the wiring for the LM317 as a constant current source.
What sets the LM317 for the votlage you started asking about?

Put a resistor, 180 ohm or so, between the arduino pin and the transistor base, to limit the current from the arduino pin.
(5V - 0.7V)/.035 = resistor value, usig 0.7v as Vbe, adjust that for the BD237's actual Vbe.


Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

davivid

Yeah as I understand it, I just want the LM317 as a constant current source to limit the LED at 700mA and I think that's how to wire it.

1.25 (the constant reference voltage of the LM317) divided by 0.700 (the LEDs power consumption) = 1.785. Therefore 1.8ohms sets the LM317 at 700mA, independent of the supply voltage, and I hope that's enough to protect the LED.

Thanks for the tip to limit the arduino current!


BillO

Have a look at the attached schematic.  This uses just a cheap 2N3094 and is overall a better way to do this.  The caps are there for stability and transient response.
Facts just don't care if you ignore them.

davivid

#8
Apr 21, 2012, 10:58 am Last Edit: Apr 21, 2012, 11:48 am by davivid Reason: 1
Is this better because your not running the high the current through the transistor, and therefore can use a cheaper cooler running component? I am interested in knowing the reasons for the design. Unfortunately I am unable to test until Monday, when I can get hold of the additional parts.

Also I am confused about which part sets the the LM317 - I thought it was a resistor 1.8, between ADJ and OUT, but here its quite different!

thanks.

Erni

davivid I think Your wiring is a bit wrong, it should be like this.


MarkT

And don't forget the heatsinking for the LM317, it'll draw about 5.5W and the 1.8 ohm resistor will dissipate 0.9W remember.
[ I won't respond to messages, use the forum please ]

davivid


davivid I think Your wiring is a bit wrong, it should be like this.

Thanks Erni, I have now amended my circuit.



Cheers MarkT, Yeah I should really do that. I have however decided this project will run of 7.5v, and so far the LM317 doesn't overheat / start shutting down like it did before (still gets v.hot tho).

BillO

#12
Apr 21, 2012, 03:52 pm Last Edit: Apr 21, 2012, 05:30 pm by BillO Reason: 1

Is this better because your not running the high the current through the transistor, and therefore can use a cheaper cooler running component?  


Yes, that is the main reason from an endpoint perspective.  In fact, a 2N3904 is even overkill with respect to specifications, but it is probably the cheapest transistor in the world.

Quote
I am interested in knowing the reasons for the design.

Using the adjust pin is how the design engineers intended the device to be controlled.  The device already has the ability to do the 'heavy lifting' by design, so why add a big, hot transistor to it to get the job done.

Quote
Unfortunately I am unable to test until Monday, when I can get hold of the additional parts.


From a total parts perspective, it really is only one additional resistor (the 1K).  The caps should be there in your circuit as well.  (well, in the corrected one suggested by Erni).

Quote
Also I am confused about which part sets the the LM317 - I thought it was a resistor 1.8, between ADJ and OUT, but here its quite different!


Not really.  It is still the 1.8 ohm resistor that sets 96% of the 1.25V control voltage.  Because the adjust input has a very high impedance, the 1K resistor (which is there to limit current through the transistor) has negligible effect.  The current through the adjust pin is only about 50uA.  So, doing the math, it introduces a -4% error in output current which is well below the tolerance of the rest of the circuit.
Facts just don't care if you ignore them.

davivid

Thanks for your detailed response BillO.

I have created the circuit and its working great. However setting the Control line LOW, turns the LED on? I expected the opposite behaviour, is this correct?


BillO

Facts just don't care if you ignore them.

Go Up