Control a buck converter with a µController ?

MrAl

Joined Jun 17, 2014
13,716
Maybe if the output voltage approaches zero. The requirement is 10 to 18V.
Ok Ron ill go over it today.

LATER:
Ok i took a quick look at this and what i quickly realized is we dont really know what the output is unless we measure it. In other words, when we change the controlling voltage it does not tell us what the output is so most likely we'd have to measure it. That means we cant do a full analysis until we know what changes the controlling voltage because that would be part of the feedback.
It might be possible to correlate the output of the DAC to the output, but that's not as good as actually measuring the output and adjusting the controlling voltage accordingly.
What this means is we would have to know the program code that does that alters the controlling voltage.
 
Last edited:

Thread Starter

Zouglou LeMagicien

Joined Feb 12, 2019
33
Below is the LTspice simulation of a typical buck-regulator circuit, using a DAC voltage to adjust the regulator output voltage.
The regulator has a 2.2V reference and the effect of the DAC voltage on the output voltage is determined by the relative values of R1, R2, R5, R6.
Note that the maximum output voltage occurs when the DAC voltage is 0V and the minimum when the DAC voltage is 4V.

View attachment 205405
That's seems working, but what's the mathematical expression bewteen the output voltage and the DAC voltage ?
I understand that the DAC voltage (+ R6 voltage) control the voltage across R5 and will influence the feedback, but I don't really understand how can I calculate mathematically this...
 

MrAl

Joined Jun 17, 2014
13,716
That's seems working, but what's the mathematical expression bewteen the output voltage and the DAC voltage ?
I understand that the DAC voltage (+ R6 voltage) control the voltage across R5 and will influence the feedback, but I don't really understand how can I calculate mathematically this...
Hello,

The output voltage is related to the reference voltage E1 and the control voltage E2 so ideally we have:
Vout=
(E1*(R5*R6+R2*R6+R1*R6+R2*R5+R1*R5))/(R5*R6+R2*R6+R2*R5)
-(E2*R1*R5)/(R5*R6+R2*R6+R2*R5)

For the values given in the schematic this amounts to ideally:
Vout=8.52593783494105*E1-2.274062165058949*E2

Replace E1 with the reference voltage (i think it is 2.2v ?) then you have only the control voltage E2 to think about. The range of output with the values shown and a reference voltage of 2.2v is about 7.4v up to around 18v or so, subject to the input voltage constraint as obviously if you only have 15v in you cant get 18v out.

It might be ok if you dont try to measure the output in order to adjust the DAC output, but if you do then you should check for stability problems just in case.
 

Thread Starter

Zouglou LeMagicien

Joined Feb 12, 2019
33
Hello,

The output voltage is related to the reference voltage E1 and the control voltage E2 so ideally we have:
Vout=
(E1*(R5*R6+R2*R6+R1*R6+R2*R5+R1*R5))/(R5*R6+R2*R6+R2*R5)
-(E2*R1*R5)/(R5*R6+R2*R6+R2*R5)

For the values given in the schematic this amounts to ideally:
Vout=8.52593783494105*E1-2.274062165058949*E2

Replace E1 with the reference voltage (i think it is 2.2v ?) then you have only the control voltage E2 to think about. The range of output with the values shown and a reference voltage of 2.2v is about 7.4v up to around 18v or so, subject to the input voltage constraint as obviously if you only have 15v in you cant get 18v out.

It might be ok if you dont try to measure the output in order to adjust the DAC output, but if you do then you should check for stability problems just in case.
Where did you get this big formula :eek:
Is it voltage dividers with parallel formula or other ? I do not understand clearly this one, could you explain it in details ? :)

Thanks !
 

MrAl

Joined Jun 17, 2014
13,716
Where did you get this big formula :eek:
Is it voltage dividers with parallel formula or other ? I do not understand clearly this one, could you explain it in details ? :)

Thanks !
Hello,

It comes from an analysis of the AC averaged model circuit shown in the attachment.
Note in this model circuit, even the power supply voltage is eliminated as well as the output filter components and load. You can include the cap shown in the middle of the drawing in order to get some idea of the dynamics, but it doesnt really reflect all of the dynamics of the circuit anyway.
If you forget about the capacitor, you get a DC expression as shown previously and of course it must depend on the reference voltage, the control voltage, and all the resistors in the feedback circuit.
The op amp that replaces the IC in the model circuit is considered to have infinite gain.

We could go through the mathematical analysis if you like.
 

Attachments

Thread Starter

Zouglou LeMagicien

Joined Feb 12, 2019
33
Hello,

It comes from an analysis of the AC averaged model circuit shown in the attachment.
Note in this model circuit, even the power supply voltage is eliminated as well as the output filter components and load. You can include the cap shown in the middle of the drawing in order to get some idea of the dynamics, but it doesnt really reflect all of the dynamics of the circuit anyway.
If you forget about the capacitor, you get a DC expression as shown previously and of course it must depend on the reference voltage, the control voltage, and all the resistors in the feedback circuit.
The op amp that replaces the IC in the model circuit is considered to have infinite gain.

We could go through the mathematical analysis if you like.
Yeah the mathematical analysis interest me. I have understood the circuit that you present but I've not understand how did you get this formula :)
 

MrAl

Joined Jun 17, 2014
13,716
If you know superposition you can calculate the feedback voltage (voltage at the inverting terminal).
Let's call that Vfb=Vout*K1+Vdac*K2 where K is a constant that comes out of the analysis for the feedback voltae.
With the reference voltage being Vref, we have the op amp treated as a voltage controlled voltage source:
Vout=A*(-Vdac*K2-Vout*K1+Vref)
this is an equation implicit in Vout where A is the open loop gain of the op amp.
Solving explicitly for Vout we get:
Vout=(Vref*A-Vdac*A*K2)/(A*K1+1)
Now since in the ideal case we consider A to be infinite, we take the limit of that as A goes toward infinity and get:
Vout=(Vref-Vdac*K2)/K1

and that's the solution. The values of K1 and K2 comes out of the feedback network and the control voltage as mentioned. To get that you can do the following:
Put R6 in parallel with R5, we'll call that R56.
Put that in series with R2, we'll call that R562.
Now use the voltage divider formula to calculate one part of Vfb we'll call Vfb1:
Vfb1=Vout*R562/(R562+R1)
That is the response due to Vout on Vfb.
Now ground Vout and first calculate the voltage at the junction of R2, R5, and R6 we'll call that V256 but first we have to calculate the series combo of R1 in series with R2 call that R12:
R12=R1+R2
Now put that in parallel with R5 and call that R125.
Now use the voltage divider formula to calculate V256:
V256=Vdac*R125/(R125+R6)
Now use the voltage divider formula to calculate Vfb2 the second part of Vfb with Vout still grounded:
Vfb2=V256*R1/(R1+R2)
Now that we have the two parts of Vfb we can add them:
Vfb=Vfb1+Vfb2
Now that we have the total Vfb we can do the op amp as before:
Vout=(Vref-Vfb)*A
Now when we have all the values that went into Vfb and solve explicitly for Vout and then take the limit as A goes to infinity, we get the value of Vout. Since this will contain the control voltage Vdac and Vref, we replace Vref with the actual reference voltage then we can substitute all the resistor values and we end up with a simple expression that describes the output voltage as the control voltage Vdac changes.
Going through that exercise, the expression is again:
Vout=8.52593783494105*Vref-2.27406216505895*Vdac

Note it is best to use some math software to do all the multiplying and of course for taking the limit.
If you dont want to take any limits then replace:
Vout=(Vref-Vfb)*A
with:
Vfb=Vref
and solve explicitly for Vout.
Of course once you subst all the resistor values you should get again:
Vout=8.52593783494105*Vref-2.27406216505895*Vdac

You can also do this using all the resistor values in each step rather than waiting until the end, but you wont get the big formula you'll just get the numerical formula with the two terms only.

