# Tool for “designing” a resistor network?

I'm preparing to calibrate some current sensors for a system with DC 13.6V power, and various loads, from well under an amp, up to about 4 amps. I bought some 2, 3 and 5 ohm power resistors, and plan to arrange them in various series and parallel networks to calibrate each current sensor using a load with known resistance.

It's easy to calculate the resistance of some resistors in series or in parallel, but I don't have a technique for generating a network with a desired resistance. I would like to come up with values that result in "well rounded" maximum amp values, such as very nearly 5 amps for the circuit that is supposed to max out around 4 amps, but so far I've just been making guesses. Sigh.

Is there a tool for doing this, or a reasonable "by hand" method? Thanks.

• Have you considered continued fractions? They can apply here. – jonk Aug 23 '17 at 0:32

There's a tool solving exactly this problem:

http://kirr.homeunix.org/electronics/resistor-network-finder/

It constructs a network with your desired equivalent resistance, out of the values that you have in stock.

• Kirr, that looks great. I especially like the ability to add non-standard (or "on-hand") resistor values. The only improvement I could suggest is to allow one to specify the power to be dissipated (or voltage) and the watt rating of each resistor. – James Synge Sep 12 '17 at 11:34
• You're welcome! I agree, accounting for wattage, overall and per resistor could be useful. Up to now I did not care much about wattage because it's not critical in my usual projects (synth building). I'll think about it. Cheers! – Kirr Sep 15 '17 at 1:31

I don't know if you've considered continued fractions, or if they'd do anything you care about, but here's something that may be worth considering.

Let's say you want $R_x=12.5\:\Omega$ between nodes $N_A=N_0$ and $N_B$. Set $i=0$:

1. Select the next higher value above $R_x$. In E12, that's $R_{2i+1}$ (for $i=0$, $R_1=15\:\Omega$.) If satisfied with the results, use $R_{2i+1}$ to connect $N_i$ to $N_B$ and you are done!
2. Otherwise, compute $R_y=\frac{R_{2i+1}\cdot R_x}{R_{2i+1}-R_x}$ (for $i=0$, $R_y=75\:\Omega$) and select the next lower value of $R_{2i+2}$ (for $i=0$, $R_2=68\:\Omega$.) Connect one end of $R_{2i+2}$ to $N_i$. The other end is left open and labeled $N_{i+1}$. If satisfied with the results of jumpering $N_{i+1}$ to $N_B$, then jumper those two nodes and you are done!
3. Otherwise, compute $R_x=R_y-R_{2i+2}$ (for $i=0$, $R_x=7\:\Omega$), increment $i$ (for $i=0$, $i$ becomes $i=1$) and then go to step 1.

In the above starting case of $12.5\:\Omega$ and using E12 resistor values, the following possible circuits develop:

simulate this circuit – Schematic created using CircuitLab

And so on. You can see that it rapidly approaches the desired value. Most of the dissipation is usually carried in the first resistor. Whether or not this is good or bad, depends. The gist of this is that you are almost always very, very close with no more than three or four resistors with E12.

Here's the same approach, but used with E24 resistor values:

simulate this circuit

Note that at the even steps of $i\ge 2$, you can also consider summing the two series resistor values and picking the next higher value that closely matches as an alternative to step $i-1$, too. For example, in step $i=2$ of the above E24 resistor selections, $R_2$ and $R_3$ could be summed and then the choice of $R_2=330\:\Omega$ could be used instead of what was used in step $i=1$. In the above case, this would have been a better choice for $i=1$ than just strictly following the algorithm I gave earlier.

This points up a slight improvement to the algorithm. The value of $R_x$ should be considered as either one resistor of next higher value, or else two resistors composed of the next lower value, plus the difference rounded up to its next (or similarly convenient) higher value.

Also, the algorithm doesn't always find optimal choices. For example, this could have been $12\:\Omega$ in series with two, parallel $1\:\Omega$ resistors. And that would have been exact. But what it does do is to continually diminish the residual error (assuming exact resistor values.)

(Offered in the case it matters to you to have a codified, step-wise algorithm you can follow without just doing "hit and miss.")

• Thanks so much, this will be very helpful with the program I'm working on. Since I've got 3 current sensors to calibrate, not continuing with hit-and-miss seems sensible. You point out one important issue: most of the energy is dissipated by the first resistor. While I am using power resistors, they don't have attached heat sinks, so I'd rather spread the load around, so to speak. I'll see if I can come up with an evaluation function that balances minimizing the residual error, the maximum watts dissipated by any one resistor, and the total number of resistors used... I have only a modest #. – James Synge Aug 23 '17 at 12:15
• @JamesSynge Glad it could help. If you get a chance and the inclination, definitely read Bill Gosper's "Appendix 2." It's in text form on the web and free to read and think about: perl.plover.com/classes/cftalk/INFO/gosper.txt – jonk Aug 23 '17 at 17:19

This is a "I think it's easy enough to go and try with a modern computer" answer.
I'd be more than interested in a good answer or reference to an actual theoretical approach to OP's problem. It has been asked before, but I can't find it. The problem is very nice.

The problem of finding a graph (i.e. a network) whose flow (i.e. whose total resistance/conductivity) given edge weights comes as close as possible to a specific value does sounds algorithmically hard¹.

But frankly: I'd just go and find a formula for the resistance of each combinations of 2 resistors (which are only 2: parallel or serial), 3 resistors (all three parallel, all three serial, one parallel to two in series, one in series to two parallel), and 4 resistors.

Then, write a script that simply tries all these with all the different combinations you can draw from your reserve of resistors.

If you don't get close enough, take the list that the last step generated, and act as if you can use these as individual resistors: add these values to your list of available resistors, and repeat.

¹ That guess, by the way, is based on me imagining finding all flows through a graph being similarly complex as finding all paths.

• That is the direction I was starting on when I decided it was time to ask for guidance. I of course did a bunch of searching and reading, including about generating permutations of colored balls, the standard item in so many combinatorics discussions. I figure I can map values of resistors for colors. I'll keep going with that approach. – James Synge Aug 23 '17 at 0:16

The simple solution is to design an active "dummy load" using a darlington power transistor or power FET as a constant current sink with a 50 to 100mV voltage drop at rated or max load current for ground current sensing. Then you just need a Pot or a DAC and comparator to regulate the voltage compared with Vsense.

• Is this the kind of thing you had in mind (actually, probably rather more complex): instructables.com/id/… – James Synge Aug 23 '17 at 0:18

Yes, there is at least one calculator for two resistors, which you can access here.

Here is an example calculation to get 12.5 ohms using two 10% resistors in series or parallel combinations.

• I was able to hack the javascript to get it to work with the values I have (2, 3 and 5 ohm), series and parallel combinations of any 2 resistors them, and then generate the closest "networks" of two "resistors". For 3.4 Ohms, the script came up with: 1.88 + 1.5 = 3.38 (-0.588 %) That first result can be constructed with 3 and 5 Ohm resistors in parallel, for 1.88 Ohm, and two 3 Ohm resistors in parallel, for 1.5 Ohm. – James Synge Aug 23 '17 at 1:13