C112 of 30
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C1 · Lesson 12 · Resistor networks lab

Series and parallel in code, standard resistor values, choosing a divider, tolerance by Monte Carlo, and ladder networks, in Python

Lessons 5 to 11 reduced networks by hand: series and parallel, dividers, real resistors with tolerances, loading, nodal and mesh analysis, delta–wye. A designer does the same reductions in code, and adds the questions hand analysis avoids: which standard values come closest to a ratio, how far a batch of 5% resistors can push a divider, and what an endless ladder converges to. In this lab you'll write those small tools, and check each against the formulas from the lessons.

  • Each sample is the output of a 10 kΩ over 10 kΩ divider from 5 V, built from two resistors drawn at random within ±t%. The histogram collects 5000 of them.
  • The curve is a Gaussian with the spread predicted from the tolerance, σ=524t3 for uniform errors.
  • Halve the tolerance and the spread halves. Step 4 does the same Monte Carlo in Python, for any divider.

Predict

A 5 V to 3.3 V divider must be built from standard E24 values (1.0, 1.1, 1.2, … 9.1 and their multiples of ten). How close can two resistors from the first two decades get to the ratio 0.66?

Name it

Series and parallel in code

Series resistances add; parallel ones add as conductances, R=(∑1/Ri)−1. Written as small functions, they combine into any series–parallel network in one line, the way the lessons reduced them on paper.

Standard values

Resistors come in E-series, with N values per decade spaced about 101/N apart: E12 for 10% parts, E24 for 5%, E96 for 1%. The nearest standard value to x is the one closest on a log scale, since the series is evenly spaced in log.

Choosing a divider

For a target ratio R2R1+R2, search every pair of standard values and keep the one with the smallest error. Two decades of E24 give 48 values each way, so 2304 pairs, which a computer checks instantly.

Tolerance by Monte Carlo

A ±t% resistor can be anywhere in its band. Drawing each resistor at random within its tolerance, many times, gives the distribution of the output. For a divider of equal resistors with uniform errors, the output's standard deviation is V42t3; Monte Carlo handles any network and any error distribution without new algebra.

Ladders

A ladder of series R and shunt R, n sections long, has input resistance given by repeating r←R+R‖r. As n grows it converges to the value that reproduces itself, r=R+R‖r, which is 1+52R = 1.618R.

Worked example

Find the E24 pair, from 1.0 to 91, that makes the best 5 V to 3.3 V divider. What's its error, and what does it actually output?

Show the solution
  1. Search all pairs. The ratio R2R1+R2 closest to 0.66 comes from R1 = 4.7 and R2 = 9.1 (in any unit, say kΩ): 9.14.7+9.1=0.65942 an error of 0.00058.
  2. Output. From exactly 5 V: 5×0.65942=3.297V
  3. An exact target. For other targets the search can be exact: 1.8 V from 3.3 V needs 0.5455, which 1.0 over 1.2 hits exactly, since 1.22.2=611
  4. Check the pair. A designer would then check the pair's total resistance against the load and the power budget.

Answer 4.7 over 9.1 (say kΩ) is the best pair, with a ratio of 0.65942, an error of 0.00058 and an output of 3.297 V.

Worked example

A 10 kΩ over 10 kΩ divider from 5 V uses ±5% resistors. What's the spread of its output, by Monte Carlo and by formula?

Show the solution
  1. Monte Carlo. Drawing both resistors uniformly within ±5% 200 000 times gives a mean of 2.500 V and a standard deviation of 0.0510 V.
  2. Each resistor's spread. Each resistor's standard deviation is 5%3=2.89%
  3. Combine by formula. The output depends on their ratio with sensitivity ¼ each, and the two add in quadrature: σ=5×14×2×0.02887=0.0510V The formula agrees with the Monte Carlo result.
  4. Worst case. With both resistors at opposite extremes the output is off by ±0.125 V, nearly 2.5σ. Monte Carlo shows how rarely that corner occurs.

Answer the output has a mean of 2.500 V and a standard deviation of 0.0510 V by both methods, and the worst case is ±0.125 V.

Worked example

A ladder alternates 1 kΩ in series and 1 kΩ to ground, section after section. What's its input resistance after one, two and many sections?

Show the solution
  1. One section. 1+1=2kΩ
  2. Two sections. 1+1‖2=1.667kΩ
  3. Three sections. 1+1‖1.667=1.625kΩ
  4. Many sections. The values close in quickly on the golden ratio, since r must equal 1+1‖r: r=1+52kΩ=1.618kΩ
  5. Transmission lines. A long transmission line, modeled as such a ladder, presents its characteristic impedance in the same way, which C10 takes up.

Answer the input resistance is 2 kΩ after one section, 1.667 kΩ after two, 1.625 kΩ after three, and 1.618 kΩ (the golden ratio) after many.

Check

Step 1. Write series(*r) and parallel(*r) returning the combined resistance of any number of resistors.

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

Check

Step 2. Write nearest_e24(x) returning the E24 value nearest to x on a log scale, in the same decade or the next (so 9.6 rounds to 10).

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

Check

Step 3. Write best_divider(ratio) returning (R1, R2) from E24 values between 1.0 and 91 that make R2R1+R2 closest to ratio.

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

Check

Step 4. Write divider_mc(R1, R2, tol, n, seed) returning (mean, std) of a divider's output from 5 V when each resistor is drawn uniformly within ±tol (a fraction) of its value, over n trials.

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

Check

Step 5. Write ladder(n, R) returning the input resistance of an n-section ladder of series R and shunt R with its far end open: one section is 2R, and each added section gives r←R+R‖r.

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

Check

Resistors of 4.7, 2.2 and 22 kΩ.

(a)

What's 4.7 kΩ in series with the parallel pair of the other two?

Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.

(b)

What are all three in parallel?

Check

A divider uses R1 = 4.7 and R2 = 9.1 for a target ratio of 0.67. What's its ratio error, in percent of the target?

Check

An equal-resistor divider from 5 V uses ±1% parts with uniform errors. What's the standard deviation of its output?

Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.

Check

An endless ladder alternates 4.7 kΩ in series and 4.7 kΩ to ground. What's its input resistance?

Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.

Explain why

Why does Monte Carlo usually give a smaller spread than a worst-case tolerance analysis?

Practice

Keep practicing

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