You may noticed that the two expressions the one i did far up in this thread and the one i just did do not have exactly the same values for the second terms. The previous one had:
-2.274062165058949*E2 (where E2=Vdac)
and this one has:
-2.27406216505895*Vdac
The tiny difference is due to the two different methods' intermediate rounding by the software i used. In the first expression i used straight up Nodal Analysis and in the second i used superposition as described above in this post. The order of operations is slightly different for the two and so the intermediate rounding by the software ends up occurring at different stages of the calculation which leads to a small difference. Sometimes the difference will be larger this one happened to be very small.
In real life we would probably just round ourselves in the end anyway:
Vout=8.526*Vref-2.274*Vdac
Just to be complete since Vref and its coefficient contribute a little bit more to the output than Vdac and its coefficient, we may want to keep one more digit of the first term:
Vout=8.5259*Vref-2.274*Vdac
but i would bet it would not matter in most applications, and we could probably even get away with:
Vout=8.53*Vref-2.27*Vdac

I hope this helps it took about an hour to write everything up :)
 
Last edited:

ronsimpson

Joined Oct 7, 2019
4,704
Yeah the mathematical analysis interest me.
First time I did this was before VGA monitors existed. Before we were even planning on VGA monitors.
I had a PWM IC where Vref was 2.5V and I used a DAC that ran from 0 to 5V.
When the DAC is set to 2.5V there is no voltage across Rdac. So it is not there.
To get the center voltage. (10V in this case) simply use Rtop and Rbottom.
Now set the DAC to 0V. This puts Rbottom parallel to Rdac. Simple math to get Vmax output.
The minimum output voltage is simple math in your head. Using Vmax and Vcenter.
1587996871558.png
I love math but not that much. Now you see how simple it can be, if something changes (example Vref) you can see how to change the math. I would start out with DACout=Vref and understand that point and then go from there.
 

MrAl

Joined Jun 17, 2014
13,716
First time I did this was before VGA monitors existed. Before we were even planning on VGA monitors.
I had a PWM IC where Vref was 2.5V and I used a DAC that ran from 0 to 5V.
When the DAC is set to 2.5V there is no voltage across Rdac. So it is not there.
To get the center voltage. (10V in this case) simply use Rtop and Rbottom.
Now set the DAC to 0V. This puts Rbottom parallel to Rdac. Simple math to get Vmax output.
The minimum output voltage is simple math in your head. Using Vmax and Vcenter.
View attachment 205525
I love math but not that much. Now you see how simple it can be, if something changes (example Vref) you can see how to change the math. I would start out with DACout=Vref and understand that point and then go from there.
Yes that looks cute :)

However, i would recommend going back to the original circuit and testing with a dynamically stepped load resistance.
 

crutschow

Joined Mar 14, 2008
38,536
Now you see how simple it can be
Thanks for simplifying the circuit by removing an unneeded resistor.
One fewer resistor greatly simplifies the calculations.

Below is the circuit with the three resistors.
I calculated R1 and R5 for a center voltage of 14V with the DAC at 2.2V (the chip reference voltage) where R6 has no effect.
Then I calculated the value of R6 for the desired maximum 18V output with the DAC at 0V (basically R6 in parallel with R5).
This then gave the desired minimum output of 10V for a DAC output at 4.4V.

I see no particular stability issue with this circuit, since the feedback loop gain is not changed with a change in output voltage.

1588003375813.png
 
Last edited:

MrAl

Joined Jun 17, 2014
13,716
Here are the results for the 'new' simpler circuit:
Vout=(Vref*R5*R6+Vref*R1*R6+Vref*R1*R5-Vdac*R1*R5)/(R5*R6)

and with the values shown on the schematic:
Vout=12.88880909718397*Vref-3.020030816640986*Vdac

So there is a small difference than before but not too much.
If we wanted to match the previous results exactly we'd have to use slightly different values resistors for the feedback network.
 

crutschow

Joined Mar 14, 2008
38,536
Just for interest, here's the circuit with resistor values that give an output adjustment range of 0V to 20V for a DAC voltage of 4.4V to 0V:
All resistor values are readily found using only a calculator without having to put a pencil to paper.

1588014846145.png
 
Last edited:

ronsimpson

Joined Oct 7, 2019
4,704
You can also use the shutdown pin to kill the output.

At one point I had a digital pot in the feedback loop but if the pot goes "open" the feedback loop opens. In that case the boost supply wanted to make 1,000,000s of volts. Some pots have a open function that I do not want.
 
Top