standard value resistor / capacitor combination tool - Page 1
Forum section: electronics / projects

author: OM222O
author_rank: Frequent Contributor
timestamp: October 30, 2019, 02:19:30 am
content: I've been needing to use some resistor or capacitor values that are not standard and have to be achieved via using a combination of series or parallel resistors from the standard sets. This gets extremely tedious, especially when you do it by hand so I decided to write a python script to do it for meThis tool allows you to find a set of resistors (you can specify how many!) from a given standard set (supports E3 to E192!) that result in a desired final resistance.the interface is quite simple: there are two functions, each of which return a set of values that has been found. to call them you need 3 variables: the number of resistors that are used to reach the desired value, the standard set to use and finally the desired value. you can call them like below:Code:series(3,E24,6) #series(Number of resistors to use, Standard series , Resulting value)parallel(3,E24,6) #same interface as seriesalso there is a function which tidies up the results and prints them in a table like format. it's called print_results and takes two parameters: the title of the table and the values to be printed. it can be used like this:Code:print_results("Series resistor combinations: " , series(3,E24,6)) #This will print the results of searching for 3 resistors in E24 series that have a total of 6ohms resistanceI have also made an online version that you can use without even installing a python compiler. just go to the link below and run the program:https://repl.it/repls/WarpedOilyHarddrivethe names of the series you can use are listed at the very top (i.e: E192,E96,E48,etc. ) and the functions are called at the very bottom, so you can just change the values you're searching for at the very last 2 lines.My next goals are to add functionality to search for potential divider ratios and add a tolerance value as well, so if the exact value was not found, the results within tolerance are displayed. please leave your feedback and let me know if you would like to use a similar program if I make it a bit more user-friendly or if you think it's pointless and doing it by hand is still easier for you.

author: Brutte
author_rank: Frequent Contributor
timestamp: October 30, 2019, 09:12:45 am
content: Hi and thanks.Idea is ok but to make it practical you need to introduce tolerance and find all nearest solutions within tolerance and not empty sets: parallel(2,E24,2.1).Also, I suggest including some unit testing.For example currently parallel(2,E24,1) returns 1.5||3 which is unlikely.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 30, 2019, 09:18:51 am
content: You'll probably hate this but "it's been done":http://kirr.homeunix.org/electronics/resistor-network-finder/Kirill is on the forum if you have questions. Forget if he was working on a ratio too?Alsohttp://jansson.us/resistors.htmlwhich is simpler but does ratios.Tim

author: OM222O
author_rank: Frequent Contributor
timestamp: October 30, 2019, 05:41:19 pm
content: Quote from: Brutte on October 30, 2019, 09:12:45 amHi! the tolerance feature is now added. the 4th variable indicates the tolerance in percentage, you can check it again here:https://repl.it/repls/WarpedOilyHarddrivewhat do you mean by unit testing? 1.5 and 3 ohms does give you the value that you're looking for. if you want to use the same resistor value, then perhaps you should try increasing the number of allowed resistors to 3 or 4? or maybe I misunderstood your comment, please clarify in more detailsQuote from: T3sl4co1l on October 30, 2019, 09:18:51 amI don't claim to be the first one to come up with the idea and I don't even hate it! I actually used to search for that online, but most of them are hard to find / clunky or not flexible which wastes more time than actually doing them by hand which is a really backwards way of doing things. for example the links you provided: even after reading the help section, I still have no idea how to use the tool! As for the second one is easy to use, but it's only good if you want to use 2 resistors, not more. I'm still working on adding functionality such as exact voltage divider ratios. Obviously I'm biased towards my own work, but I think my tool is more flexible and easier to use compared to what already exists

author: Brutte
author_rank: Frequent Contributor
timestamp: October 30, 2019, 10:20:56 pm
content: Quote from: OM222O on October 30, 2019, 05:41:19 pmYes, you are right, I messed up the arguments.Anyway, it is not a bad idea to run some automated unit tests to check if your code works fine with every change included.

author: Kirr
author_rank: Regular Contributor
timestamp: October 30, 2019, 11:15:01 pm
content: Hey all,Nice to have more activity in this area!OM222O, nice code. It would probably be even more useful if it could mix parallel and serial connections.T3sl4co1l, thanks for mentioning my calculator! Yeah, I was going to add ratio targets, but did not get to it yet. Some day.Quote from: OM222O on October 30, 2019, 05:41:19 pmI'm really curious about what could be made more clear in my calculator interface. There's always space for improvement I guess! I will be thankful for any pointers as to what you find confusing or unintuitive!

author: Kirr
author_rank: Regular Contributor
timestamp: October 30, 2019, 11:42:59 pm
content: Quote from: OM222O on October 30, 2019, 05:41:19 pmJust for the purpose of avoiding misunderstanding, please allow me to highlight some of the features of Resistor Network Finder:1. It finds optimal networks among all possible topologies, and can mix serial, parallel and bridges. (The topologies to use are selectable).2. It allows using fully custom stock, by mixing standard range of values, specifying gaps (missing values), and extras (e.g., non-standard values).I think this qualifies my tool as uniquely flexible. (I don't think OM222O's tool has these features - yet?).As for the ease of use - it probably depends mostly on personal preferences. So, more different choices can be only good.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 31, 2019, 12:35:38 am
content: Hi Kirr, thanks for the feedback!I'll try to explain why I don't find the tool intuitive to use. here is what it looks like:The series is straight-forward, nothing wrong there.Having a few specific values seems odd, you usually design for a product which means buying stock shouldn't be an issue, but I guess it's fine for desperate times and one off builds.I have no idea what "All from - to -" means. all the values in the selected series? the custom input? what happens if both a standard set and some custom values are entered? maybe having a radio-button to select between the two is a good idea.How should the gaps be entered? are multiple gaps covered? is it specific values or a range? these are not mentioned in the help section.Extra values don't make any sense imho. if you had the money to have a custom value resistor made for you, the chances are that you get it in the exact value that you want, rather than having it mixed with other standard or even more non standard values! these are just practical considerations, but I think it should be taken into account.what are the "most useful additional values"? again nothing is mentioned in the help section.what is a resistor bridge? do you mean the famous Wheatstone bridge or a combination of series and parallel?There also seems to be some issues with the calculations of the tool. try searching for 14 ohm target , allow upto 3 resistors and set tolerance to 10%, it misses the obvious choice of 13+1 or 12+2 ohm resistors and tells you to just use the 13 ohm resistor anywaysnow that's not very helpful is it?I have managed to break my code as well during experimentations, but I will post an update when I fix it.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 31, 2019, 02:10:59 am
content: You can find the latest update here (I decided to make new addresses in order to stop breaking the code when people are using it):https://repl.it/repls/LustrousOddballSpoolI wrapped both search methods into one function , so the first parameter is now the searching method, but the rest are the same. the two methods are called:Quotethis version will find all the values and sorts them in order of tolerance (there might be some duplicates, due to rounding errors of floats which I don't think is easily fixable for right now, short of brute forcing values to a certain number of decimal places and converting back to floats which isn't a great solution). Other than that small gripe, I don't think I've missed anything, but feel free to correct me if you see something oddthis is just some code I threw together in a few hours.

author: Kirr
author_rank: Regular Contributor
timestamp: October 31, 2019, 02:12:36 am
content: Thank you for the excellent feedback, OM222O!Quote from: OM222O on October 31, 2019, 12:35:38 amYes, specific values in each decade is an edge case. I guess it's mostly useful for puzzles, like only using powers of 10.Quote from: OM222O on October 31, 2019, 12:35:38 amRight, "From ... to ..." is for specifying the range of the selected series. If left unspecified, the default is from 1 Ohm to 1 MOhm (indicated in the result report). However sometimes you may want to use larger range (e.g., till 22 MOhm range is still common depending on application), or reduce the range to speed up calculation (and avoid hitting the limit due to combinatorial explosion of possible networks).The "From .... to ..." range only applies to the fields above it in the form. I.e., to series and significands. The list of extra values does not care about range, because extra values are listed one by one.Quote from: OM222O on October 31, 2019, 12:35:38 amThey are mixed and used together!Quote from: OM222O on October 31, 2019, 12:35:38 amSpace-separated list of specific values. I'll have to add explanation for this, thanks and sorry for confusion!!Quote from: OM222O on October 31, 2019, 12:35:38 amNon-standard, in the sense that those values are not included in your selected series. This is useful in a very common scenario, where you stock the entire E24 series, and just some selected E48 or E96 that you needed previously, so you stocked 200 of them. So you select E24 series, and add those extra values in the extra list. This allows specifying your entire stock in such mixed series cases.Quote from: OM222O on October 31, 2019, 12:35:38 amThis is indeed a weak point of my tool. It's currently underpowered and unfinished. I should probably move this function to a separate tool. The idea is simple though - it's for suggesting which extra value you need to get to be able to achieve all your target values, using your current stock + the additional value. I admit that it's of mainly theoretical interest.Quote from: OM222O on October 31, 2019, 12:35:38 amYes, it's Wheatstone bridge with a resistor on all 5 connections. Such topology can produce values that cannot be obtained by only series and parallel connections of 5 resistors.Quote from: OM222O on October 31, 2019, 12:35:38 amThe tool adds another resistor only if it did not hit the error target yet. Since 13 Ohm is already within 10% of 14 Ohm, the tool is satisfied, and does not add second resistor. If you are looking for the most precise fit possible, it's best to set the error to 0.Thanks for great questions and feedback! It seems I have work to do!

author: OM222O
author_rank: Frequent Contributor
timestamp: October 31, 2019, 02:28:18 am
content: Quote from: Kirr on October 31, 2019, 02:12:36 amI see! I get around that issue entirely by using these few lines to "normalize" the data to a range between 0 and 10:Code:unmodified_x = xscale_factor = 1if (x>np.amax(values)):while(x>np.amax(values)):scale_factor *= 10x /= 10elif(x<np.amin(values)):while(x<np.amin(values)):scale_factor /= 10x *= 10I'm not sure which language you're using, but you should be able to do a very similar thing. In order to use values close to the desired one, I'm adding more values to the set which are one order of magnitude larger or smaller than the values in the series:Code:values = np.hstack((values/10 , values))values = np.hstack((values , values*10))I figured that 10 times larger and smaller should be good enough since the effects of resistors outside that range are either way too large (parallel resistors that are 10 times smaller or series resistors that are 10 times larger!) or way too small (opposite of what I said before). but you can easily add 100 times or even 1000 times values. this keeps the finite element analysis under control and prevents data sizes from explodingyou can completely bypass the range issue this way.If you really want to use notations such as K m etc, it's as simple as keeping a copy of the notation used, normalizing and finding the values, then sticking the notation to the end of all the results. it's a really basic formatting issue haha. This greatly simplifies your code and makes the software less confusing in my opinion!Quote from: Kirr on October 31, 2019, 02:12:36 amOh! so this tries to find a best match that is larger than the provided tolerance, I see! it seems a bit of a backwards way to do things since you miss most of the values that actually meet the spec you want and seems like always choosing 0 is the best optionI tried it with 0 tolerance and it still only found one possible solution: 13 + 1, but there are indeed 3 solutions: 13 + 1 , 12 +2 and 11 + 3. the output is formatted like a table, so I assume you planned on displaying more than just a single result? I'm not sure tbh.

author: Kirr
author_rank: Regular Contributor
timestamp: October 31, 2019, 06:04:32 am
content: Quote from: OM222O on October 31, 2019, 02:28:18 amI see. So you are effectively auto-ranging the 3 decades of stock around the requested target value. I'm not a fan of this approach, because:1. If the target value is close to the lower or upper bound of the actual stock range, your calculation will include values that are in fact not stocked. E.g., when requesting 1.12 Ohm value, your tool will assume I have values from 0.1 to 1 Ohm in stock, even though this might not be the case.2. When requesting a value closer to the middle of actual stock, your tool won't use the entire stock, even though it might help to get a better fit for some values. (Though I don't have statistics about how often such remote values help).Quote from: OM222O on October 31, 2019, 02:28:18 amI used D in this case. I also use auto-ranging, but for a different purpose. I calculate using rational numbers, and adjusting range helps to avoid overflows.Quote from: OM222O on October 31, 2019, 02:28:18 amNot sure I read this correctly, but won't you end up with two copies of the original values? Since the second line takes the already doubled range?Quote from: OM222O on October 31, 2019, 02:28:18 amYeah, adding unit prefixes is not a big problem. Though I prefer the other way around: "k" and "M".Quote from: OM222O on October 31, 2019, 02:28:18 amFor practical purposes, usually smaller network is preferable, among those satisfying the required tolerance. But possibly this shortcut can be counter-intuitive or unexpected. I'll think about how to better explain it.Quote from: OM222O on October 31, 2019, 02:28:18 amYeah, displaying multiple results could be sometimes useful. I haven't needed this personally. In case if I don't like the particular suggested network, I can put one of the used values into Gaps list and recompute, to see what else is available. But may be I'll add multiple answers option some day.As for the table output - it's for cases when you request multiple target values.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 31, 2019, 12:09:27 pm
content: Quote from: Kirr on October 31, 2019, 06:04:32 amNot sure I read this correctly, but won't you end up with two copies of the original values? Since the second line takes the already doubled range?Good catch hahait's a simple fix however:Code:values = np.hstack((values/10 , values , values*10))it was just another one of the bugs left from the debugging stageQuote from: Kirr on October 31, 2019, 06:04:32 amwhen requesting 1.12ohm for example, it's larger than the base value which is 1, so it searches from 0.1ohm to 10 ohm. if the stock is only limited to resistors of higher than 1 ohm, then parallel is your best bet, otherwise series is fine too. it just comes down to how you plan on designing the final schematic and here the advantage of having a large list of values helpsyou choose the values that best fit your stock.I'm not sure what you mean by it doesn't use the entire stock if middle is chosen. It creates a list of all possible n element sub-arrays (where n is the number of resistors chosen) then calculates the sum based on the chosen method (parallel or series), stores all the values and filters the ones where the sum is within tolerance of the desired value. I'm not actually "solving a network", I'm doing finite element analysis and filtering the good values from all the possibilities.

author: Kirr
author_rank: Regular Contributor
timestamp: October 31, 2019, 02:49:03 pm
content: Quote from: OM222O on October 31, 2019, 12:09:27 pmQuote from: OM222O on October 31, 2019, 12:09:27 pmOK, I played a bit with both our tools to work out some examples. Here is one:For example, let's say we have a full stock of E12 values, in the range from 1 Ohm to 1 MOhm.And let's say I we need three missing values: 6.73k, 67.3k and 673k, to be approximated using parallel networks of at most 2 resistors.My tool suggests the following:Formated as: "Request: Approximation = Network (Error)"6.73k: ~6.733k = 6.8k || 680k (0.039%)67.3k: ~67.754k = 82k || 390k (0.675%)673k: 680k = 680k (1.040%)In other words, it respects the boundary of our stock at 1 MOhm. When we request a value closer to the middle of stock range (6.73k), the tool has more options and thus can find a closer fit. However as the request gets closer to the boundary, options get more limited, and error gets larger.I then tried your tool using:Code:print_results("Parallel combinations for 6.73k: " , find_combo(parallel,2,E12,6730,1))print_results("Parallel combinations for 67.3k: " , find_combo(parallel,2,E12,67300,1))print_results("Parallel combinations for 673k: " , find_combo(parallel,2,E12,673000,1))which generates:Code:Parallel combinations for 6.73k:0.7% -> 8200.00 39000.001.0% -> 12000.00 15000.00########################################Parallel combinations for 67.3k:0.7% -> 82000.00 390000.000.9% -> 120000.00 150000.00########################################Parallel combinations for 673k:0.7% -> 820000.00 3900000.001.0% -> 1200000.00 1500000.00########################################Which means:1. Your tool does not find the optimal approximation when extra range is available. It suggests 8.2k || 39k rather than more optimal 6.8k || 680k, because it looks only one decade away from the target value. (Of course you can add more decades by adding values*100 and values/100).2. Your tool feels free to use values that we don't have in our stock: When building 673k it uses 3.9M, which we don't have.(Both issues are rooted in there being no interface to specify stock boundaries).Which summarily means that your tool uses the stock that it feels convenient to use, rather than the actual stock available to a project. I personally feel this is important limitation, as I like my actual stock to be respected and fully utilized. I guess your approach may be OK if you make sure to only request targets that are at least 1 decade away from your stock bondaries, and don't mind occasionally missing a better fit.

author: mariush
author_rank: Super Contributor
timestamp: November 01, 2019, 07:41:44 pm
content: I was bored and decided to complete a similar tool I started to write some time ago.So I uploaded it here:https://github.com/mariush-github/resistor-calculator-phpIt's written in PHP, you can simply download a Windows version of php and typephp.exe calculator.php --value 100to get combinations of resistors that produce 100 ohm resistor.It allows up to 4 resistors and mixes of series and parallel, but keep in mind it's a memory hog : if you choose 3 or 4 resistors, you may have to go in php.in and raise the memory limit from 128 MB to 1024-2048 MB.I may rewrite it in Go as an exercise, for faster speed and less memory usage, and to play around with the concurrency features of Go.I suppose you could also add a feature to import a list of resistors you actually own.Example:php.exe calculator.php --min 100 --max 10000 --e 24 --tol 1 --mix 1 --results 50 --count 4 --value 470will give 938 results, which are dumped in CSV files (three separate files). The closest are printed on screen, up to 100.Results are grouped by resistor count by default (there's parameter you can set to 0 to disable this)Code:2 470 0.000% 360 + 1102 470 0.000% 270 + 2003 470 0.000% 390 + 2p1603 470 0.000% 360 + 2p2203 470 0.000% 160 + 2p6203 470 0.000% 130 + 2p6803 470 0.000% 270 + 100 + 1003 470 0.000% 240 + 130 + 1003 470 0.000% 240 + 120 + 1103 470 0.000% 220 + 150 + 1003 470 0.000% 220 + 130 + 1203 470 0.000% 200 + 160 + 1103 470 0.000% 200 + 150 + 1203 470 0.000% 180 + 180 + 1103 470 0.000% 180 + 160 + 1303 470 0.000% 160 + 160 + 1504 470 0.000% 2p430 + 2p5104 470 0.000% 430 + 3p1204 470 0.000% 300 + 3p5104 470 0.000% 390 + 3p2404 470 0.000% 360 + 3p3304 470 0.000% 220 + 3p7504 470 0.000% 2p120 + 2p8204 470 0.000% 180 + 110 + 2p3604 470 0.000% 160 + 130 + 2p3604 470 0.000% 220 + 100 + 2p3004 470 0.000% 200 + 120 + 2p3004 470 0.000% 160 + 160 + 2p3004 470 0.000% 300 + 110 + 2p1204 470 0.000% 300 + 120 + 2p1004 470 0.000% 270 + 100 + 2p2004 470 0.000% 270 + 110 + 2p1804 470 0.000% 270 + 120 + 2p1604 470 0.000% 270 + 150 + 2p1004 470 0.000% 240 + 110 + 2p2404 470 0.000% 220 + 130 + 2p2404 470 0.000% 240 + 120 + 2p2204 470 0.000% 200 + 150 + 2p2404 470 0.000% 240 + 130 + 2p2004 470 0.000% 240 + 180 + 2p1004 470 0.000% 240 + 150 + 2p1604 470 0.000% 200 + 160 + 2p2204 470 0.000% 220 + 150 + 2p2004 470 0.000% 220 + 200 + 2p1004 470 0.000% 180 + 180 + 2p2204 470 0.000% 220 + 160 + 2p1804 470 0.000% 200 + 180 + 2p1804 470 0.000% 160 + 110 + 100 + 1004 470 0.000% 150 + 120 + 100 + 1004 470 0.000% 150 + 110 + 110 + 100

author: Kirr
author_rank: Regular Contributor
timestamp: November 02, 2019, 04:21:48 am
content: mariush, very cool!I see your example has networks like "430 + 3p120", which means I guess that 3 of 120 are connected in parralel, and then serially with 430. I guess it's not restricted to only use identical values in parallel connections? Also, can it parallel serially connected sub-networks? Curious because as I haven't yet tried it myself.E.g., can you try making 474 or 478 Ohm out of up to 4 E3 values (in the range of 1 Ohm to 1 MOhm)? Curious what it will find for these cases.OM222O, I hope you are not discouraged by the complexity of this problem!Cheers!

author: mariush
author_rank: Super Contributor
timestamp: November 02, 2019, 04:49:40 am
content: Yes, s means in series and p means in parallel ... so 10 | 3s100 means 10 paralleled with 3 100 resistors in series (a 300 ohm resistor)The software isn't that "smart", it just takes a brute force approach, generating all unique combinations of 2..4 resistors and does the math to figure out if the final value is within the tolerance.If the total number of resistors is below the maximum resistors you opted for the script splits resistors in 2 or 3, or doubles them and does the math again.So right now it's just all series, all parallel, or series+parallel combinationsto answer your question ... here's 474 ohm, 50 results :Note it's assuming 1% max error, 5% gives 221 results for the 474 ohm ...also used --group 0 so it's sorted by error instead of smallest number of resistors first)Code:4 473.934 0.014% 1000 | 1000 | 10000 | 1000004 474.2 0.042% 470 + 2.2 + 1 + 13 474.4 0.084% 470 + 2.2 + 2.24 474.55 0.116% 470 + 2.2 + 2p4.74 473.35 0.137% 470 + 1 + 2p4.74 473.333 0.141% 470 + 3p102 474.7 0.148% 470 + 4.74 473.3 0.148% 470 + 2.2 + 2p2.23 473.2 0.169% 470 + 2.2 + 13 475 0.211% 470 + 2p104 473 0.211% 470 + 1 + 1 + 14 475.162 0.245% 1000 | 1000 | 10000 | 2200004 475.2 0.253% 470 + 4.7 + 2p14 472.7 0.274% 470 + 2.2 + 2p14 475.4 0.295% 470 + 2.2 + 2.2 + 13 472.35 0.348% 470 + 2p4.73 475.7 0.359% 470 + 4.7 + 14 475.709 0.361% 1000 | 1000 | 10000 | 4700002 472.2 0.380% 470 + 2.24 475.8 0.380% 470 + 4.7 + 2p2.24 472.1 0.401% 470 + 1 + 2p2.24 475.964 0.414% 1000 | 1000 | 10000 | 10000004 476 0.422% 470 + 1 + 2p103 472 0.422% 470 + 1 + 14 472 0.422% 220 + 220 + 22 + 103 476.19 0.462% 1000 | 1000 | 100004 471.567 0.513% 470 + 3p4.74 471.5 0.527% 470 + 1 + 2p14 471.414 0.546% 1000 | 1000 | 10000 | 470004 476.6 0.549% 470 + 2.2 + 2.2 + 2.24 476.7 0.570% 470 + 4.7 + 1 + 14 471.285 0.573% 1000 | 2200 | 2200 | 47003 471.1 0.612% 470 + 2p2.23 476.9 0.612% 470 + 4.7 + 2.22 471 0.633% 470 + 14 477 0.633% 220 + 22 + 2p4704 477.05 0.643% 470 + 4.7 + 2p4.74 477.2 0.675% 470 + 2.2 + 2p104 470.733 0.689% 470 + 3p2.24 477.333 0.703% 470 + 3p223 470.5 0.738% 470 + 2p14 470.333 0.774% 470 + 3p14 477.9 0.823% 470 + 4.7 + 2.2 + 14 470 0.844% 2p470 + 2p4702 469.779 0.891% 470 | 10000004 478.261 0.899% 1000 | 1000 | 22000 | 220003 469.559 0.937% 470 | 1000000 | 10000002 469.53 0.943% 470 | 4700004 469.338 0.984% 470 | 1000000 | 1000000 | 10000003 469.31 0.989% 470 | 470000 | 1000000Here's 478 ... 41 results.Code:4 477.9 0.021% 470 + 4.7 + 2.2 + 14 478.261 0.055% 1000 | 1000 | 22000 | 220004 477.333 0.140% 470 + 3p224 477.2 0.167% 470 + 2.2 + 2p104 477.05 0.199% 470 + 4.7 + 2p4.74 477 0.209% 220 + 22 + 2p4704 479.1 0.230% 470 + 4.7 + 2.2 + 2.23 476.9 0.230% 470 + 4.7 + 2.24 476.7 0.272% 470 + 4.7 + 1 + 13 479.4 0.293% 470 + 4.7 + 4.74 476.6 0.293% 470 + 2.2 + 2.2 + 2.24 479.7 0.356% 470 + 4.7 + 2p103 476.19 0.379% 1000 | 1000 | 100002 480 0.418% 470 + 104 476 0.418% 470 + 1 + 2p104 475.964 0.426% 1000 | 1000 | 10000 | 10000004 475.8 0.460% 470 + 4.7 + 2p2.24 475.709 0.479% 1000 | 1000 | 10000 | 4700003 475.7 0.481% 470 + 4.7 + 14 480.4 0.502% 470 + 4.7 + 4.7 + 14 480.5 0.523% 470 + 10 + 2p14 475.4 0.544% 470 + 2.2 + 2.2 + 14 475.2 0.586% 470 + 4.7 + 2p14 475.162 0.594% 1000 | 1000 | 10000 | 2200003 481 0.628% 470 + 2p223 475 0.628% 470 + 2p103 481 0.628% 470 + 10 + 14 481.1 0.649% 470 + 10 + 2p2.22 474.7 0.690% 470 + 4.74 474.55 0.722% 470 + 2.2 + 2p4.74 481.6 0.753% 470 + 4.7 + 4.7 + 2.23 474.4 0.753% 470 + 2.2 + 2.24 474.2 0.795% 470 + 2.2 + 1 + 14 482 0.837% 470 + 1 + 2p224 482 0.837% 470 + 10 + 1 + 14 473.934 0.851% 1000 | 1000 | 10000 | 1000003 482.2 0.879% 470 + 10 + 2.24 482.35 0.910% 470 + 10 + 2p4.74 473.35 0.973% 470 + 1 + 2p4.74 473.333 0.976% 470 + 3p104 473.3 0.983% 470 + 2.2 + 2p2.2

author: OM222O
author_rank: Frequent Contributor
timestamp: November 02, 2019, 12:05:22 pm
content: Quote from: Kirr on November 02, 2019, 04:21:48 amUnfortunately I have a few university assignments taking all of my time, so I can't work on the tool right now. I will come back and update it as soon as I have enough time

author: Kirr
author_rank: Regular Contributor
timestamp: November 03, 2019, 09:59:19 am
content: Quote from: mariush on November 02, 2019, 04:49:40 amI see!For reference, my tool's suggestion for the same question (found with maximum precision, target error = 0):Format: "Request: Approximation = Network (Error)"474: ~474.001 = 470k || (4.7 + (470 || 1M)) (0.000%)478: ~478.000 = 10 + (470 || (10k + 100k)) (0.000%)I am beginning to miss multiple answer output.Quote from: OM222O on November 02, 2019, 12:05:22 pm

author: mariush
author_rank: Super Contributor
timestamp: November 03, 2019, 10:22:24 am
content: I've updated the code on github (see post above), used a trick to make it much faster and not have to cache stuff on disk, now it runs faster and with much less memory usage.Yes, the version I made currently lacks the feature of going "three levels deep" as in :474: ~474.001 = 470k || (4.7 + (470 || 1M)) (0.000%)it can do R1 || R2, or R1+R2, and then goes one level deeper where R1 or R2 or both are split and the operation between these two resistors is the opposite of the operation between R1 and R2So, you get(R1a+R1b) || R2R1 || (R2a + R2b)(R1a+R1b) || (R2a + R2b)I do this (alternate parallel and sum) because if the user says "i want up to 4 resistors", I'd get duplicate results otherwise ex.Solution 1: 2 resistor groups: (R1a+R1b) + (R2a+R2b)Solution 2: 4 resistors R1a + R1b + R2a + R2bI can certainly add a third level, provided the maximum number of resistors allows going deeper.ex if you say up to 4 resistors, and a solution is 0.5% close to desired value and looks like this R1 || ( 2sR2), the code could further split the 2 R2 in series to R2 + ( R3||R4) and I arrive to your result.I was reluctant to add this because when using E96 or E192 ranges it takes a long time even with just 4 resistors (20s or so to go through the 20 million or whatever unique combinations of 4 resistors, using only 128 closest resistors to desired value)It would work ok with a reduced set, like E24 and restricting to let's say 1 ohm min, 100k max

author: Kirr
author_rank: Regular Contributor
timestamp: November 04, 2019, 04:14:59 am
content: Quote from: mariush on November 03, 2019, 10:22:24 amNice. Will have to download and play with it some time.Quote from: mariush on November 03, 2019, 10:22:24 amInteresting, because my tools works from the opposite direction: Starts with single resistors, and then combines them into networks of two. Then combines those into next set of networks, and so on.Quote from: mariush on November 03, 2019, 10:22:24 amYes, huge number of combination is a major problem with the brute force approach (which I also use). My tool stops searching when the number of network required for next iteration (with another added resistor) is greater than 20 million (IIRC). However when the stocked range is small, even larger networks are possible, up to 6 resistors in case of my tool. (Although for practical uses simple approaches are often enough).

author: sleemanj
author_rank: Super Contributor
timestamp: November 04, 2019, 04:52:40 am
content: FWIW some years ago I made this...https://sparks.gogo.co.nz/resistor_paralleler.htmlwhich works on a slightly different basis in that it is focused around using resistors you actually keep in stock rather than just a full set of all values in a series.I keep roughly a "half set" of a series, with a few "holes" (values I don't keep) and "bumps" (values not in the series but I do keep), I made the tool to help me find appropriate mostly parallel combinations (because SMD resistors can easily be stacked on top of each other in a hobby situation), and as a last resort some series ones.

author: Kirr
author_rank: Regular Contributor
timestamp: November 05, 2019, 02:11:03 am
content: Quote from: sleemanj on November 04, 2019, 04:52:40 amYes, another fine tool. I have it linked in the links section on the about page of my tool.By the way, OM222O and mariush, please let me know if you like your tools linked there (and url).Quote from: sleemanj on November 04, 2019, 04:52:40 amI think we both share the idea of using the real actual stock. (Your "holes" and "bumps" are "gaps" and "extras" in my tool, but otherwise same thing).

author: mariush
author_rank: Super Contributor
timestamp: November 05, 2019, 10:50:07 am
content: You can do whatever you want, the repository is publicI added loading resistors from a file (values separated by new lines, commas, tabs , and it's also possible to enter 2r2 or 100k or 0.1m .. that's all, just r,k,m are detected and handled)Making an exclusion list would also be possible and easy.Here's link again if people don't want to scroll up a lot :https://github.com/mariush-github/resistor-calculator-phpI'm still interested in doing that "deep" search ( using series and parallel and series, not just two "levels" of mixing) like your version does, but have other things to work on at the moment.

author: Kirr
author_rank: Regular Contributor
timestamp: November 05, 2019, 03:27:33 pm
content: Added link and tweaked interface a bit.A puzzle for testing these calculators (not a practical task, just for fun): Suppose you have E3 series from 1R to 470R (ideal resistors). Which network of at most 5 resistors gives precisely 4.64 Ohm (with 0% error)? Compacted.