Pages: [1] 2   Go Down
Author Topic: how to switch a LM317 voltage regulator / LED on and off?  (Read 6514 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27372
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27372
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* LM317_control.jpg (18.42 KB, 960x720 - viewed 489 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?


* circuit.JPG (17.15 KB, 396x444 - viewed 362 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27372
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* LED supply.jpg (82.25 KB, 1620x968 - viewed 534 times.)
Logged

Facts just don't care if you ignore them.

Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: April 21, 2012, 04:48:43 am by davivid » Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1086
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* lm317.jpg (14.9 KB, 363x425 - viewed 297 times.)
Logged

0
Offline Offline
Shannon Member
****
Karma: 216
Posts: 12525
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: April 21, 2012, 10:30:57 am by BillO » Logged

Facts just don't care if you ignore them.

Offline Offline
Full Member
***
Karma: 0
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that's the correct behavior.
Logged

Facts just don't care if you ignore them.

Pages: [1] 2   Go Up
Jump to: