# how to switch a LM317 voltage regulator / LED on and off?

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.

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.

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

Do you know of a similar regulator that does?

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

What common transistor would you recommend?

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.

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?

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.

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!

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.

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.

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

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.

Erni: 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).

davivid: 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.

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.

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).

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.

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?

Yes, that's the correct behavior.

another thing I've noticed with this new circuit is its drawing slightly more current 0.72A as opposed to 0.69A. Do I need to adjust it? or does the new circuit draw more current to operate. This project calls for high reliability, so I really cant strain/damage the LED's (Typ IF=700mA) .

That’s the 4% I was talking about and is the expected amount. You can increase the 1.8 ohm resistor to 2.0 and increase the 1K to 2.7K which will drop current back down to about 693ma, or just reduce the 1K to 270 which should put it right at around 703ma.

Where the 1.8 ohm is RL and the 1K is RAdj the formula becomes: