# Arduino Forum

## Using Arduino => General Electronics => Topic started by: rogy56 on May 24, 2011, 06:51 pm

Title: LM317 Help
Post by: rogy56 on May 24, 2011, 06:51 pm
Hello again :)

I will be making an Arduino fan controller which will regulate the voltage on the fan with the help of the LM317 Voltage Regulator, now I have made a schematic and I have a question:

The input voltage will be 12V from a PC PSU, will the LM317 be able to give 12V output?

(http://img821.imageshack.us/img821/3627/schematicv10.png)

Title: Re: LM317 Help
Post by: Grumpy_Mike on May 24, 2011, 06:58 pm
Quote
The input voltage will be 12V from a PC PSU, will the LM317 be able to give 12V output?

No.

You need a voltage greater than 12V say 14V to get 12V out. Also you have no input or output capacitors and have you allowed for the Vssat voltage between collector and emitter when the transistor is on?
You also need resistors in the base of the transistors to limit current flow.
Title: Re: LM317 Help
Post by: retrolefty on May 24, 2011, 07:00 pm
Quote
The input voltage will be 12V from a PC PSU, will the LM317 be able to give 12V output?

No, the chip has a regulator drop out voltage specification. It's dependent on how much current is being drawn from the regulator and is about 2 volts at 1 amp drop, so plan on around a 10vdc max output for the regulator if being supplied with +12vdc.

Also be sure to add series current limiting resistors going to the base of those switching transistors.

Lefty

Title: Re: LM317 Help
Post by: rogy56 on May 24, 2011, 07:05 pm
Thanks for the replies guys ^_^

Any idea on how I would get more than 12V with a PC PSU?
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 24, 2011, 07:09 pm
Quote
I will be making an Arduino fan controller which will regulate the voltage on the fan

I am assuming the fan is 12V, the simple answer is not to use a regulator circuit like this but to use a FET driver in the continuous (non switched) mode.
Title: Re: LM317 Help
Post by: AWOL on May 24, 2011, 07:14 pm
Quote
Any idea on how I would get more than 12V with a PC PSU?

I assume PC supplies still have -12V outputs.
-12 to +12 is 24 volts.
Title: Re: LM317 Help
Post by: retrolefty on May 24, 2011, 07:23 pm

Quote
Any idea on how I would get more than 12V with a PC PSU?

I assume PC supplies still have -12V outputs.
-12 to +12 is 24 volts.

Not really usable that way in a common grounded system.

Lefty
Title: Re: LM317 Help
Post by: AWOL on May 24, 2011, 07:26 pm
Depends what you declare "ground" to be.
Title: Re: LM317 Help
Post by: retrolefty on May 24, 2011, 07:29 pm

Depends what you declare "ground" to be.

Correct, we would need to know if he is using the PC supply for any other loads, or desires to.

Lefty
Title: Re: LM317 Help
Post by: rogy56 on May 24, 2011, 07:48 pm
I'll be using the same PSU for: Pumps (Water Cooling), Micro Controllers, Fans
Title: Re: LM317 Help
Post by: TerryKing on May 24, 2011, 09:25 pm
Mike has the best solution; use a single power FET and control it with a PWM output from Arduino.  And it (could) handle a lot more current than an LM317T.

Nothing against the LM317T. I once bought a barrel of 14,000 of them for \$55 from a junkyard near IBM  :) I'll send 5 to anyone who'll send a SASE... I still have about 500 left.
---------------------------------------------------------------------
UPDATE: Sorry! I'm always criticizing Acronyms...

Self-Addressed-Stamped-Envelope    (sent to me, will return 5 LM317t's..)

Terry King
West Topsham, VT 05086

But: 3 weeks till I get there from the Middle East...

Title: Re: LM317 Help
Post by: rogy56 on May 25, 2011, 03:10 pm
Can you give me more info on using FET's with Arduino? Schematic(s), Maybe even some example code  ;)
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 25, 2011, 03:48 pm
Quote
Maybe even some example code

analogWrite(pin, value);

Quote
Schematic(s)

use the PWM output filtered and into the gate
http://www.thebox.myzen.co.uk/Tutorial/PWM.html (http://www.thebox.myzen.co.uk/Tutorial/PWM.html)
Title: Re: LM317 Help
Post by: rogy56 on May 25, 2011, 04:21 pm
So I use Frequency dependent potential divider with low pass filter connected to a FET, and the divider is hooked up to Arduino PWM output pin? And if so, which FET should I use?
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 25, 2011, 06:43 pm
Quote
Frequency dependent potential divider with low pass filter

close:-
Frequency dependent potential divider AS low pass filter.

Quote
which FET should I use?

Any one that will take at least 200mA (most will) and is a logic level FET.
The FET will get hot because you are burning the excess voltage off inside it when it is not full on. The power dissipated will be with half the voltage dropped across it at what ever current the motor runs with only half the voltage across it. You might need a heat sink.
Title: Re: LM317 Help
Post by: rogy56 on May 25, 2011, 07:48 pm
@Grumpy_Mike

Thanks! :D

I hope I'm not too annoying with all these questions :P, maybe something like this? http://www.nteinc.com/specs/2900to2999/pdf/nte2987.pdf

Could you also tell me what exactly am I look for? N-Channel MOSFETS?
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 25, 2011, 08:11 pm
Quote
maybe something like this?

Yes very meaty, that would do.
Title: Re: LM317 Help
Post by: rogy56 on May 25, 2011, 08:42 pm
Alright! :)

Now, if only I could find that in Eagle :P
Title: Re: LM317 Help
Post by: retrolefty on May 25, 2011, 09:58 pm

@Grumpy_Mike

Thanks! :D

I hope I'm not too annoying with all these questions :P, maybe something like this? http://www.nteinc.com/specs/2900to2999/pdf/nte2987.pdf

Could you also tell me what exactly am I look for? N-Channel MOSFETS?

Mouser shows that at \$7 a pop: http://www.mouser.com/ProductDetail/NTE/NTE2987/?qs=sGAEpiMZZMutXGli8Ay4kFfMPLZ9xW8yKOlRS6m%252bwN0%3D

Sparkfun sells a logic level N-channel power mosfet for a buck: http://www.sparkfun.com/products/10213

Lefty
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 25, 2011, 10:19 pm
I said it was meaty.  :)
Title: Re: LM317 Help
Post by: rogy56 on May 26, 2011, 11:12 am
I found something a bit cheaper than the previous I linked and am not sure if it will work...

http://eu.mouser.com/ProductDetail/Fairchild-Semiconductor/FDP6030BL/?qs=sGAEpiMZZMutXGli8Ay4kBEMMAKgSkd8MdwkNnQ%2fGU8%3d
Title: Re: LM317 Help
Post by: TerryKing on May 26, 2011, 11:36 am
Hi,

Speaking Of FETS... I would like to decide best 2 or 4 power NFET and PFET to stock for use with Arduino...

Two that have been suggested are:

RFP30N06LE "N-Channel Logic Level Gate Power FET"
FQP27P06 "P-Channel Power FET"

Also maybe a good TO92 or similar small Logic-Gate NFET for cheap routine replacement of small NPNs like 2N2222 ??

What has been working well for you???

I'll make these available at a decent price in my online store...

Thanks!
Title: Re: LM317 Help
Post by: rogy56 on May 26, 2011, 01:12 pm
Can anyone tell me what I must pay attention to when choosing a FET for using it to regulate voltage with Arduino?
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 26, 2011, 05:46 pm
Turn on voltage, it should be rated at 5V and have a low Ron at this value. At most 0.01R.
It should be in a package that allows good power dissipation because as I said it will burn off the excess power.
Title: Re: LM317 Help
Post by: rogy56 on May 26, 2011, 06:48 pm
@Grumpy_Mike

So: N-Channel FET, TO-220, 5V Turn on voltage, low on resistance, low resistance drain-to-source, and of course, drain source voltage high enough and same for current ?
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 27, 2011, 01:36 am
Yes.
Quote
drain source voltage high enough and same for current

You will struggle to find one that is not high enough.
Title: Re: LM317 Help
Post by: rogy56 on May 27, 2011, 11:57 am
I think I found something that will fit my needs: http://eu.mouser.com/ProductDetail/Fairchild-Semiconductor/FDP7030BL/?qs=sGAEpiMZZMvECErq9cesgOhjwE8m5zTM4sOaJqrLpIU%3d

Now for the (hopefully) last question: How do I connect everything? :P

Something like this?

12V
|
|Source pin
|
|Digital Pin 9|----|Resistor|----|Capacitor|--Gate--|MOSFET|
|
|Drain pin
|
|
|
|
GND
Title: Re: LM317 Help
Post by: justjed on May 28, 2011, 01:11 am

Nothing against the LM317T. I once bought a barrel of 14,000 of them for \$55 from a junkyard near IBM  :) I'll send 5 to anyone who'll send a SASE... I still have about 500 left.

Cool! Would 2 "forever" stamps be sufficient postage? Maybe 3 to be sure, eh?

Thanks, Terry.
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 28, 2011, 07:46 pm
No like this

12V
|
|Drain pin
|
|Digital Pin 9|----|Resistor|-------------Gate--|MOSFET|
|                     |
|Capacitor|            |Source pin
|                     |
|                     |
|                     |
|                     |
|                     |
GND                GND

1) the capacitor would block the DC signal and nothing would get too the gate
2) you would not get any more than 5V across your fan
Title: Re: LM317 Help
Post by: rogy56 on May 28, 2011, 08:06 pm
Thank you! :D
Title: Re: LM317 Help
Post by: tastewar on May 29, 2011, 03:42 am

Cool! Would 2 "forever" stamps be sufficient postage? Maybe 3 to be sure, eh?

Under Terry's name it says "Red Sea/Saudi Arabia" so my guess would be "no."
Title: Re: LM317 Help
Post by: rogy56 on May 29, 2011, 01:39 pm
For the divider I'm not sure if 1k resistor and a 18uF capacitor will suit my needs...

For the fan control I will be regulating 12V, the voltages which will be "available" for the fans are: 7V, 8V, 9V, 10V, 11V, 12V and will be changed as the temperature of the CPU Changes. I'm expecting the voltage change to occur no higher than 2x a second.
Title: Re: LM317 Help
Post by: Grumpy_Mike on May 30, 2011, 11:33 pm
Quote
For the divider I'm not sure if 1k resistor and a 18uF capacitor will suit my needs...

I am not sure where you got these values from. An 18uF capacitor is very non standard, 10uF , 16uF and 22uF are the closest values.
However, it is not very critical as it is only a second order filter and the slope here is not steep.

You will have to experiment as to what PWM values you have to get to give those voltages to the fan. This is because you are relying on the non saturated part of the curve and it is not consistent from device to device.
Title: Re: LM317 Help
Post by: rogy56 on Jun 01, 2011, 08:59 pm
I'm currently "worried" so to say about the divider.

Will it allow me to change the voltage 2x a second?
Title: Re: LM317 Help
Post by: Grumpy_Mike on Jun 01, 2011, 10:36 pm
1K and 18uF is a time constant of :-
1 103 X 18 10-6 = 0.018 seconds
So yes it will not hamper a signal at 0.5 seconds period.
Title: Re: LM317 Help
Post by: rogy56 on Jul 08, 2011, 01:17 pm
Ok, so I finnaly got my hands on all the parts I need, but there's a problem... It's not working :(

When I tap the FET the fan starts spinning and if I don't do that nothing happens...

I'm guessing that the FET is damaged, but am not sure...

What do you think?
Title: Re: LM317 Help
Post by: floresta on Jul 08, 2011, 03:40 pm
Quote
Under Terry's name it says "Red Sea/Saudi Arabia" so my guess would be "no."

I believe that Terry also has a residence in Vermont.

Don
Title: Re: LM317 Help
Post by: justjed on Jul 09, 2011, 12:42 am

Quote
Under Terry's name it says "Red Sea/Saudi Arabia" so my guess would be "no."

I believe that Terry also has a residence in Vermont.

And, in fact, he's there now. Having some trouble with the forum though.
http://arduino.cc/forum/index.php/topic,65627.msg480338.html#msg480338
Title: Re: LM317 Help
Post by: paulorcrs on Aug 30, 2013, 12:02 am

No like this

12V
|
|Drain pin
|
|Digital Pin 9|----|Resistor|-------------Gate--|MOSFET|
|                     |
|Capacitor|            |Source pin
|                     |
|                     |
|                     |
|                     |
|                     |
GND                GND