Tolerance in circuit design

Started by matopotato, January 12, 2024, 05:29:31 PM

Previous topic - Next topic

matopotato

I admit I didn't do any research on this, so apologies if this is an "old and known topic" already.
I see that components like resistors have tolerance of 1%, 5% etc and capacitors ?%, 5%, 10% and even 20%.
And some discussions related to "I don't have 5k, can I use 4k7 or 5k1 instead?" vs for example an instruction in the build doc for Countdown phaser from Lectrix-fx (A/DA Final Phaser) stating that R65 & R66 should be in spec (assuming they need to be close or exactly their asking values) then begs the question:
How do you take into consideration tolerance when designing a circuit?
I would have called tolerance the "fault" or "margin of error" and as such you have to consider each contribution in any scenario to predict worst case scenario of the end result. If each component plays a role and is at its worst "allowed" extreme for "one/same direction" (say more volume, more treble or more gainy) and all components variance act in that same direction, vs a case where they all are either perfect according to specs or cancel each other out, I guess the end result would be quite different in those two cases?

So what is the thinking when designing a new circuit:
Would you consider this?
Or trust the tolerances to more or less cancel each other out?
Or specify the most critical ones like the Countdown specs above?
Or does it become so complex that you are better off just winging it?
"Should have breadboarded it first"

Rob Strand

#1
The simple answer is it's a job for the professionals :icon_mrgreen:.  There are formal ways of handling tolerances generally it involves statistics.

In order to say the tolerance aren't causing a problem you need a specification to meet.  A specification gain of a gain of 10 might seem OK at first  However a real circuit will never have an exact gain of 10 you need to add tolerances to the specs like a gain of 10 +/- 1.    You might want to impose other specs like the transistor collector voltage must bias to 4.5V +/- 1V.

When you look into this stuff you realize it brings up deeper questions like what is the meaning of 10 +/- 1.   One interpretation is the gain can never go below 9 or go above 10.   That's a worst case scenario.  But what if it stays within 10 +/- 1  99.97% of the time - is that OK?

The worst case scenario can be (approximately) done by hand.  From knowledge of the circuit you have an idea what causes the gain to go up and what cause it to go down.  Then you analyse the circuit with all circuit values corresponding to those cases.    So what if the circuit fails to meet the gain spec?  Some components/parameters will be contributing more than others to the gain.  Maybe the tolerance on those components should be tightened up first?   In some cases you might not be allowed to fiddle with some of the bad ones eg.  I can only buy 5% caps choosing 0.1% caps isn't realistic.   We aren't sorting the transistor hFE's so we have to live with the wide hFE tolerance.  (Another solution is use a different circuit!)

Instead of making a stab at it by hand you can get simulation packages like spice to do tolerance analysis.  One is method is worst case analysis which, for computational speed reasons, is only an approximation to the worst case.   Another is monte carlo analysis.  This runs 10000 or 100000 different combinations of part values a lets you see the results.   It can be time consuming to do and often difficult to interpret the results - also if you have 10 parts and do 100 runs it's not going to represent the population of results.

It's a big topic.  Not possible to answer fully in one post.   Fortunately for audio you can get away with a lot.  Clearly no one did a tolerance analysis on those old pedals that only work sometimes.  In other cases people follow recipes like add an emitter resistor and a emitter bypass cap then make the bias divider 10 times the base current and if you do that the circuit won't misbehave enough to worry about it - so no tolerance analysis but the recipe tries to avoid disasters.

Something else.   Worst case seems like the thing to do.  However the probability of every part being at worst case is very low.  At some point it will be lower than the probability of someone putting the wrong part on the board or someone dropping the board and putting it back on the pile.   For this reason people say worst case is too stringent and results in impractical designs.    That's where statistics comes into it.   It's cheaper to test the boards then throw out or rework the bad ones.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

ElectricDruid

Quote from: matopotato on January 12, 2024, 05:29:31 PMHow do you take into consideration tolerance when designing a circuit?
I would have called tolerance the "fault" or "margin of error" and as such you have to consider each contribution in any scenario to predict worst case scenario of the end result. If each component plays a role and is at its worst "allowed" extreme for "one/same direction" (say more volume, more treble or more gainy) and all components variance act in that same direction, vs a case where they all are either perfect according to specs or cancel each other out, I guess the end result would be quite different in those two cases?
Potentially, yes.
The questions you need to ask are "how sensitive is this circuit?" and "how much do I care?".
Some circuits are *very* sensitive to component variation. For example, pole-mixing filters, the simplest example of which is probably a highpass filter created by taking the difference of the input and a lowpass filtered version of the input. Unless the two signals are *exactly* balanced, the stopband cancellation of the resulting highpass will be poor. Even 1% tolerance makes a significant difference in this situation. Most circuits really *don't* care that much. I built two versions of my Hard Bargain distortion pedal, for example. One had the mid boost/cut and the baxandall tone controls centred around 800Hz, while the other used 640Hz. They weren't just different in tolerance - they actually used different *values*, and I'm still not convinced I can hear a difference between them. And that's about four semitones.
So you need to know how much it matters, and how much you care. Simulations are useful for this, since you can run the same circuit with loads of different values very easily and plot the outputs to see how much variation you really get.
In situations where you really *have* to get a speciic value, you can always use a trimmer. I generally avoid them like the plague because people are as likely to misadjust them as adjust them, so a 1% fixed value is more likely to be right than a +/-10% tweakable trimmer. But sometimes they are unavoidable and even useful.

QuoteSo what is the thinking when designing a new circuit:
Would you consider this?
Yes, I would absolutely consider it. If I'm doubtful about the effect of tolerances on a particular circuit, I'll simulate it and play with it until I'm happy one way or the other.

QuoteOr trust the tolerances to more or less cancel each other out?
That's risky, unless you know the circuits aren't badly affected by component tolerance.

QuoteOr specify the most critical ones like the Countdown specs above?
Yes, specify better tolerance parts where it matters. 1% resistors are easy to use as a standard part and even 0.1% resistors aren't expensive any more. Caps is more difficult, and better than 5% caps are hard to find, although not impossible. If you're designing something that uses caps (like a post-delay filter, say) then consider what happens if the caps are at the edge of the spec. Perhaps you want to set the cutoff frequency so that there's no chance of delay clock bleedthrough even with the worse-case scenario for the caps? That's probably not half as bad as it sounds - just kick the cutoff down a bit to make sure. What sort of "safety margin" does your design have? Is it "fussy", or will it still work with a random handful of junkbox parts? Personally, I like things in that second category. You can still build them with good parts and get some improved performance, but it's nice to know it'll work *whatever* you have on hand.

QuoteOr does it become so complex that you are better off just winging it?
No, don't wing it, but at the same time recognize that we're not building life support equipment, so if the tone control on one box isn't *exactly* the same as the tone control on the last one, no-one dies. In fact, often, we have controls on stuff exactly *so* people can compensate and get stuff how they want it. Usually, the differences between people's personal tastes (and guitars/amps!) are much bigger than any component tolerances, so if you designed it to allow for different users to tune it how they like it, you'll already have more than enough control to compensate for tolerances.

HTH,
Tom

R.G.

AAAAKKKKKKK!!! Sensitivity analysis!! Run for your lives!!
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

It's also an economic question. You CAN buy 0.1% parts, even better (0.001% for $561). Or you can make them, which was customary in some radio and especially broadcast audio attenuators, also calibration gear. A 0.1% resistor used to cost as much as four gallons of gasoline; today the Orientals turn them out very much cheaper (under a buck?).

So while "I know" how to do audio with mostly 20% but two 2%/1% per block, I can't even buy 20% now and 10% is hardly cheaper than 5%, and buying 2% won't kill me.

You will not hear 2% errors of Amplitude. (Marginal if +2% and -2% make 4% error.)

2% error of pitch is major; why we always have tuning pins.
  • SUPPORTER

Phend

#5
Tolerance goes away with a dmm and a sampling of like parts. And time.
  • SUPPORTER+
Do you know what you're doing?

Mark Hammer

#6
Quote from: Phend on January 13, 2024, 06:48:23 AMTolerance goes away with a dmm and a sampling of like parts. And time.
This.  Listen to the circuit in action.  Think about what you do and don't like about it, in your context, and identify to areas of the circuit that may be responsible.  THEN, measure the components, compare them against their stated/nominal value, and make any adjustments of component substitutions necessary.

In my brief interactions with Bill Finnegan, 16 years ago, he had sent me a Klon schematic that had a number of resistor values scratched out (like this) and similar, but slightly different, 1% values pencilled in.  He did exactly what I described.

amptramp

#7
This is a copy of a spreadsheet for tolerance calculations done on an aircraft component, with the unavoidable butchering when trying to put an Excel sheet into a reply.  You have a descriptor which for the first component is a 61.9 ohm 1% 1 watt resistor.  Then you insert the initial tolerance of 1% in this case followed by the temperature range of -20 to +85 degrees C followed by a multiplier for parts per million per degree C to get a temperature factor result followed by an aging percentage followed by the cumulative percentage and finally the calculated result which is the possible range of values.  This was done for every component and fed the stress analysis (since you can't determine the stress without the actual values) and this feeds that failure mode effects and criticality analysis.



PARTS TOLERANCE LIST                                             
ASSEMBLY: Gate Driver                                             
Ref   P/N   Descriptor   Nominal   Initial   Temp      Temp Mult      Temp Factor      Aging   Cumulative      Range   
                         Value      %                         PPM/Degree      %                           %         
                                               Lo   Hi            Lo   Hi                   Lo   Hi                               Lo   Hi                   Lo   Hi
                                             
R1      61.9 ohm 1% 1W   61.9   1   -20   85   200   150   0.991   1.009   0.5   0.97618455   1.02418545   60.42582365   63.39707936
R2      61.9 ohm 1% 1W   61.9   0   -20   85   200   200   0.991   1.012   0   0.991   1.012   61.3429   62.6428
R3      61.9 ohm 1% 1W   61.9   1   -10   85   200   150   0.993   1.009   0.5   0.97815465   1.02418545   60.54777284   63.39707936
R4      61.9 ohm 1% 1W   61.9   1   0   85   200   100   0.995   1.006   0.5   0.98012475   1.0211403   60.66972203   63.20858457
R5      61.9 ohm 1% 1W   61.9   1   10   85   200   50   0.997   1.003   0.5   0.98209485   1.01809515   60.79167122   63.02008979
R6      61.9 ohm 1% 1W   61.9   1   20   85   200   0   0.999   1   0.5   0.98406495   1.01505   60.91362041   62.831595
R7      61.9 ohm 1% 1W   61.9   1   25   85   200   200   1   1.012   0   0.99   1.02212   61.281   63.269228
R8      61.9 ohm 1% 1W   61.9   1   -20   85   200   150   0.991   1.009   1   0.9712791   1.0292809   60.12217629   63.71248771
R9      61.9 ohm 1% 1W   61.9   1   -20   85   200   200   0.991   1.012   0.5   0.97618455   1.0272306   60.42582365   63.58557414
R10      61.9 ohm 1% 1W   61.9   1   -20   85   200   150   0.991   1.009   0   0.98109   1.01909   60.729471   63.081671
R11      7.50 ohm 1% 10W   7.5   1   -20   85   200   200   0.991   1.012   0.5   0.97618455   1.0272306   7.321384125   7.7042295
R12      5.00 ohm 1% 10W   5   1   -20   85   200   150   0.991   1.009   0.5   0.97618455   1.02418545   4.88092275   5.12092725
                           1   1      1   1   0   0
C1      2.7 nF 10% 400V   2.7   10   -20   85   500   500   0.9775   1.03   2   0.862155   1.15566   2.3278185   3.120282
C2      2.7 nF 10% 400V   2.7   10   0   70   500   500   0.9875   1.0225   3   0.8620875   1.1584925   2.32763625   3.12792975
C3      2.7 nF 10% 400V   2.7   10   -20   70   500   500   0.9775   1.0225   3   0.8533575   1.1584925   2.30406525   3.12792975
C4      2.7 nF 10% 400V   2.7   5               1   1      0.95   1.05   2.565   2.835
C5      2.7 nF 10% 400V   2.7   5               1   1      0.95   1.05   2.565   2.835
                           1   1      1   1   0   0
C6   Capacitance   1500 uF 20% 35V   1500   20   -20   85   750   750   0.96625   1.045   5   0.73435   1.3167   1101.525   1975.05
C6   ESR   .012 ohm   0.012   25   -20   85   2000   1500   0.91   1.09   10   0.61425   1.49875   0.007371   0.017985
                           1   1      1   1   0   0
L2   Inductance   100uH   100   10   -20   120   500   500   0.9775   1.0475   5   0.8357625   1.2098625   83.57625   120.98625
L2   Series R   0.32 ohms   0.32   5   -20   120   3880   3880   0.8254   1.3686   5   0.7449235   1.5088815   0.23837552   0.48284208
                           1   1      1   1   0   0
Q5   Vds   IRF740   400      -40   105   1225   1225   0.920375   1.098      0.920375   1.098   368.15   439.2
                           1   1      1   1   0   0
                           1   1      1   1   0   0
                           1   1      1   1   0   0
                           1   1      1   1   0   0


We did this for every component.  Active components had additional rows for things like hfe, collector voltage, collector current, dissipation etc. - basically every entry on the transistor spec sheet.

For op amps, we had a row for every spec entry on the spec sheet and sometimes ran afoul of things like input common mode voltage.  Everything that was not within spec forced a redesign.

ElectricDruid

Yeah, but....that's for aircraft. People *do* die if something goes wrong. We're talking about pedals. The worst-case scenario is that you screw up your solo and look like a muppet and your career takes a nosedive. It's not the same thing at all.

Yes, you *could* apply the formal analysis techniques developed in different fields to this field, but I'd argue that it's massive overkill. Some understanding of where the sensitive parts of a circuit are, and how best to manage that is all you need. We're not NASA and we're not sending astronauts to the moon.

Rob Strand

Quote from: ElectricDruid on January 13, 2024, 03:26:31 PMYeah, but....that's for aircraft. People *do* die if something goes wrong. We're talking about pedals. The worst-case scenario is that you screw up your solo and look like a muppet and your career takes a nosedive. It's not the same thing at all.

Yes, you *could* apply the formal analysis techniques developed in different fields to this field, but I'd argue that it's massive overkill. Some understanding of where the sensitive parts of a circuit are, and how best to manage that is all you need. We're not NASA and we're not sending astronauts to the moon.
It's about designing something to meet a spec.  Not if the spec is wide or narrow.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

antonis

Quote from: ElectricDruid on January 13, 2024, 03:26:31 PMSome understanding of where the sensitive parts of a circuit are, and how best to manage that is all you need.
Quote from: Rob Strand on January 13, 2024, 04:12:18 PMIt's about designing something to meet a spec.  Not if the spec is wide or narrow.

I think you both deal with the very same point.. :icon_wink:

e.g. the spec of designing a working CE amp (in the mean of neither permanently saturated of cuf-off) is more loose compared to a symmetrically swinging one..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

Rob Strand

#11
The old General Electric Transistor Manual had some recipes which accounted for tolerances.  By no means complete and only deals with bias.

See chapter 5 p36, in particular p38.
https://www.worldradiohistory.com/BOOKSHELF-ARH/Technology/GE-Books/GE-Transistor-Manual-4th-1959.pdf

IIRC the later editions of the book had more info (perhaps edition 7).  The recipes take the hard work out of analysing what is going on, You will notice in the design equations you have to put the min and max values for the part values/parameters.

This article designs a transistor Schmitt trigger.  It has the same type of min/max values in the equations.
Note fig 13 in the second article.

p122
https://www.worldradiohistory.com/UK/Wireless-World/60s/Wireless-World-1967-03-S-OCR.pdf
p175 (some corrections to prev article)
https://www.worldradiohistory.com/UK/Wireless-World/60s/Wireless-World-1967-04.pdf
p538 (corrections)
https://www.worldradiohistory.com/UK/Wireless-World/60s/Wireless-World-1967-11.pdf

The take home message is these are simple circuits yet the manual calculations can get quickly out of hand.   That's why simulations are popular but it's still a very time consuming process.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Phend

#12
I try to "Blue Print" my builds from existing schematics.
Measure each component and select exact values if I can.
These are not big complex circuits.
But always seem to work "in the box" first go.
Except for a few picky ones.
Sorry about the blue printing thing, comes from my mechanical back ground. You can laugh now.
Blue printing was popular back on muscle cars coming out of Detroit.
Select all engine parts to measure "dead nuts".
 Doors stayed on too. (Sick)



  • SUPPORTER+
Do you know what you're doing?

matopotato

Thanks!
It has been very interesting reading the replies and the different aspects brought up.
"Should have breadboarded it first"

pacealot

Quote from: Phend on January 13, 2024, 04:57:49 PMDoors stayed on too. (Sick)

Funny (not funny, and very OT, sorry), Boeing might have wanted to consider that idea...  :icon_eek:
"When a man assumes, he makes an ass out of some part of you and me."

amptramp