# 0-57V voltage control using a digital pot

Status
Not open for further replies.

#### JEG

Joined Aug 22, 2009
5
Hello,
I have to make a circuit capable of controlling a DC output Voltage from 0 to 57V, using a microcontroller. The idea I had is to use a digital potentiometer to control a variable voltage regulator. I used the LM317HV, which can handle up to 57V, and the digital potentiometer I chose is the AD5220. Basically, the control has to be in the digital voltage part of the circuit (3.3V), the problem is that I can't connect the digital potentiometer directly to the ADJ pin of the regulator, because of the voltage difference.
Therefore I came up with an idea, but I still think there should be a better way. My idea is shown in the attached image. I made a voltage divider that will vary according to the Digital Potentiometer (DP), that will control a current sink circuit, that I think, will simulate a resistance.
According to the LM317HV datasheet, the current through the transistor should be equal to Io=1.27V/R4. I chose R4=240ohms, according to the datasheet. Then, I calculate the values of R3 in order to obtain that current Io, when the potentiometer is at the maximum resistance. Since I put a 10Kohm resistance in parallel to the transistor, to grantee a current flow to GND, I calculate the values of R1 and R2 to adjust the voltage divider to obtain Io at maximum resistance of the DP, and to obtain half of Io at minimum resistance of the DP. Therefore, the transistor, according to me, is acting as a 10Kohm simulated variable resistance controlled by the digital potentiometer. This way I can vary the output voltage of the regulator.

I tested with a maximum output of 30V, and it seems to work fine, the main problem is that I'm having trouble obtaining the maximum (30V) and minimum values (1.5V) of the voltage regulator. I calculated the values of the voltage divider using 1.5V when DP=10Kohm and 1V when DP=70ohm (the mininmun of the DP) The values I used were R1= 11Kohm, R2=27Kohms. R3=30Kohm. The transistor I used was the C1815, the opamp was OP295.

Thank you very much for any information!

#### Attachments

• 32.4 KB Views: 514
Last edited:

#### mik3

Joined Feb 4, 2008
4,843
What will be the application of this?

How does the PIC 'knows' the desired output voltage?

#### JEG

Joined Aug 22, 2009
5
Application: A computer controlled voltage source, don't have a specific application yet.
Still have to make the feedback loop to let the microcontroller know the actual voltage, and since this part will require another circuit design to measure the output voltage with the ADC of the microcontroller for now I just want to make it open loop (0 to 100%). The Digital potentiometer is increased or decreased by pulses (128steps), so the microcontroller just counts how many has pulses send.

#### mik3

Joined Feb 4, 2008
4,843
You can achieve good results with closed loop operation and a good algorithm. With open loop the output voltage will not be stable because transistors parameters vary with temperature, operating current etc. Also, a transistor in highly non linear device.

#### JEG

Joined Aug 22, 2009
5
Yes it is true, I should start making the feedback loop then, But do you think if there is another way to do this control? with more linear components?

#### JEG

Joined Aug 22, 2009
5
Thanks Alberto, I will try it. But still it has the same problem that mik3 talk about: the non-linearity of the transistors. Then I will start working on the feedback circuit to make up for this problem.
I will test you idea also, thank you very much.

#### mik3

Joined Feb 4, 2008
4,843
If you PWM drive a transistor you don't really care about its non-linear response because it is either on (saturated) or off.

For your application PWM will not work. The output of the regulator will switch between 1.25V and the input voltage of the regulator. If you want to use PWM you can make a switching regulator.

#### Ron H

Joined Apr 14, 2005
7,063
You can do it like this. Be aware that no matter how you make a linear regulator, you will be limited to low current loads when the voltage is low, because of the high power dissipation of the series pass element (LM317HV in your case).

Also, your output stability will be no better than that of the 3.3V supply, percentage-wise. You may want to use a more stable reference.

#### Attachments

• 25.1 KB Views: 451

#### JEG

Joined Aug 22, 2009
5
Thank you Ron H, for the information. I was trying to analyze the circuit, and I think I understand the idea, but there is a part of the circuit that still I can't understand.
As I understand, the Op-Amp will adjust it's output to obtain the same voltage in the + and - inputs, therefore will adjust how much current will flow through the transistor, and adjust the regulator's output. Is that right?
The part I can't understand is why the Collector of the transistor is connected to the V- of the Op-Amp, and how the negative voltage is obtained. Also, I always thought that you should leave the V- (and V+) always constant for the Op-Amp to operate correctly, since the output will be affected by this change... therefore this is new for me!

Also, is there another method to vary the output voltage without using a regulator to have more stability? maybe a DC-DC converter?

Thanks for the help, it has been very useful!

#### Ron H

Joined Apr 14, 2005
7,063
Thank you Ron H, for the information. I was trying to analyze the circuit, and I think I understand the idea, but there is a part of the circuit that still I can't understand.
As I understand, the Op-Amp will adjust it's output to obtain the same voltage in the + and - inputs, therefore will adjust how much current will flow through the transistor, and adjust the regulator's output. Is that right?
The part I can't understand is why the Collector of the transistor is connected to the V- of the Op-Amp, and how the negative voltage is obtained. Also, I always thought that you should leave the V- (and V+) always constant for the Op-Amp to operate correctly, since the output will be affected by this change... therefore this is new for me!

Also, is there another method to vary the output voltage without using a regulator to have more stability? maybe a DC-DC converter?

Thanks for the help, it has been very useful!
The -8V to -12V label is confusing. Sorry. It is supposed to be a negative DC supply, but the voltage is not critical. In fact, it doesn't need to be regulated, and a little ripple would probably not be detrimental, because the op amp has excellent power supply rejection. The negative supply only needs to handle about 20mA. I don't think you will be able to use a 317 to get to zero volts output unless you have a negative supply.
The circuit is basically just a noninverting amplifier with a gain of 3.3V*17.27=57V. LM317HV needs a minimum load of 10mA to maintain good regulation. The 120 ohm resistor provides this load. The transistor emitter follower is there to share that load with the op amp, so neither will get too hot. The 150 ohm resistor diverts about half of that load current into the op amp output.
The LM317 is not used as a regulator. It is just a bullet-proof voltage follower which happens to have a 1.25V offset, but since it is inside the feedback loop, the value of that offset is irrelevant.
Attached are some simplified schematics.
As I mentioned previously, if your 3.3V supply is not stable, a reference voltage will have to be added.
I also mentioned the heating problem with low output voltages. A DC-DC converter would certainly be more efficient.
The circuit I provided was just a way for you to incorporate the LM317HV. I didn't mean to imply it was the best solution.

What are your maximum current loads at low and high voltages? Better yet, what is this going to be used for?

#### Attachments

• 24.9 KB Views: 303

#### timcam

Joined Jul 19, 2015
2
You can do it like this. Be aware that no matter how you make a linear regulator, you will be limited to low current loads when the voltage is low, because of the high power dissipation of the series pass element (LM317HV in your case).

Also, your output stability will be no better than that of the 3.3V supply, percentage-wise. You may want to use a more stable reference.
Hi Ron,

Thank you for providing this circuit.

If I wanted to use the negative version, LM337, would the only thing to change be the Q1 follower polarity?

Does the transfer function still work with the opamp in non-inverting configuration for negative regulator?

Regards

#### Wendy

Joined Mar 24, 2008
23,454
Welcome to AAC.

Congratulations, you have practiced the arcane art of necromancy, the revival of a long dead thread. Likely the TS (Thread Starter) has solved their problem in the years that has passed, or thrown it away, or something. I have therefore closed this thread.