Script to calculate best resistor pairs - Page 1
Forum section: electronics / projects

author: cellularmitosis
author_rank: Unknown
timestamp: April 14, 2017, 05:07:18 am
content: I've been working on some circuits which use difference amplifiers, which need very closely matched resistors in order to perform well. (Actually, all that matters is that the ratios of the two resistor pairs are matched.)It turns out that if you grab 10 random 1% resistors, if you consider all possible pairings, the best pairing is usually pretty good.I wrote a script which does all of the combinatorics for you. Just list out your resistors in a file and feed it to the script. Note: this script assumes all of your resistors are of equal nominal value (i.e, you are designing a diff-amp with a gain of 1x).Here's 10 resistors from my drawer (cheap 10k 1% metal films):Code:10.0049.9909.9999.8659.9539.8699.8899.9179.8819.922Here's what the script prints out:Code:Best result:Pair 1: r1/r10 (10.004/9.922), ratio: 1.00826446281Pair 2: r3/r8 (9.999/9.917), ratio: 1.00826862963These pairs form ratios which are mis-matched by 0.000413%Here's the script:https://gist.github.com/cellularmitosis/20f882025756ceb0d0eb408d1e38e799Enjoy!

author: cellularmitosis
author_rank: Unknown
timestamp: April 14, 2017, 05:22:56 am
content: Of course, you have to watch out for heat-induced permanent drift when soldering resistors, so take these calculations with a grain of salthttps://www.eevblog.com/forum/projects/vishay-bulk-foil-drift-after-soldering/

author: mrflibble
author_rank: Super Contributor
timestamp: April 14, 2017, 11:39:19 am
content: Thanks! Added to the collection.Quote from: cellularmitosis on April 14, 2017, 05:22:56 amSpeaking of which, what might be interesting is doing a before and after comparison for a batch of same make & model resistors. The "interesting" part being see if there is any way to minimize the expected post-soldering target value mismatch purely based on pre-soldering resistance measurements. (For a given maximum number of resistors you are allowed to parallel.)

author: Back2Volts
author_rank: Unknown
timestamp: April 14, 2017, 07:00:13 pm
content: Would it make a difference preheating the resistors ? Will they still drift the same or less when soldering ?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 14, 2017, 10:13:13 pm
content: Isn't that basicallyhttp://jansson.us/resistors.htmlorhttp://kirr.homeunix.org/electronics/resistor-network-finder/?Tim

author: cellularmitosis
author_rank: Unknown
timestamp: April 14, 2017, 10:45:43 pm
content: Those look super useful! Thanks Tim!

author: cellularmitosis
author_rank: Unknown
timestamp: April 15, 2017, 01:47:23 am
content: Quote from: mrflibble on April 14, 2017, 11:39:19 amI decided to perform a bit of experimentation here, and soldered up some resistors to measure their drift.One group was normally laid out, another had extra long leads, and another hung far enough off the board to sit in an alcohol bath while being soldered. There was also a "control" group which I had soldered ~6 hours earlier, so the "before" and "after" measurements for those don't involve effects from soldering. I also logged the time and ambient temperature at a few points along the way.(See the attached screenshots of the setup and results)The results were somewhat surprising -- soldering doesn't seem to make much of a difference at all for these cheap 1% metal film resistors (they either came from Tayda or eBay, I can't remember). The soldered resistors drifted about as much as the "control" resistors.(Note: all measurements taken with a UNI-T UT61-E)

author: not1xor1
author_rank: Frequent Contributor
timestamp: April 15, 2017, 05:55:12 am
content: Quote from: cellularmitosis on April 15, 2017, 01:47:23 amthose cheap Chinese resistors drove me crazy when I used them to build an instrumentation amplifier (for a milliohm meter)according to your tests it looks like their quality now is much better, but I still prefer only brand 1% 50ppm resistors when I need a fair precise and stable value (of course depending on your requirements and budget there are many other solutions: PGA, INA, precision resistor network, 0.1% and better resistors, etc.)so far I've tested vishay, yageo and royalohm who provide a datasheet where you can know about maximum voltage etc.I paid just 1-2 euros for 100 pieces of the same value and since you do not need so many different values for differential/instrumentation amplifiers that's a good bargainIMHO it just doesn't make sense to buy unknown quality components and then spend a lot of time wondering why your circuit doesn't behave as expected (that's not your case, but a generic advice)

author: Brutte
author_rank: Frequent Contributor
timestamp: April 15, 2017, 10:16:05 am
content: Mytopicabout more general concept.You pick 4 resistors out of 10 that minimize CMRR while in my post I was picking 2 out of N (where N is a parameter) that minimize |r1-r2| in a simple divider.

author: KMoffett
author_rank: Regular Contributor
timestamp: April 16, 2017, 03:58:28 pm
content: Rescalc:http://www.pmillett.com/rescalc.htmKen