Author Topic: LM317 digital control  (Read 23268 times)

0 Members and 2 Guests are viewing this topic.

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
LM317 digital control
« on: May 19, 2016, 09:33:27 am »
Im working on my own power supply project. I want to control output voltage of LM317 via microcontroller (PWM or DAC). Can some one help me with it?
 

Offline jdraughn

  • Regular Contributor
  • *
  • Posts: 106
Re: LM317 digital control
« Reply #1 on: May 19, 2016, 10:20:16 am »
All the datasheets I have seen for the LM317 cover this. The schematic shows a few transistors which pull different value resistors to ground to change the output voltage. You could get 256 values with 8 transistors. Using a buffered DAC would give you finer control with less parts.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LM317 digital control
« Reply #2 on: May 19, 2016, 10:42:11 am »
One limitation of the DAC approach is the min output voltage of a LM317 will
be ~ >-1.25V, its reference voltage. On way of handling this is an OpAmp summer,
operating off split supplies, with 2 inputs, DAC and an offset you generate of 1.25V.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #3 on: May 19, 2016, 02:06:44 pm »
All the datasheets I have seen for the LM317 cover this. The schematic shows a few transistors which pull different value resistors to ground to change the output voltage. You could get 256 values with 8 transistors. Using a buffered DAC would give you finer control with less parts.

Can you show a circuit for solution with dac
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LM317 digital control
« Reply #4 on: May 19, 2016, 02:16:05 pm »
Very simple. take the V output of the DAC and tie it to the LM317 ref pin.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #5 on: May 19, 2016, 02:30:16 pm »
I used a potentiometer as a voltage divider that give output from 0 to 5V. So this circuit will work?
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LM317 digital control
« Reply #6 on: May 19, 2016, 04:34:00 pm »
Yes circuit will work.

If LM358 powered off split supplies then you could get LM317 output to go to 0.

Also if you use a RRIO OpAmp then you will get a little better range.

Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #7 on: May 19, 2016, 04:44:14 pm »
Yes circuit will work.

If LM358 powered off split supplies then you could get LM317 output to go to 0.

Also if you use a RRIO OpAmp then you will get a little better range.

Regards, Dana.

I think i used a broken one lm317.... I ll buy new one and report if it will work
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: LM317 digital control
« Reply #8 on: May 19, 2016, 04:55:56 pm »
I think i used a broken one lm317....

What's wrong with it?
Without it's voltage setting resistors it will need a minimum load of 3.5mA - else it's output will float a lot higher than 1.25V.

What are the supply rails for the LM358?
.  That took much longer than I thought it would.
 

Offline jose347

  • Contributor
  • Posts: 20
  • Country: pr
Re: LM317 digital control
« Reply #9 on: May 19, 2016, 05:00:29 pm »
you could also use a digital pot for the resistances that control the output voltage and use spi or ic2 to control the pot
 
The following users thanked this post: spec

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LM317 digital control
« Reply #10 on: May 19, 2016, 07:19:10 pm »
Actually min load worst case to stay in regulation is min of 10 mA. This compounds the
design. But graph of load regulation shows min load going to 0, not quite consistent.

Here are some notes on min load -

http://electronics.stackexchange.com/questions/11919/is-it-normal-for-lm317-to-give-a-higher-voltage-without-a-load

What you might do is terminate the LED to the - supply you are going to
use to get output to go to 0 so that it still draws current when output goes to 0.

If you look at this datasheet fig 9 notice the protection diodes.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #11 on: May 19, 2016, 07:39:00 pm »
you could also use a digital pot for the resistances that control the output voltage and use spi or ic2 to control the pot
They are pretty expensive

What are the supply rails for the LM358?
They are connected directly to input

 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #12 on: May 19, 2016, 07:58:15 pm »
What's wrong with it?
Without it's voltage setting resistors it will need a minimum load of 3.5mA - else it's output will float a lot higher than 1.25V.
I added a 249Ohm load to output, and get 1.25V out. And its didn't change at all. I checked op amp output and its looks normal (0-5V).
Then i tried to use "classic" circuit for LM317 with two resistors, I chose 10k. From datasheet Vout = Vref*(1+R1/R2) so i expected to get ~2.5V but i get close to input voltage
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: LM317 digital control
« Reply #13 on: May 19, 2016, 08:43:08 pm »
I used a potentiometer as a voltage divider that give output from 0 to 5V. So this circuit will work?
That circuit won't go down to 0V. The LM317 keeps the voltage on its output 1.25V above the adjust pin so it will vary from 1.25V to 5V 6.25V. That circuit has no advantages over the traditional LM317 circuit, using two resistors and the disadvantage of requiring an additonal minimum load of 10mA to regulate properly.

If you need it do go down to 0V, then the adjustment pin of the LM317 needs to be connected to -1.25V. The simplest way to do this is to use the LM337L. Another way is to use an op-amp to invert the voltage between the LM315's output and adjust pin. It's more complicated but the most accurate.

« Last Edit: May 19, 2016, 09:01:51 pm by Hero999 »
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #14 on: May 19, 2016, 08:53:54 pm »
That circuit won't go down to 0V. The LM317 keeps the voltage on its output 1.25V above the adjust pin so it will vary from 1.25V to 5V.
I know, its not a problem for my supply, and i think if i feed 0-5V to ADJ I will get 1.25-6.25 on the output
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: LM317 digital control
« Reply #15 on: May 19, 2016, 09:00:44 pm »
That circuit won't go down to 0V. The LM317 keeps the voltage on its output 1.25V above the adjust pin so it will vary from 1.25V to 5V.
I know, its not a problem for my supply, and i think if i feed 0-5V to ADJ I will get 1.25-6.25 on the output
Yes, you're right, it will go from 1.25V to 6.25, not 5V. Post edited.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: LM317 digital control
« Reply #16 on: May 19, 2016, 09:04:06 pm »
If the ouput of the LM317 is 1.25V with a few mA load, then the LM317 must be working OK.

If you can see the op amp output varying 0 to 5V but the output of the LM317 doesn't change from 1.25V then there's a wiring error such as the LM317's Adj pin incorrectly connected to GND.

The output voltage range of your circuit is going to be only min 2.2V to max 6.25V.
.  That took much longer than I thought it would.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: LM317 digital control
« Reply #17 on: May 19, 2016, 10:06:51 pm »
Looking at two different datasheets they show output C of 1 uF.

Makes me wonder what the phase margin is if 10 uF like you have.
Note there is a graph of Zo vs f for 1 uF, maybe an estimate can
be done from that. This affects transient response, ringing due to
load changes.

Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: LM317 digital control
« Reply #18 on: May 19, 2016, 10:24:06 pm »
You might be able to do something like this. The transistor helps to pull the ADJ pin and min load current ( 8 ma?)down to 0V. The 2 2K2s multiply the 0-5V input by 2 to give a max output voltage of 11.25V - depending on V+.
.  That took much longer than I thought it would.
 

Offline ZeTeX

  • Frequent Contributor
  • **
  • !
  • Posts: 610
  • Country: il
  • When in doubt, add more flux.
Re: LM317 digital control
« Reply #19 on: May 20, 2016, 09:55:22 am »

dont forget your bypass caps and protection diodes if needed.
R1 and R2 have a gain of 2, your buffer output goes instead of V2.
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #20 on: May 20, 2016, 12:42:04 pm »

dont forget your bypass caps and protection diodes if needed.
R1 and R2 have a gain of 2, your buffer output goes instead of V2.
I get a new LM317T.
I used 249Ohm resistors. i get from 2 to 6.25V on adjust pin, and 3.25 to 7.5V on output. every thing is nice but I want to get output voltage as low as possible, any ways to do this?
 

Offline ZeTeX

  • Frequent Contributor
  • **
  • !
  • Posts: 610
  • Country: il
  • When in doubt, add more flux.
Re: LM317 digital control
« Reply #21 on: May 20, 2016, 02:19:09 pm »

dont forget your bypass caps and protection diodes if needed.
R1 and R2 have a gain of 2, your buffer output goes instead of V2.
I get a new LM317T.
I used 249Ohm resistors. i get from 2 to 6.25V on adjust pin, and 3.25 to 7.5V on output. every thing is nice but I want to get output voltage as low as possible, any ways to do this?
How low? if you want less then 1.25V you are going to need a very small current negative supply. there are many ways to generate a negative a supply. just google it.
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #22 on: May 20, 2016, 02:25:05 pm »
How low? if you want less then 1.25V you are going to need a very small current negative supply. there are many ways to generate a negative a supply. just google it.
1.25V its fine for me
 

Offline MaobuffTopic starter

  • Contributor
  • Posts: 22
  • Country: ua
Re: LM317 digital control
« Reply #23 on: May 20, 2016, 04:17:29 pm »
I just breadboarded my previous design at its work perfectly. 1.25 to 6.25V on output.
 

Offline ZeTeX

  • Frequent Contributor
  • **
  • !
  • Posts: 610
  • Country: il
  • When in doubt, add more flux.
Re: LM317 digital control
« Reply #24 on: May 20, 2016, 05:00:34 pm »
I just breadboarded my previous design at its work perfectly. 1.25 to 6.25V on output.
Don't forget minimum load requirements (the circuit I posted covers that) , capacitors and protections. read very carefully the datasheet.
I don't think you need the op amp as a buffer because the adj pin is going to and internal op amp.
just because you got it working without minimum load does not mean it is stable, especially if this is your bench power supply you want to build it as stable as possible.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf