A454 of 56
0 XP
  1. Hook
  2. Predict
  3. Name it
  4. Check
  5. Explain

A4 · Project 2 · Tolerance analysis

Will ten thousand of these filters meet spec?

You've designed an active low-pass filter for a sensor: a Sallen-Key stage with two resistors and two capacitors, set for a 1.07 kHz corner and a Q of 0.74. On paper it's perfect. On a production line, every resistor is off by up to 1% and every capacitor by up to 5 or 10%, all at random. The customer's spec says the corner must be within ±5% and the Q within ±10%. In this project you'll find out what fraction of boards will pass, which part is to blame for the failures, and what one change would fix it.

Predict

The corner frequency goes as 1/R1R2C1C2. If one capacitor is 10% high and everything else is exact, how far does the corner move?

Name it

The circuit and the plan

A unity-gain Sallen-Key low-pass has R1 and R2 in series from the input to the op amp's + input, C2 from the + input to ground, and C1 from the junction of the resistors back to the output. Its response is

H(s)=11+sC2(R1+R2)+s2R1R2C1C2

which is a second-order low-pass with

f0=12πR1R2C1C2Q=R1R2C1C2C2(R1+R2)

C6 shows where this comes from. The design: R1=R2=10 kΩ (±1%), C1=22 nF (±5%) and C2=10 nF (±10%). Model every tolerance as uniform.

The plan:

  1. Write a function for f0 and Q and check the nominal design.
  2. Simulate 50,000 boards and find the yield against the spec.
  3. Find which part's tolerance hurts the most.
  4. Plot the distribution of f0 against the spec limits.

Use rng = np.random.default_rng(0) and draw the parts in the order R1, R2, C1, C2, so your numbers match the checks.

Check

Write sk(R1, R2, C1, C2) returning (f0, Q), and set f0_nom, Q_nom for the nominal design.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Simulate 50,000 boards (uniform tolerances, default_rng(0), parts drawn in the order R1, R2, C1, C2). Set f0 and Q to the arrays of results, and yld to the fraction with f0 within ±5% and Q within ±10% of nominal.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Find which part matters most. For each of the four parts in turn, simulate 50,000 boards where only that part varies over its tolerance (the others exact; default_rng(1), one fresh draw per part in the order R1, R2, C1, C2). Set spread to a dictionary from part name to the standard deviation of f0/f0,nom, and worst to the name with the largest.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Replace C2 with a ±2% part and re-run the full simulation from the second lab (default_rng(0), same order, 50,000 boards). Set yld2 to the new yield. Then plot a histogram of f0 (60 bins) with dashed vertical lines at the ±5% spec limits, and label the axes.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Using your results, explain to a manager why the filter failed spec on some boards and what the cheapest fix is.

Practice

Keep practicing

2 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.