Author Topic: Question about pot in LM317 circuit  (Read 11556 times)

0 Members and 1 Guest are viewing this topic.

Offline OilsFanTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: us
Question about pot in LM317 circuit
« on: January 22, 2016, 10:25:59 am »
So I've built up this basic LM317 circuit to drive three LED's. I want to be able to dim them with a pot so I have used a 2K Linear pot on the adjust. It all works fine BUT the LED's go from off to full bright in the first half turn of the pot. How do you make the range of the pot more useful? As in I want the LED's to be their dimmest when the pot is all the way to the left and not achieve their full brightness till the pot is turned all the way right. If you see what I mean. Is it a function of the pot value or should I try a different taper? Thanks

 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3020
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Question about pot in LM317 circuit
« Reply #1 on: January 22, 2016, 10:37:36 am »
You could try putting a resistor either above or below the pot in series or parallel (probably this) wih the pot (which is configured as a variable resistor).  Experiment with values, 1/2 the value of the pot maybe.

But know that human vision isn't linear, you might have more luck with an audio-taper pot.
« Last Edit: January 22, 2016, 10:40:02 am by sleemanj »
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline bookaboo

  • Frequent Contributor
  • **
  • Posts: 725
  • Country: ie
Re: Question about pot in LM317 circuit
« Reply #2 on: January 22, 2016, 11:44:57 am »
Perhaps use a logarithmic pot? 
 

Offline MrSlack

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: gb
Re: Question about pot in LM317 circuit
« Reply #3 on: January 22, 2016, 11:50:37 am »
Set the LM317 up as a current source rather than a voltage source. LEDs need variable current, not variable voltage to control brightness. See LM317 datasheet on how to do this.

Info here on the idea: http://www.ae5d.com/led-1.html

Note lack of series resistors if you're using a current source. A series resistor is a basically a bad current source. An LM317 is a better one!

Your circuit is a voltage source (the LM317) and one current source per LED. You can just use the LM317 to do both.
« Last Edit: January 22, 2016, 11:54:15 am by MrSlack »
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3233
  • Country: gb
Re: Question about pot in LM317 circuit
« Reply #4 on: January 22, 2016, 11:59:34 am »
What voltage are you applying at J1?  With a 2kpot and R1=220 ohms, you will get a maximum of 1.25*(1+2000/220) = 12.6 volts at the LM317T output, but only if the input voltage is high enough (i.e. 12.6v plus about 2v dropout for the regulator).

If the input voltage is lower than this, then it would explain why the brightness stops increasing halfway through the pots range.  You need to set the total resistance of the potentiometer so that when set to maximum resistance the LM317T is still in regulation.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Question about pot in LM317 circuit
« Reply #5 on: January 22, 2016, 12:05:59 pm »
What's the supply voltage?

Using the LM317 as a current source is a good idea but it costs an extra 1.25V in voltage drop.

The output voltage of the LM317 needs to vary from just below the minimum forward voltage to one which will drive the LEDs at a current which will give the required voltage.

Plenty of web based calculators can be found for bother the LED resistor and LM317.

 

Offline Chalcogenide

  • Regular Contributor
  • *
  • Posts: 156
  • Country: it
Re: Question about pot in LM317 circuit
« Reply #6 on: January 22, 2016, 12:08:32 pm »
If you set up the LM317 as a current source I would still put a small (maybe 1/10th of what you are using now) series resistor with each LED to avoid current mismatch between the LEDs. Depending on the voltage supply you may also be able to wire the LEDs in series and reduce the power dissipation on the regulator (for blue LEDs, 3.5V each +2.5V for the LM317 = 13V min).
You won't be able to completely turn the LEDs off unless you also add a shunt resistor from regulator to ground that allow the quiescent current of the regulator to flow allowing the voltage across the LEDs to be lower than the forward voltage. In case or the 3 LEDs in parallel, a 10k should do the job, for the LEDs in series you can probably increase it to 47k, but you should experiment.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Question about pot in LM317 circuit
« Reply #7 on: January 22, 2016, 12:37:38 pm »
You might be better off with a 555 timer based PWM circuit. e.g.:

Use a CMOS 555, and don't exceed 80% of the max discharge pin rating (typically 100mA).  Therefore if you need to drive more or higher current LEDs, use an external N channel MOSFET, with its gate driven from OUT, source to ground and drain sinking the LED current.   You may find the duty cycle cant go low enough to totally extinguish the LEDs.  Unfortunately that's the price of simplicity.


« Last Edit: January 22, 2016, 12:54:38 pm by Ian.M »
 

Offline bookaboo

  • Frequent Contributor
  • **
  • Posts: 725
  • Country: ie
Re: Question about pot in LM317 circuit
« Reply #8 on: January 22, 2016, 05:05:27 pm »
Yes Ian's right, some sort of PWM will be much more efficient than a 317.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Question about pot in LM317 circuit
« Reply #9 on: January 22, 2016, 08:47:26 pm »
Yes Ian's right, some sort of PWM will be much more efficient than a 317.
PWM may be more convenient but it's certainly not more efficient than simply adjusting the current. If anything, reducing the current is the most efficient way to dim an LED because the efficiency of LEDs is higher at lower currents.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #10 on: January 22, 2016, 09:01:31 pm »
The voltage output is changing completely linearly, the way it is. You didn't specify what kind of LEDs you are using.

Typical indicator LEDs get pretty bright from a mA up to about full brightness at 5-10mA. After that you can run as much current as you want and you're just shortening the life. They won't get much brighter. So everything important to your eye is going to happen between around 3-5 Volt.

Before you go tearing down your circuit and trying pwm or current limiting, first you could try this:

Goal:
Make the entire range of the pot move the voltage from 2.5V to 4.5-5V, rather than 1.25V to 12V.

Halfass: change R1 to 1k or so. Add a 1k resistor in series with the 2k pot. The brightness will still not be linear and it never will be, even with a log a rith mic (I can't spell) pot (which would help). But this will increase the brightness resolution of the pot, for starters. All the really big changes happen at the knee of the resistor, where the supply voltage passes the VFD of the LED, which is probably around 3V. So you want to progressively hone in on this area. (And when you get there, you can reduce the series resistors of your LED, even).

I agree that PMW will be "more efficient" in the sense that it will be most linear to the human eye, regarding brightness. (It will not be more power efficient; but that is obviously not the goal for your circuit - I hope.) But with what you already have, you can still try this something simple.

Once you have tuned the resistor ladder optimally, you will see how well supply voltage adjustment can control LED brightness. You can probably improve, as said, with PWM. Current limiting won't be all that much better, and may be pretty similar, in fact. But you can't really compare until you use a voltage adjust circuit that is reasonably decent.

Even the PWM circuit won't be linear as far as the eye is concerned. The big changes will happen in the lower half of the duty cycle, and near full duty cycle you won't see much difference. In fact, I think the best would be PWM with a logarithmic* pot.

*wherever I say logarithmic pot, I may actually mean an anti/reverse-logarhithmic pot. For a PWM circuit like Ian posted, it doesn't matter. If you get the wrong one, just reverse the logic of the output with a transistor. Or even more simple, just power the LED from the other leg.
« Last Edit: January 22, 2016, 09:47:45 pm by KL27x »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Question about pot in LM317 circuit
« Reply #11 on: January 22, 2016, 09:14:22 pm »
I *NEVER* claimed that PWM would be more efficient for this case.  However if you can rearrange the LEDs to put them in series, with a single current limiting resistor recalculated for 3*Vf , the efficiency of either the PWM or a modified LM317 dimmer can be improved by a factor of three.  For the series LEDs, I.d stick a 6.8V Zener between the pot and ground to lift the minimum output voltage of the regulator to about 9V to better match the LED If vs Vf curve.  Of course that does mean you need a 15V or so supply to have enough headroom for the LM317 to regulate.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #12 on: January 22, 2016, 09:19:17 pm »
I know. I'm just adding for clarity of the OP, because of bookaboo's comment and the subsequent reply.
 

Offline OilsFanTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #13 on: January 22, 2016, 09:20:23 pm »
Wow thanks guys lots of great information here!

To answer some questions input voltage is 9v. LEDs are water clear super bright blue. I want them bright enough to be seen out doors but then dimmable when you use the device indoors. I did investigate running the LM317 in constant current configuration but that seems to be only good for driving LED's in series and what is not shown here is that those LED's will actually be switched in and out of circuit as indicators for various switches. I don't see how I could use constant current that way but this is the beginners forum!

I actually like the PWM idea a lot but this device I am working on is an audio switching circuit and I'm afraid any PWM frequency within the human hearing range is going to cause noise in the audio line. What are your thoughts on that? I would post my full schematic but I haven't gotten around to drawing it all in Diptrace yet. Still learning that too.

BTW the device is a 1 input switcher to route an audio signal to one of three outputs and uses a some optos to prevent switching noise.
« Last Edit: January 22, 2016, 09:29:17 pm by OilsFan »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Question about pot in LM317 circuit
« Reply #14 on: January 22, 2016, 09:46:33 pm »
Its always the requirements you *DON'T* tell us about that cause the problems.  To avoid audio frequency noise, use your 2K pot and reduce C1 to 22nF and you should be able to push the PWM frequency up to between about 23KHz and 27KHz, depending on the duty cycle (highest at 50%, lowest at 0% and 100%).  If that's not good enough, try 15nF, and yes, the CMOS 555 PWM circuit will run from 9V. 

The only other potential problem is if the 9V supply has a lot of ripple as that could modulate the EMI radiated by the PWM circuit if its poorly laid out and/or poorly screened and if the EMI is rectified picked up on a high gain input circuit (e.g. a mic input) and rectified in a b-e junction in the preamp, you could get hum breakthrough on the audio.

Why not breadboard it and see?   

N.B. *DON'T* use a bipolar 555 like the original NE555 as they suffer from severe shoot-through and the resulting large current spikes are likely to cause massive amounts of EMI.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #15 on: January 22, 2016, 09:50:46 pm »
The really big advantage of PWM is that you can throw the brightness/current graph and the FVD:current graph, and the FVD:temperature graphs of the particular LED out the window. The PWM will control the amount of lumens very linearly. (But the human eye sees brightness logrhytmically, so add the right pot, and bob's your uncle.)

But for your purposes, I am sure you can use voltage control and it will work quite satisfactorily, as long as all your LEDs are the same. As I said, try decreasing the range of your pot, so the full movement changes voltage just a little bit around the FVD of the LEDs.

If you want to have different color LEDs, voltage control won't work very well, at all.

Now that we know what you are doing, I would suggest you aim for the pot to change voltage from FVD-0.1V to FVD+0.5V and change your current limiting resistors to 50 ohms, using the formula that was posted to calculate your resistor ladder. The equation will be in the LM317 datasheet. V = R2/R1 +1.25V, or something like that.

For a 2k pot, you would be looking at R1 of about ~ 4K and the series resistor with the pot around 7k. This would put R1 way higher than suggested (but it would still probably work just fine). It would be technically better (as in the voltage regulator output being more stable) if your pot was say in the 200R-500R range. But to drive a stable load like LEDs you probably wouldn't be able to tell the difference without an oscilloscope.
« Last Edit: January 22, 2016, 10:29:44 pm by KL27x »
 

Offline OilsFanTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #16 on: January 22, 2016, 10:25:47 pm »
Its always the requirements you *DON'T* tell us about that cause the problems.  To avoid audio frequency noise, use your 2K pot and reduce C1 to 22nF and you should be able to push the PWM frequency up to between about 23KHz and 27KHz, depending on the duty cycle (highest at 50%, lowest at 0% and 100%).  If that's not good enough, try 15nF, and yes, the CMOS 555 PWM circuit will run from 9V. 

The only other potential problem is if the 9V supply has a lot of ripple as that could modulate the EMI radiated by the PWM circuit if its poorly laid out and/or poorly screened and if the EMI is rectified picked up on a high gain input circuit (e.g. a mic input) and rectified in a b-e junction in the preamp, you could get hum breakthrough on the audio.

Why not breadboard it and see?   

N.B. *DON'T* use a bipolar 555 like the original NE555 as they suffer from severe shoot-through and the resulting large current spikes are likely to cause massive amounts of EMI.

Thank you. Looks like my local electronics place has CMOS 555 timers in stock. I will get some and try this out. Look forward to it.

The really big advantage of PWM is that you can throw the brightness/current graph and the FVD:current graph, and the FVD:temperature graphs of the particular LED out the window. The PWM will control the amount of lumens very linearly. (But the human eye sees brightness logrhytmically, so add the right pot, and bob's your uncle.)

But for your purposes, I am sure you can use voltage control and it will work quite satisfactorily, as long as all your LEDs are the same. As I said, try decreasing the range of your pot, so the full movement changes voltage just a little bit around the FVD of the LEDs.

If you want to have different color LEDs, voltage control won't work very well, at all.

Now that we know what you are doing, I would suggest you aim for the pot to change voltage from FVD-0.1V to FVD+0.5V and change your current limiting resistors to 50 ohms, using the formula that was posted to calculate your resistor ladder. The equation will be in the LM317 datasheet. V = R2/R1 +1.25V, or something like that.

I will investigate this option too. Thank you so much for the information. You guys have given me lots of information to play with.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #17 on: January 22, 2016, 10:48:28 pm »
BTW, forget what the current rating says in the LM317 datasheet. If Vin is 9V and Vout is 3V, you can derate that by a factor of ten, at least. E.g. don't expect to drive much more than a few LEDs with long term reliability. So unless you fancy opening the box and fixing it later, take precaution. 

If you can find the wattage dissipation for the device, use that, instead. Take your current draw in amps and multiply by 6V to get the heat production in watts. I would derate the max dissipation at least a few quadzillion fold, without a heatsink and/or a fan.

A series resistor on the input of the device can dissipate some of that heat, taking that burden off the IC.

The problem with these regulators is they don't die in a poof of smoke, right away. If they are overdriven, they will die 3-4 years later. A Dpak lm317 can't sustain a measly 15mA output with 15V differential, long term. A non heatsinked TO220 can't sustain 200mA with 15V differential. And you won't know it until several years have passed. At 6V differential, I would think you can drive 3 LEDs with a Dpak. I wouldn't even trust a TO92 to drive 1 LED with 6V differential. But then again, when I started out, I bought a lot of these types of ICs off eBay.
« Last Edit: January 22, 2016, 11:26:34 pm by KL27x »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Question about pot in LM317 circuit
« Reply #18 on: January 22, 2016, 11:00:48 pm »
The problem with the LM317 is it will drop 2V to 3V which doesn't leave much room for the LEDs.

Is it a regulated 9V supply or just a small battery?

PWM is probably the best way to go. The CD40106 or 74C14 could be used to make a PWM circuit with the other gates acting as buffers to drive the LEDs.


https://www.fairchildsemi.com/datasheets/CD/CD40106BC.pdf
https://www.fairchildsemi.com/datasheets/MM/MM74C14.pdf
« Last Edit: January 22, 2016, 11:05:34 pm by Hero999 »
 

Offline rdl

  • Super Contributor
  • ***
  • Posts: 3665
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #19 on: January 23, 2016, 02:39:18 am »
Why not just set the range of the LM317 so the low end is near the forward voltage of the LED and the high end is just below the voltage where the LED approaches its maximum current rating? All that's needed is the data sheet and a multimeter. Wouldn't fix any nonlinear brightness changes though.
 

Online edavid

  • Super Contributor
  • ***
  • Posts: 3381
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #20 on: January 23, 2016, 06:46:28 am »
So I've built up this basic LM317 circuit to drive three LED's. I want to be able to dim them with a pot so I have used a 2K Linear pot on the adjust. It all works fine BUT the LED's go from off to full bright in the first half turn of the pot. How do you make the range of the pot more useful? As in I want the LED's to be their dimmest when the pot is all the way to the left and not achieve their full brightness till the pot is turned all the way right. If you see what I mean. Is it a function of the pot value or should I try a different taper?

Your 2K pot value is too high.

Typical indicator LEDs get pretty bright from a mA up to about full brightness at 5-10mA. After that you can run as much current as you want and you're just shortening the life. They won't get much brighter.

This is not correct.  Modern LEDs don't saturate... brightness is proportional to current, up to the maximum.

N.B. *DON'T* use a bipolar 555 like the original NE555 as they suffer from severe shoot-through and the resulting large current spikes are likely to cause massive amounts of EMI.

In reality, it's not a big deal.  If you add a 100-220uF bypass cap, you won't have any problems with a bipolar 555.

The problem with these regulators is they don't die in a poof of smoke, right away. If they are overdriven, they will die 3-4 years later.

Also not correct.  They have built in thermal and safe area protection, so you can overload them indefinitely.  (But if you're worried, just use a TO220 package.)
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: Question about pot in LM317 circuit
« Reply #21 on: January 23, 2016, 08:27:54 am »
Quote
Also not correct.  They have built in thermal and safe area protection, so you can overload them indefinitely.  (But if you're worried, just use a TO220 package.)
Burned out LM7805 and LM317 comprise 75% of the component replacement repairs I have had to make on my own DIY circuits. Worked fine for several years, never a thermal shutdown... then kaput. They say ST (or LT? Something well-known) on them, but maybe they are fake.

Anyways, the good part of that is I have learned how to use series resistors with linear regulators where you want to drop a lot of V's.... just figure the max current of your load and use the biggest value resistor that will drop the excess voltage. If the regulator draws more current than you allowed for, the voltage will sag. But if you calculate wrong and get power errors, at least you can find that out today, rather than waiting 3+ years.
« Last Edit: January 23, 2016, 08:42:04 am by KL27x »
 

Offline MrSlack

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: gb
Re: Question about pot in LM317 circuit
« Reply #22 on: January 23, 2016, 08:31:33 am »
Genuine ones are very hard to break. You need a heatsink though or all bets are off.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Question about pot in LM317 circuit
« Reply #23 on: January 23, 2016, 10:04:23 am »
N.B. *DON'T* use a bipolar 555 like the original NE555 as they suffer from severe shoot-through and the resulting large current spikes are likely to cause massive amounts of EMI.
In reality, it's not a big deal.  If you add a 100-220uF bypass cap, you won't have any problems with a bipolar 555.
One may be able to mitigate the effects of NE555 shoot-through with *enough* local decoupling, but its still undesirable.  Furthermore 555 circuits that take the feedback from the Output instead of the Discharge pin, without a pullup resistor for the timing, work far better with a CMOS 555, as its output is close to being symmetrical rail to rail but the original NE555 Output cant get very close to its +ve rail, which distorts the duty cycle of what should be a 50% duty cycle squarewave if no steering diodes are used.

Also good quality 220uF 25V caps usually cost more than you are likely to save (if any) by speccing a bipolar 555.  The economics may differ if using no-name far east parts, but I prefer not to go there.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: Question about pot in LM317 circuit
« Reply #24 on: January 23, 2016, 02:29:12 pm »
Quote
Also not correct.  They have built in thermal and safe area protection, so you can overload them indefinitely.  (But if you're worried, just use a TO220 package.)
Burned out LM7805 and LM317 comprise 75% of the component replacement repairs I have had to make on my own DIY circuits. Worked fine for several years, never a thermal shutdown... then kaput. They say ST (or LT? Something well-known) on them, but maybe they are fake.

Anyways, the good part of that is I have learned how to use series resistors with linear regulators where you want to drop a lot of V's.... just figure the max current of your load and use the biggest value resistor that will drop the excess voltage. If the regulator draws more current than you allowed for, the voltage will sag. But if you calculate wrong and get power errors, at least you can find that out today, rather than waiting 3+ years.
I've had problems with LM317s blowing before too.

It was on a battery charger regulator connected to some solar panels on a shed roof. I think it was most likely caused by a nearby lightning strike. After replacing it for the second time I connected a 15V zener diode between the input and output pins and haven't had any problems since.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf