Author Topic: Help with resistor network analysis  (Read 1261 times)

0 Members and 1 Guest are viewing this topic.

Online ifonlyeverythingTopic starter

  • Regular Contributor
  • *
  • Posts: 89
  • Country: us
Help with resistor network analysis
« on: December 15, 2022, 11:59:20 pm »
I want to vary my power supply output, which I understand can be done with a DAC. Someone was nice enough to make an online calculator here. https://www.fischl.de/dcdccontrol/ I have a 3.3V DAC, a power supply with a 2.5V feedback pin, and I want to vary output between 4V and 6V. I attempted a solution with KCL and KVL.



i1 + i3 = i2
vpsu - r1 * i1 - r2 * i2 = 0 (inner left loop, clockwise as arrow shows)
vdac - r3 * i3 - r2 * i2 = 0 (inner right loop, counter-clockwise)
vpsu - r1 * i1 + r3 * i3 + vdac = 0 (outer loop, clockwise)

I know that the FEEDBACK node is 2.5V and I arbitrarily chose r2 to give 1mA. So we have,

r2 * i2 = 2.5
r2 = 2500

The online calculator gives me R1 = 1984.85 Ohm, R3 = 3275.00 Ohm and this does agree to what I can see in LTspice. So this should be solvable. I tried plugging this into a computer algebra system for conditions vpsu == 6 and vdac == 0 as well as vpsu == 4 and vdac == 3.3 but I don't get a result for the second solve command?

Code: [Select]
var('vpsu,vdac,r1,r2,r3,i1,i2,i3')
eq1 = i1 + i3 == i2
eq2 = vpsu - r1 * i1 - r2 * i2 == 0
eq3 = vdac - r3 * i3 - r2 * i2 == 0
eq4 = vpsu - r1 * i1 + r3 * i3 + vdac == 0
eq5 = r2 * i2 == 2.5
eq6 = r2 == 2500
pretty_print(solve([eq1,eq2,eq3,eq4,eq5,eq6,vpsu==6,vdac==0],vpsu,vdac,r1,r2,r3,i1,i2,i3))
pretty_print(solve([eq1,eq2,eq3,eq4,eq5,eq6,vpsu==4,vdac==3.3],vpsu,vdac,r1,r2,r3,i1,i2,i3))

https://sagecell.sagemath.org/?z=eJydkMEKwjAMhu-C75DbNhvHmqy79UlEZOgOBdHZzYJvb-JUBEXBww_hz5c_bVIb8yz1wxnTrt1itBgJI2OwGAgDZ8V81p0seAgWDAQGLyWpSWLqJCwhWlgoIBVpRUpVCrFCkqwt1hZ_gOr3JPPEzTT_YJ2wL_NUOnWbyVXDVcL1sRvHy6aP4TDmw3Gfunwl30B5tYhFtciJGtTN3je3A3hfrfHLOYrin-z6ns0l_0i_Alo0bgM=&lang=sage&interacts=eJyLjgUAARUAuQ==
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3052
  • Country: us
Re: Help with resistor network analysis
« Reply #1 on: December 16, 2022, 04:29:25 am »
I didn't take a good look at your equations, but I tried another approach and it seems to work.

Using superposition you can quickly write down this equation:

$$

V_{\text{out}} \frac{R_2 || R_3}{R_1+R_2 || R_3} + V_{\text{dac}} \frac{ R_1 || R_3 }{R_2 + R_1 || R_3} = V_{\text{fb}}

$$

Note that the resistor ratio terms are just voltage divider expressions. In general, if you have a bunch of voltage sources connected via resistors there is a nice pattern for the voltage at the meeting point.

So try this code:

Code: [Select]
var('r1,r2,r3')
def par(a,b): return a*b/(a+b)
def div(a,b): return b/(a+b)
def equation(vdac, vout, vfb): return vout*div(r1, par(r2,r3)) + vdac*div(r2,par(r1,r3)) - vfb

eq1 = equation(0, 6, 2.5)
eq2 = equation(3.3, 4, 2.5)
pretty_print(solve([eq1, eq2, r2-2500], [r1, r2, r3]))

Running it I get this answer:

1665130-0

« Last Edit: December 17, 2022, 04:23:46 pm by ledtester »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3052
  • Country: us
Re: Help with resistor network analysis
« Reply #2 on: December 16, 2022, 06:44:04 am »
I think I found your problem:

Quote
vpsu - r1 * i1 - r2 * i2 = 0 (inner left loop, clockwise as arrow shows)
vdac - r3 * i3 - r2 * i2 = 0 (inner right loop, counter-clockwise)
vpsu - r1 * i1 + r3 * i3 + vdac = 0 (outer loop, clockwise)

The outer loop is just the difference of the two inner loops. This will always be the case with KVL -- the sum of all of the smaller loops will be the equation for the largest loop. Hence you only need to include the equations for the smallest loops.

In this case the outer loop equation should be the left loop minus the the right loop and it should read:

vpsu - r1 * i1 + r3 * i3 - vdac = 0 (outer loop, clockwise)

but you've got + vdac.

Since this third equation is a combination of the first two you don't need to use it.

Update: This also explains why you can solve the equations for Vdac = 0 but not Vdac = 3.3. Because of the sign error Vdac is forced to be 0, so attempting to set it to any other value results in no solutions.
« Last Edit: December 16, 2022, 07:06:13 am by ledtester »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1454
Re: Help with resistor network analysis
« Reply #3 on: December 16, 2022, 07:12:14 am »
I want to vary my power supply output, which I understand can be done with a DAC. Someone was nice enough to make an online calculator here. https://www.fischl.de/dcdccontrol/ I have a 3.3V DAC, a power supply with a 2.5V feedback pin, and I want to vary output between 4V and 6V. I attempted a solution with KCL and KVL.



i1 + i3 = i2
vpsu - r1 * i1 - r2 * i2 = 0 (inner left loop, clockwise as arrow shows)
vdac - r3 * i3 - r2 * i2 = 0 (inner right loop, counter-clockwise)
vpsu - r1 * i1 + r3 * i3 + vdac = 0 (outer loop, clockwise)

I know that the FEEDBACK node is 2.5V and I arbitrarily chose r2 to give 1mA. So we have,

r2 * i2 = 2.5
r2 = 2500

The online calculator gives me R1 = 1984.85 Ohm, R3 = 3275.00 Ohm and this does agree to what I can see in LTspice. So this should be solvable. I tried plugging this into a computer algebra system for conditions vpsu == 6 and vdac == 0 as well as vpsu == 4 and vdac == 3.3 but I don't get a result for the second solve command?

Code: [Select]
var('vpsu,vdac,r1,r2,r3,i1,i2,i3')
eq1 = i1 + i3 == i2
eq2 = vpsu - r1 * i1 - r2 * i2 == 0
eq3 = vdac - r3 * i3 - r2 * i2 == 0
eq4 = vpsu - r1 * i1 + r3 * i3 + vdac == 0
eq5 = r2 * i2 == 2.5
eq6 = r2 == 2500
pretty_print(solve([eq1,eq2,eq3,eq4,eq5,eq6,vpsu==6,vdac==0],vpsu,vdac,r1,r2,r3,i1,i2,i3))
pretty_print(solve([eq1,eq2,eq3,eq4,eq5,eq6,vpsu==4,vdac==3.3],vpsu,vdac,r1,r2,r3,i1,i2,i3))

https://sagecell.sagemath.org/?z=eJydkMEKwjAMhu-C75DbNhvHmqy79UlEZOgOBdHZzYJvb-JUBEXBww_hz5c_bVIb8yz1wxnTrt1itBgJI2OwGAgDZ8V81p0seAgWDAQGLyWpSWLqJCwhWlgoIBVpRUpVCrFCkqwt1hZ_gOr3JPPEzTT_YJ2wL_NUOnWbyVXDVcL1sRvHy6aP4TDmw3Gfunwl30B5tYhFtciJGtTN3je3A3hfrfHLOYrin-z6ns0l_0i_Alo0bgM=&lang=sage&interacts=eJyLjgUAARUAuQ==

Hello,

How do you get an output voltage of 4v to 6v with those connections?

Here is the solution as the circuit stands right now:
Vfb=R2*(PSU*R3+DAC*R1)/(R2*R3+R1*R3+R1*R2)

However, if you eliminate R2 entirely you get solution:
Vfb=(PSU*R3+DAC*R1)/(R3+R1)

In theory you can eliminate R2 unless of course it is already part of the system, such as a load of some type.
The resistor values will come out different with R2 removed from the circuit.

Perhaps you can mention how you get 4 to 6 volts out of that circuit though when the DAC only goes from 0 to 3.3 volts.

 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 1227
  • Country: pl
Re: Help with resistor network analysis
« Reply #4 on: December 16, 2022, 09:06:28 am »
MrAl:
That is a modification to an existing DC/DC converter board. They come with a feedback divider already on the PCB and I believe R2 is a part of that divider. The idea is, I presume, to nudge the output of that divider.

ifonlyeverything:
Just skimming over your calculations, there is one thing that should ring alarm bells in your head. You have 2 unknowns, but 6 equations!

As for the solution, you have those currents:
I1 = (VPSU - 2.5 [V]) · G1
I2 = 0.001 [A]
I3 = (VDAC - 2.5 [V]) · G3

In case you did not encounter the notation yet, G = 1/R (electrical conductance). This just saves us from having 1/R everywhere in equations — there is no conceptual or numerical difference.

From KCL:
I1 - I2 + I3 = 0
… equals:
(VPSU - 2.5 [V]) · G1 - 0.001 [A] + (VDAC - 2.5 [V]) · G3 = 0

You have two constraints:
I. VDAC = 3.3 [V], VPSU = 4 [V]
II. VDAC = 0 [V], VPSU = 6 [V]

That gives us a system of two equations:
(4 [V] - 2.5 [V]) · G1 - 0.001 [A] + (3.3 [V] - 2.5 [V]) · G3 = 0
(6 [V] - 2.5 [V]) · G1 - 0.001 [A] + (0 [V] - 2.5 [V]) · G3 = 0

From that you calculate G1 and G3, which are inverses of resistances you want.

Since this is just two-dimensional space, the system can be solved visually. See the attachment. The solution is around (G1 = 0.5 mS, G3 = 0.3 mS). That corresponds to resistances of about 2000 Ω and 3333 Ω.

Since you have used a linear solver yourself, let’s use linear algebra approach as the second one. The entire problem is written as: A·x = b:
Code: [Select]
⎡ 4 - 2.5   3.3 - 2.5  ⎤   ⎡ G₁ ⎤   ⎡ 0.001 ⎤
⎣ 6 - 2.5     0 - 2.5  ⎦ · ⎣ G₃ ⎦ = ⎣ 0.001 ⎦
Code: [Select]
⎡ 1.5   0.8 ⎤   ⎡ G₁ ⎤   ⎡ 0.001 ⎤
⎣ 3.5  -2.5 ⎦ · ⎣ G₃ ⎦ = ⎣ 0.001 ⎦
The solution is, x = A-1·b, equals (see Wolfram Alpha):
Code: [Select]
⎡ 0.000503817 ⎤
⎣ 0.000305344 ⎦
Which, this is not a coincidence, is a point — just like with the graphical method. The corresponding resistances are: 1985 Ω and 3275 Ω.

Finally, the high school approach, step by step:
⎧ (4 [V] - 2.5 [V]) · G1 - 0.001 [A] + (3.3 [V] - 2.5 [V]) · G3 = 0
⎩ (6 [V] - 2.5 [V]) · G1 - 0.001 [A] + (0 [V] - 2.5 [V]) · G3 = 0

⎧ (1.5 [V]) · G1 - 0.001 [A] + (0.8 [V]) · G3 = 0
⎩ (3.5 [V]) · G1 - 0.001 [A] + (- 2.5 [V]) · G3 = 0

⎧ (1.5 [V]) · G1 - 0.001 [A] + (0.8 [V]) · G3 = 0
⎩ (3.5 [V]) · G1 - 0.001 [A] + (- 2.5 [V]) · G3 = 0

Substracting:
(1.5 [V] - 3.5 [V]) · G1 - (0.001 [A] - 0.001 [A]) + (0.8 [V] - (-2.5 [V])) · G3 = 0
-2 [V] · G1 + 3.3 [V] · G3 = 0

Calculating G1:
G1 = (-3.3 [V] · G3) / -2 [V] = 1.65 · G3

Substituting G1:
1.5 [V] · G1 - 0.001 [A] + 0.8 [V] · G3 = 0
1.5 [V] · (1.65 · G3) - 0.001 [A] + 0.8 [V] · G3 = 0
2.475 [V] · G3 - 0.001 [A] + 0.8 [V] · G3 = 0
(2.475 [V] + 0.8 [V]) · G3 - 0.001 [A] = 0
G3 = 0.001 [A] / 3.275 [V]

Plugging G3:
1.5 [V] · G1 - 0.001 [A] + 0.8 [V] · G3 = 0
1.5 [V] · G1 - 0.001 [A] + (0.8 [V] · 0.001 [A] / 3.275 [V]) = 0
1.5 [V] · G1 - 0.001 [A] + (0.0008 [A] / 3.275) = 0
1.5 [V] · G1 + (-0.002475 [A] / 3.275) = 0
G1 = 0.002475 [A] / 4.9125 [V]

… which gives us the resistances of R1 = 4.9125 / 0.002475 ≈ 1985 Ω, and R3 = 3.275 / 0.001 = 3275 Ω.

« Last Edit: December 16, 2022, 09:19:40 am by golden_labels »
People imagine AI as T1000. What we got so far is glorified T9.
 

Online ifonlyeverythingTopic starter

  • Regular Contributor
  • *
  • Posts: 89
  • Country: us
Re: Help with resistor network analysis
« Reply #5 on: December 16, 2022, 12:01:14 pm »
Thank you all for such detailed responses! :) Will have to read them over in detail tonight, when I have some free time.
 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 1227
  • Country: pl
Re: Help with resistor network analysis
« Reply #6 on: December 16, 2022, 03:18:59 pm »
Just remember those are answers to your question about a model. Explanations regarding mathematics applied to ideal elements. To see that in action you will have to build and test an actual circuit. They don’t sell 1985 Ω and 3275 Ω, 0% tolerance resistors. The closest resistors in E24 series (5%) are 2 kΩ and 3.3 kΩ, which makes the calculations off by a few percent even before taking other issues into account.

The goal is to understand how to use maths and what the equations mean. Not to use them in place of a soldering iron.


« Last Edit: December 16, 2022, 03:21:21 pm by golden_labels »
People imagine AI as T1000. What we got so far is glorified T9.
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 1454
Re: Help with resistor network analysis
« Reply #7 on: December 16, 2022, 03:33:04 pm »
Just remember those are answers to your question about a model. Explanations regarding mathematics applied to ideal elements. To see that in action you will have to build and test an actual circuit. They don’t sell 1985 Ω and 3275 Ω, 0% tolerance resistors. The closest resistors in E24 series (5%) are 2 kΩ and 3.3 kΩ, which makes the calculations off by a few percent even before taking other issues into account.

The goal is to understand how to use maths and what the equations mean. Not to use them in place of a soldering iron.

Hi,

Not sure what values you are after, but what works sometimes is to parallel two resistors to get the final value.
For example, if the resistor is 1010 Ohms and you need closer to 1000 Ohms, if you parallel it with a 100k resistor then the value comes out to 999.9 Ohms, in theory of course as the final value still has to be checked.
Beats using a pot :-)
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2415
  • Country: gb
  • Recovering Electrical Engineer
Re: Help with resistor network analysis
« Reply #8 on: December 16, 2022, 06:47:06 pm »
The solution requires the application of the superposition theorem. Your circuit is the classic illustration of its use.
You don't need a deep dive into the matrix. Dont take the red pill or the blue pill.
www.electricalclassroom.com/superposition-theorem/
 

Online ifonlyeverythingTopic starter

  • Regular Contributor
  • *
  • Posts: 89
  • Country: us
Re: Help with resistor network analysis
« Reply #9 on: December 17, 2022, 04:03:06 pm »
I didn't take a good look at your equations, but I tried another approach and it seems to work.

Using superposition you can quickly write down this equation:

$$

V_{\text{out}} \frac{R_2 || R_3}{R_1+R_2 || R_3} + V_{\text{dac}} \frac{ R_1 || R_3 }{R_2 + R_1 || R_3} = V_{\text{fb}}

$$

Note that the resistor ratio terms are just voltage divider expressions. In general, if you have a bunch of voltage sources connected via resistors there is a nice pattern for the voltage at the meeting point.

So try this code:

Code: [Select]
var('r1,r2,r3')
def par(a,b): return a*b/(a+b)
def div(a,b): return b/(a+b)
def equation(vdac, vout, vfb): return vout*div(r1, par(r2,r3)) + vdac*div(r2,par(r1,r3)) - vfb

eq1 = equation(0, 6, 2.5)
eq2 = equation(3.3, 4, 2.5)
pretty_print(solve[eq1, eq2, r2-2500], [r1, r2, r3])

Running it I get this answer:

(Attachment Link)

I've never learned the superposition principle until now (not an EE.) Am I misunderstanding something or does this give the incorrect answer? I tried plugging R1=1515, R2=2500, R3=1908 into LTspice and it's not yielding 2.5V at the feedback node?
« Last Edit: December 17, 2022, 04:05:19 pm by ifonlyeverything »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3052
  • Country: us
Re: Help with resistor network analysis
« Reply #10 on: December 17, 2022, 04:17:45 pm »
I tried plugging R1=1515, R2=2500, R3=1908 into LTspice and it's not yielding 2.5V at the feedback node?

Please post your .asc file - you can just upload it as an attachment.

Here is the calculation from the https://www.fischl.de/dcdccontrol/ app:



« Last Edit: December 17, 2022, 04:23:03 pm by ledtester »
 

Online ifonlyeverythingTopic starter

  • Regular Contributor
  • *
  • Posts: 89
  • Country: us
Re: Help with resistor network analysis
« Reply #11 on: December 17, 2022, 04:32:12 pm »
I tried plugging R1=1515, R2=2500, R3=1908 into LTspice and it's not yielding 2.5V at the feedback node?

Please post your .asc file - you can just upload it as an attachment.

Here is the calculation from the https://www.fischl.de/dcdccontrol/ app:



It works fine, my mistake! I switched R2/R3 notation (relative to the fischl.de website) while you didn't.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf