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

0 Members and 1 Guest are viewing this topic.

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2653
  • Country: fr
    • kripton2035 schematics repository
Re: Software for calculating best resistors.
« Reply #25 on: May 30, 2024, 12:36:46 pm »
I want to have a 117 ohm resistor using standard E12 values and combining max 4 resistors in serie or parallel.

ChatGPT (hallucinating mode ?)
Quote
To achieve a 117 ohm resistor using standard E12 resistor values and combining a maximum of 4 resistors in series or parallel, we can utilize a combination of resistors from the E12 series which includes the following values (in ohms): 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82. Here's how we can do it:

Let's start by looking at potential combinations:

Series Combination: We can connect resistors in series to increase the total resistance. To get 117 ohms, we need to add up values that sum up to 117.

By inspection, we can see that 82 ohms + 33 ohms + 2 ohms (from parallel combination of 10 and 22 ohms) gets us 117 ohms. However, this exceeds the limit of 4 resistors.

Parallel Combination: We can connect resistors in parallel to decrease the total resistance. Here, we need to find a combination that adds up to 117 ohms or is close to it.

By inspection again, we see that 56 ohms + 33 ohms + 18 ohms + 10 ohms in parallel gets us 117. This is within the limit of 4 resistors.

So, we can use a combination of 56 ohms, 33 ohms, 18 ohms, and 10 ohms resistors connected in parallel to achieve approximately 117 ohms. Let's calculate the exact total resistance:

1 / (1/56 + 1/33 + 1/18 + 1/10) = 1 / (0.01786 + 0.03030 + 0.05556 + 0.1) = 1 / 0.20372 ≈ 4.904 ohms.

Therefore, the combination of these resistors in parallel will yield a resistance close to 117 ohms, and it satisfies the criteria of using standard E12 resistor values and a maximum of 4 resistors.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5112
  • Country: ro
  • .
Re: Software for calculating best resistors.
« Reply #26 on: May 30, 2024, 12:51:29 pm »
142 in parallel with 680 gives you 117.4 ohm    142 can be made with 120 + 22 ohm in series

3300 || 270 || 220 gives you 116.92 ohm


chatGPT doesn't surprise me....
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2653
  • Country: fr
    • kripton2035 schematics repository
Re: Software for calculating best resistors.
« Reply #27 on: May 30, 2024, 02:56:29 pm »
yes it is VERY BAD at anything calculated...
 

Offline Tation

  • Regular Contributor
  • *
  • Posts: 72
  • Country: pt
Re: Software for calculating best resistors.
« Reply #28 on: May 30, 2024, 04:56:25 pm »
yes it is VERY BAD at anything calculated...

IMHO, uses to be syntactically correct, semantically absurd.
 

Offline bpiphany

  • Regular Contributor
  • *
  • Posts: 132
  • Country: se
Re: Software for calculating best resistors.
« Reply #29 on: May 31, 2024, 07:08:50 am »
Actually 56+33+18+10=117 in series. Perhaps a coincidence on the hallucinogens.


Edit: and according to the nifty calculator above

Code: [Select]
Target Approximation Network Error Error ≤ 0.1?
117 ~117.012 120 || 4.7k 0.011%
« Last Edit: May 31, 2024, 07:12:40 am by bpiphany »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19706
  • Country: gb
  • 0999
Re: Software for calculating best resistors.
« Reply #30 on: June 01, 2024, 12:51:58 pm »
1% tolerance resistors can be found in E24 values. There's normally no point in aiming for much less than 0.2% or so, because the resistor tolerance will dominate. Fortunately that should be possible to make a potential divider with three resistors to get a ratio to that tolerance for most ratios, especially the smaller ones.

Awhile ago I made myself some tables with different combinations of E6, E12 and E24 values to make E24 and E96 values. I don't use them much nowadays because there are better online calculators.


 
The following users thanked this post: ledtester

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14967
  • Country: fr
Re: Software for calculating best resistors.
« Reply #31 on: June 01, 2024, 10:22:02 pm »
For those interested in understanding how the E-series are built instead of just blindly using tables of values: https://en.wikipedia.org/wiki/E_series_of_preferred_numbers
 

Offline golden_labels

  • Super Contributor
  • ***
  • Posts: 1290
  • Country: pl
Re: Software for calculating best resistors.
« Reply #32 on: June 04, 2024, 07:12:58 am »
Xvr published a divider solver.

It only models a voltage divider, so not exactly the same tool. But certainly worth looking at. An amazing, comprehensive tool.

Instructions for solving a subset of problems from this thread. For all configurations unset Vout and also unset its target status.

2 resistor in series:
Set Rin as target, in “Restricted” tab set the desired value and allowed margins. Run solver.

2 resistor in parallel:
Set Rout as target, in “Restricted” tab set the desired value and allowed margins. Run solver.


« Last Edit: June 04, 2024, 07:34:27 am by golden_labels »
People imagine AI as T1000. What we got so far is glorified T9.
 

Offline Tation

  • Regular Contributor
  • *
  • Posts: 72
  • Country: pt
Re: Software for calculating best resistors.
« Reply #33 on: June 04, 2024, 02:29:50 pm »
I'm feeling than that all these calculators do have a little flaw: they do not take into account the tolerance.

I mean, as stated before, E12 value 12 can be achieved as a series of E3 values 10 + 2.2. But E12 values have a tolerance of 10 %, so we want to be inside 12 ± 10 % ⇒ between 10.8 and 13.2. In order for a series of two resistors of 10 and 2.2 to be inside such margin, they must have a tolerance of 5 %, otherwise there is a possibility of their series being outside such interval.

In doing these calculations I'm considering/assuming that:
  • (assumption) The resistance of resistors is distributed normally (Gaussian) with mean equal to the nominal value of the resistor and standard deviation proportional to the product of nominal value times tolerance
  • Thus, conductance of a given resistor, provided that the tolerance is small, is also distributed normally with mean the inverse of the resistor nominal value and equal tolerance than the resistance
  • (assumption) The true resistance values of two resistors are uncorrelated
  • Thus, the resistance of a series of two resistors distributes normally with mean the sum of both resistors nominal values and \(\sigma=\sqrt{\sigma_1^2 + \sigma_2^2}\)
  • Thus, the series of two resistors of equal tolerance \(T_0\) has tolerance \(T=T_0{\sqrt{R_1^2+R_2^2}\over R_1+R_2}\)
  • The «tolerance» in resistance of a parallel combination of two resistors of tolerance \(T_0\) has exactly the same expression as the series case

It is interesting to note that the tolerance of a series/parallel combination of two resistors has a tighter tolerance than the original resistors. In spite of this, there are cases (the 12 ≈ 10 + 2.2 above) when we need resistors of tighter tolerance than that of the target E series. In this example case, if using 10 % resistors, the nominal value of the series is 12.2, and its tolerance 8.4 %, so can expect values between 11.26~13.22, outside by a little of the desired 10.8~13.2. If the resistors are 5 %, the final range would be 11.71~12.71 ⇒ OK.

Maybe I'm a bit picky here, but had a fun time this morning doing these calculations  ;D 
« Last Edit: June 04, 2024, 02:32:26 pm by Tation »
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5112
  • Country: ro
  • .
Re: Software for calculating best resistors.
« Reply #34 on: June 04, 2024, 09:37:29 pm »
I'm feeling than that all these calculators do have a little flaw: they do not take into account the tolerance.

I mean, as stated before, E12 value 12 can be achieved as a series of E3 values 10 + 2.2. But E12 values have a tolerance of 10 %, so we want to be inside 12 ± 10 % ⇒ between 10.8 and 13.2. In order for a series of two resistors of 10 and 2.2 to be inside such margin, they must have a tolerance of 5 %, otherwise there is a possibility of their series being outside such interval.


I don't agree with this... in these days, the manufacturing process of resistors is good enough and the resistors are cheap enough that you would probably have a hard time getting even higher than 5% tolerance.

They most likely bin the resistors automatically and reserve the <1% for the 1% tolerance, <3-4% for the 5% bucket and on 10% you'd probably get anything higher than 3-4% or you'd just get the ones binned for <5%.

Sure, account tolerance, but aim for under 5% at most ... nowadays I just default on 1% resistors because they're cheap enough. 
 

Offline Tation

  • Regular Contributor
  • *
  • Posts: 72
  • Country: pt
Re: Software for calculating best resistors.
« Reply #35 on: June 05, 2024, 09:36:03 am »
I've found that with only 2 resistors from the E12 series, sometimes in series, others in parallel, one can reach (under the assumptions above):
  • all E24 values with 5% tolerance if the E12 resistors are 5%
  • all E24 values with 2% tolerance if the E12 resistors are 2%
  • all E24 values with 0.2% tolerance if the E12 resistors are 0.1%
  • all E48 values with 2% tolerance if the E12 resistors are 1%
  • all E48 values with 1% tolerance if the E12 resistors are 0.5%
  • all E96 values with 1% tolerance if the E12 resistors are 0.1%
  • almost all E192 values (but nine: 1.13, 1.37, 1.91, 2.05, 2.37, 2.43, 4.42, 6.34, 9.31) with 0.5% tolerance if the E12 resistors are 0.1%
  • almost all E192 values (but one: 9.31) with 0.5% tolerance if the E12 resistors are 0.01%
« Last Edit: June 05, 2024, 09:54:25 am by Tation »
 

Offline mike449

  • Contributor
  • Posts: 13
  • Country: us
Re: Software for calculating best resistors.
« Reply #36 on: June 05, 2024, 08:03:19 pm »
 
The following users thanked this post: Smokey

Offline snarkysparky

  • Frequent Contributor
  • **
  • Posts: 416
  • Country: us
Re: Software for calculating best resistors.
« Reply #37 on: June 22, 2024, 05:58:13 pm »
simple parallel pair finder for Octave

Code: [Select]
% parallel resistor finder.  Finds the closes pair of resistors
% in the inventory to approximate a desired resistor value

% all the resistors in your kit..  spaces between values.  ... for line continue
rvals = [100 200 470 590 1000 2000 3000 3900 4700 4900 ...
         4990 10000 22000 3900 15000];

rtarget = 8700;   % needed resistance

[rw cl] = size(rvals);  % get how many resistors in stock

H = ones(1,cl);

H = rvals' * H;  % matrix of resistor values with equal rows

V = H';          % matrix of resistor values with equal columns

ParVals = rvals' * rvals;   %product of all resistor values.  Rx*Ry

Parvals = ParVals ./ ( H + V);   %  parallel values

Diff = abs(rtarget - Parvals);  % abs value of error between each entry and target

error = min(min(Diff));    % smalles absolute value

ggg = tril(Diff == error);  %  set to 1 all matching locations in lower triangular matrix

[rw cl]  = find(ggg);   % get the indices of the two resistors

R1 = rvals(cl)       % show first resistor

R2 = rvals(rw)       % show second resistor

Result = R1*R2/(R1+R2)  % calculate resulting parallel combination

ErrPercent = abs((Result - rtarget)/rtarget)*100    %  percent error




 

Offline mendip_discoveryTopic starter

  • Frequent Contributor
  • **
  • Posts: 933
  • Country: gb
Re: Software for calculating best resistors.
« Reply #38 on: July 03, 2024, 08:27:36 pm »
Woops I forgot about this for a bit.

What I was hoping to do was measure a selection of resistors, let us say 10k and from the ones that are a little under and a little over etc work out the best to use to produce the closest to absolute 10k you can. The plan is to make a few DIY standard resistors that use 2 resistors in series, parallel to another 2 resistors in series.

But its nice it started up the conversation again.
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.
 

Offline mendip_discoveryTopic starter

  • Frequent Contributor
  • **
  • Posts: 933
  • Country: gb
Re: Software for calculating best resistors.
« Reply #39 on: July 15, 2024, 05:17:58 pm »
Just saw this on the Metrology section posted by @ch_scr
https://www.eevblog.com/forum/metrology/precise-measurement-of-high-value-resistors/msg5573563/#msg5573563

[...] I needed some accurate 100M resistors, so I measured a load of 10M 1% metal film resistors individually on a 34410A, added the numbers together and added a trim resistor to get an accurate 100M. Yes, eleven resistors in series. [...]
I've made a python script for just this application. It takes the list of your measured samples and the target value,
and it'll automagically tell you which ones will make a string that's exactly on point. Or rather, how close it gets. It takes surprisingly little overhead to find a "real close" combination.
The idea is, if the stock has a Gaussian spread, the right combination of "odd values" ends up stacking exactly right. The script tries them all for you.

Functions:
Code: [Select]
string_optimizer.py -h
usage: string_optimizer.py [-h] [-i] [-p [R_P [R_P ...]]] Target S/P N R [R ...]

Tool to optimize resistor series string or parallel connection for lowest initial error

positional arguments:
  Target                target value of the series/parallel connection to be optimized for (e.g., 10.198523)
  S/P                   choose between (S)eries or (P)arallel connection
  N                     number of resistors to be selected for connection
  R                     resistor values, space separated

optional arguments:
  -h, --help            show this help message and exit
  -i, --iter            show each iteration that finds a new best value
  -p [R_P [R_P ...]], --prio [R_P [R_P ...]]
                        specify resistor(s) values that will be assumed fixed
Example for a target of 100 Meg, series connection, 10 resistors to be selected and 12 measured values
Code: [Select]
string_optimizer.py 100.00 S 10 9.999 10.010 10.123 10.001 9.890 9.780 9.991 10.1 9.8999 10.01 9.987 9.897

Residual error 80.00000 ppm
With these 10 in series:
(9.999, 10.01, 10.123, 10.001, 9.89, 9.991, 10.1, 10.01, 9.987, 9.897)

I have attached it below just to save people hunting 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf