Author Topic: Software for calculating best resistors.  (Read 1638 times)

0 Members and 1 Guest are viewing this topic.

mendip_discovery

• Frequent Contributor
• Posts: 879
• Country:
Software for calculating best resistors.
« on: May 27, 2024, 10:55:22 am »
If I wanted to connect resistors in series and in parallel to get myself the closest to nominal value resistor, has anyone come across software to calculate this from a collection of resistors.

If it doesn't exist my thoughts are to take a spreadsheet of resistors and ask a program to calculate all the options that fit my layout, eg four resistors, two in series in parallel with another two in series.
Motorcyclist, Nerd, and I work in a Calibration Lab :-)
--
So everyone is clear, Calibration = Taking Measurement against a known source, Verification = Checking Calibration against Specification, Adjustment = Adjusting the unit to be within specifications.

Zero999

• Super Contributor
• Posts: 19651
• Country:
• 0999
Re: Software for calculating best resistors.
« Reply #1 on: May 27, 2024, 11:02:22 am »

Gyro

• Super Contributor
• Posts: 9640
• Country:
Re: Software for calculating best resistors.
« Reply #2 on: May 27, 2024, 11:16:06 am »
Not forgetting the home grown rfun...

https://www.eevblog.com/forum/projects/fun-with-resistors/

Edit: Doh, the link doesn't work, maybe somebody has a copy
« Last Edit: May 27, 2024, 11:18:27 am by Gyro »
Best Regards, Chris

mendip_discovery

• Frequent Contributor
• Posts: 879
• Country:
Re: Software for calculating best resistors.
« Reply #3 on: May 27, 2024, 11:27:14 am »
https://www.qsl.net/in3otd/parallr.html
https://jansson.us/resistors.html
https://www.random-science-tools.com/electronics/divider.htm
http://earmark.net/gesr/opamp/

yup, they are handy calculators but fail at accepting a list of measured resistors I have in my collection.

Imagine I had a selection of 10 resistors, the number of iterations I have would take some time to work out the best solution. I would like to automate it.

Motorcyclist, Nerd, and I work in a Calibration Lab :-)
--
So everyone is clear, Calibration = Taking Measurement against a known source, Verification = Checking Calibration against Specification, Adjustment = Adjusting the unit to be within specifications.

Zero999

• Super Contributor
• Posts: 19651
• Country:
• 0999
Re: Software for calculating best resistors.
« Reply #4 on: May 27, 2024, 12:01:31 pm »
I think I've seen something like that, but didn't bother bookmarking it, because I just stock the entire E24 series from 10R to 1M and E12 from 1R to 10M, so it's no use to me.

I had a quick search and found this, which appears to have the ability to select the values used in the search.
http://jahonen.kapsi.fi/Electronics/ResOptimizer/

The following users thanked this post: 1001

brucehoult

• Super Contributor
• Posts: 4108
• Country:
Re: Software for calculating best resistors.
« Reply #5 on: May 27, 2024, 12:05:21 pm »
Not forgetting the home grown rfun...

https://www.eevblog.com/forum/projects/fun-with-resistors/

Edit: Doh, the link doesn't work, maybe somebody has a copy

The link works for me. But there was also a much more recent discussion.

https://www.eevblog.com/forum/projects/resistor-equivalence-finder-using-jlc-basic-resistors-only/

The resistor set is configurable....

Gyro

• Super Contributor
• Posts: 9640
• Country:
Re: Software for calculating best resistors.
« Reply #6 on: May 27, 2024, 12:31:37 pm »

I do have a zip copy of rfun.exe and associated chm help file V0.25 which I can upload if necessary (and appropriate?). V0.25 introduced User sets of resistors.
« Last Edit: May 27, 2024, 06:33:52 pm by Gyro »
Best Regards, Chris

brucehoult

• Super Contributor
• Posts: 4108
• Country:
Re: Software for calculating best resistors.
« Reply #7 on: May 27, 2024, 08:58:38 pm »
Oh I see,

The entire 'theageman' git is gone. Maybe he is too. He posted here only in August and September 2015, though there was apparently a login in 2022.

Gyro

• Super Contributor
• Posts: 9640
• Country:
Re: Software for calculating best resistors.
« Reply #8 on: May 27, 2024, 09:13:01 pm »
Yes, he's been gone a long while. I often wonder (worry) about what has happened in such circumstances. One moment he was discussing previews of V0.26 and then nothing -the last repository snapshot on Archive.org was 2020. There is a pdf of the help file on page 3 of the thread which gives a good picture of the s/w functionality.
« Last Edit: May 27, 2024, 09:14:53 pm by Gyro »
Best Regards, Chris

notsob

• Frequent Contributor
• Posts: 703
• Country:
Re: Software for calculating best resistors.
« Reply #9 on: May 27, 2024, 09:18:25 pm »

abeyer

• Frequent Contributor
• Posts: 318
• Country:
Re: Software for calculating best resistors.
« Reply #10 on: May 28, 2024, 12:02:08 am »
Oh I see,

The entire 'theageman' git is gone. Maybe he is too. He posted here only in August and September 2015, though there was apparently a login in 2022.

thermistor-guy

• Frequent Contributor
• Posts: 383
• Country:
Re: Software for calculating best resistors.
« Reply #11 on: May 28, 2024, 12:06:13 am »
If I wanted to connect resistors in series and in parallel to get myself the closest to nominal value resistor, has anyone come across software to calculate this from a collection of resistors.

If it doesn't exist my thoughts are to take a spreadsheet of resistors and ask a program to calculate all the options that fit my layout, eg four resistors, two in series in parallel with another two in series.

A brute-force approach like this would work, in many practical cases.

My preference would be to code a solution using Octave (https://www.octave.org/).

SiliconWizard

• Super Contributor
• Posts: 14690
• Country:
Re: Software for calculating best resistors.
« Reply #12 on: May 28, 2024, 01:24:02 am »
This one is handy for selecting resistor values for resistive dividers: https://damien.douxchamps.net/elec/resdiv/

kripton2035

• Super Contributor
• Posts: 2627
• Country:
Re: Software for calculating best resistors.
« Reply #13 on: May 28, 2024, 06:23:27 am »
it would be a good programming exercice with your favorite programming tool...
and if you don't do any programming, then it would be a good excuse to start learning some !

jonpaul

• Super Contributor
• Posts: 3441
• Country:
Re: Software for calculating best resistors.
« Reply #14 on: May 28, 2024, 06:25:14 am »
experiemce, RLC/DVM, box of parts
Jean-Paul  the Internet Dinosaur

ledtester

• Super Contributor
• Posts: 3083
• Country:
Re: Software for calculating best resistors.
« Reply #15 on: May 28, 2024, 07:12:25 am »

A brute-force approach like this would work, in many practical cases.

A quick feasibility analysis...

For 4 resistors there are 10 distinct topologies to consider:
- R+R+R+R
- R+R+(R|R)
- R+(R|R|R)
- R+(R|(R+R))
- (R|R)+(R|R)
and the ones obtained by interchanging + and |.

Let's say you restrict yourself to 5 decades of the E12 series - so each R has 60 possible values.
So you would have to evaluate 60^4*10 ~ 130 million different configurations which is very doable.

golden_labels

• Super Contributor
• Posts: 1258
• Country:
Re: Software for calculating best resistors.
« Reply #16 on: May 28, 2024, 11:49:35 am »
KiCad has that built in: in “Calculator Tools”, under “Resistor Calculator”.

Don’t get lost in calculating perfect ratios, when it serves no purpose. Sometimes it does, but mind you’re still dealing with tolerances. On both ends. The solution found is merely the nominal value. A circuit shouldn’t depend on being fine-tuned, if that can be avoided. Together that means one may just use the nearest R24 value. Not always, but usually. And even then a potentiometer in parallel/series may be a better idea for tuning.

Spreadsheets may be useful too. Not for simple calculation, but for producing visual aids. If you know the range of resistances you want to use,(1) you can calculate all possible solutions, their relative difference to the target, and use conditional formatting to highlight all ok-ish ones. This way you can quickly look up what matches your needs or stock. And, even if calculated for E24, gives valid results for other series — the underlying solutions space is continuous.

(1) If you can’t limit yourself to one or two orders of magnitude, a spreadsheet will not do. A programming language is going to be better, though a similar concept may be used.
« Last Edit: May 28, 2024, 12:23:23 pm by golden_labels »
People imagine AI as T1000. What we got so far is glorified T9.

The following users thanked this post: David Aurora, Smokey, shapirus

bpiphany

• Regular Contributor
• Posts: 132
• Country:
Re: Software for calculating best resistors.
« Reply #17 on: May 28, 2024, 12:08:50 pm »
A quick feasibility analysis...

For 4 resistors there are 10 distinct topologies to consider:
- R+R+R+R
- R+R+(R|R)
- R+(R|R|R)
- R+(R|(R+R))
- (R|R)+(R|R)
and the ones obtained by interchanging + and |.

Let's say you restrict yourself to 5 decades of the E12 series - so each R has 60 possible values.
So you would have to evaluate 60^4*10 ~ 130 million different configurations which is very doable.

I envision it should be possible to limit the number of values necessary to combine. If they are more than two decades apart you're probably doing something wrong.

Gyro

• Super Contributor
• Posts: 9640
• Country:
Re: Software for calculating best resistors.
« Reply #18 on: May 28, 2024, 01:03:11 pm »
Yes, he's been gone a long while. I often wonder (worry) about what has happened in such circumstances. One moment he was discussing previews of V0.26 and then nothing -the last repository snapshot on Archive.org was 2020. There is a pdf of the help file on page 3 of the thread which gives a good picture of the s/w functionality.

As archive.org keeps throwing 503 (no server available to handle your request) errors, I've attached my copy of rfun V0.25 zip that I downloaded in 2017, as I mentioned previously. It just contains the standalone exe and the chm help file (which you can lose if worried about chm file security). The archive.org snapshot also contains the sources.

If you trust me then go ahead and use it (scan it anyway). I will delete it if theageman contacts me, but as it's the same as the one on archive.org (if you persevere) I can't see a problem, lots of members back then downloaded it anyway. Otherwise, please just ignore.
Best Regards, Chris

abeyer

• Frequent Contributor
• Posts: 318
• Country:
Re: Software for calculating best resistors.
« Reply #19 on: May 28, 2024, 08:46:10 pm »
As archive.org keeps throwing 503 (no server available to handle your request) errors... it's the same as the one on archive.org (if you persevere)

Yeah, maybe don't try right now, as they're in the midst of a DDoS attack, so would make sense to hold off until that's resolved.

Smokey

• Super Contributor
• Posts: 2662
• Country:
• Not An Expert
Re: Software for calculating best resistors.
« Reply #20 on: May 29, 2024, 03:23:16 am »
I wrote a python script back in the day to do this.  Took my list of resistor values and did all the combination.  I would then sort them by % deviation from optimal value.  Worked great.  I have no idea where that script is now though

I bet chatGPT could write that first go.

• Frequent Contributor
• Posts: 359
• Country:
• Technically A Professional
Re: Software for calculating best resistors.
« Reply #21 on: May 29, 2024, 07:11:49 am »
This one is pretty nice for working with lots of constraints: http://calc.kirill-kryukov.com/electronics/resistor-network-finder/

Clever use of the stock entry boxes can get you to lots of fun places.

The following users thanked this post: ledtester, bpiphany

bpiphany

• Regular Contributor
• Posts: 132
• Country:
Re: Software for calculating best resistors.
« Reply #22 on: May 29, 2024, 10:25:39 am »
This one is pretty nice for working with lots of constraints: http://calc.kirill-kryukov.com/electronics/resistor-network-finder/

Clever use of the stock entry boxes can get you to lots of fun places.

That's very useful. I bought reels of resistors in E3 series, to never need to do it again.. For prototyping it's easy enough to stack two or three on an SMD footprint. But finding the best combination can bog you down in the combinatorics =p

Infraviolet

• Super Contributor
• Posts: 1061
• Country:
Re: Software for calculating best resistors.
« Reply #23 on: May 30, 2024, 01:19:08 am »
Not for this exactly, but I've done brute-force calculators in R/RStudio for more specific situations, like the three resistors needed for a comparator with hysteresis.

I'd give another vote towards writing your own with an input array where you can type in a list of the series of resistors E-x or whichever, or an E series plus some extra particular values you have around, and have it try combinations to find the closest to the desired resistance.

Nominal Animal

• Super Contributor
• Posts: 6442
• Country:
Re: Software for calculating best resistors.
« Reply #24 on: May 30, 2024, 12:10:15 pm »
Perfect use case for a static HTML+JavaScript tool page (no network connection required), since everyone and everything tends to have a browser nowadays.

For the input set of resistors, a simple regular expression matcher can parse typical formats (2R2, 2.2k) and even support precision definition, so that range arithmetic can provide an estimate on the result precision.  (Two cases per resistor, for each resistor.)

As usual, the problem is the interface; here, to limit the topology you're interested in.
One option would be to let the user specify the expression using ( ) + | and R1, R2, R3, ... as needed, with all combinations of the named resistors picked from the set of values, and the few combinations closest to the desired value shown.  Two in parallel and two pairs in series would be (R1|R2)+(R3|R4).

If you have N different resistances and K different resistors in the expression, it'd check NK or N!/(N-K)! = N(N-1)(N-2)⋯(N-K+2)(N-K+1) combinations, depending on whether one wants all combinations or only unique tuples.

Smf