Mini Project: Measure, Simulate and Report a Voltage Divider
A sensor board needs a reference taken from a rail, and the design says "use a divider of and , 1 %". Your task is to give the team evidence: predict the output with its spread over production, measure one built divider with its uncertainty, decide whether the two agree, and write it up as a short lab report. Nothing here is new; every step uses one or two lessons of the course, linked as you go. It is the Stage 0 milestone of the roadmap: a report with objectives, circuit diagram, equipment list, measurements, uncertainty, results and conclusions.
The circuit and the plan
| Step | What you do | Lesson |
|---|---|---|
| 1 | predict the output, its worst case and its production spread | resistors and E-series, uncertainty |
| 2 | plan a safe build and the measurements | bench supply, breadboard, safe bench practice |
| 3 | measure, with the meter's accuracy and repeat readings | multimeter |
| 4 | compare prediction and measurement | uncertainty |
| 5 | sweep the input and fit the ratio | Python toolkit |
| 6 | write the report | lab notebook and report |
Step 1: predict
The divider equation follows from one current through both resistors, , and :
Check by units and size: cancels, and the output is between 0 and , closer to because . The worst case puts both resistors at the edges of their tolerance in the direction that moves the output most (high with low , and the reverse). A Monte Carlo run draws thousands of boards with resistors spread evenly across their tolerance band, which is closer to what production sees.
import numpy as np
Vs, R1, R2, tol = 5.00, 4.7e3, 10e3, 0.01 # V, ohm, ohm, 1 % resistors
ratio = R2 / (R1 + R2)
I = Vs / (R1 + R2)
print(f"nominal: Vout = {Vs * ratio:.4f} V, ratio = {ratio:.4f}, I = {I * 1e3:.3f} mA")
print(f"power: R1 {I**2 * R1 * 1e3:.3f} mW, R2 {I**2 * R2 * 1e3:.3f} mW")
hi = Vs * R2 * (1 + tol) / (R2 * (1 + tol) + R1 * (1 - tol))
lo = Vs * R2 * (1 - tol) / (R2 * (1 - tol) + R1 * (1 + tol))
print(f"worst case: {lo:.4f} V to {hi:.4f} V")
rng = np.random.default_rng(1)
n = 100_000
r1 = R1 * (1 + rng.uniform(-tol, tol, n))
r2 = R2 * (1 + rng.uniform(-tol, tol, n))
v = Vs * r2 / (r1 + r2)
print(f"Monte Carlo: mean {v.mean():.4f} V, std {v.std():.4f} V")
print(f"95 % of boards between {np.percentile(v, 2.5):.4f} and {np.percentile(v, 97.5):.4f} V")
Rm = 10e6 # the voltmeter's input resistance
R2m = R2 * Rm / (R2 + Rm)
loaded = Vs * R2m / (R1 + R2m)
print(f"with the meter connected: {loaded:.4f} V ({(loaded - Vs * ratio) * 1e3:+.2f} mV)")nominal: Vout = 3.4014 V, ratio = 0.6803, I = 0.340 mA
power: R1 0.544 mW, R2 1.157 mW
worst case: 3.3795 V to 3.4230 V
Monte Carlo: mean 3.4013 V, std 0.0089 V
95 % of boards between 3.3844 and 3.4182 V
with the meter connected: 3.4003 V (-1.09 mV)
Three things to note in the notebook. The dissipation is about a milliwatt, so ordinary resistors are far inside their rating. The worst case () is wider than where 95 % of boards land (), because both resistors rarely sit at their extremes together. And the meter's input lowers the reading by about : small here, but several percent with megohm resistors (multimeter). If you want a third opinion, run the same values through the SPICE deck of the toolchain lesson.
Step 2: build safely
Equipment: a bench supply with an adjustable current limit, a 6000-count handheld multimeter, a solderless breadboard, two 1 % metal-film resistors (, ), jumper wires. Record each instrument's model, serial number and calibration date.
- With the supply's output off and nothing connected, set and a current limit of (the circuit needs , so the supply stays in constant-voltage mode; a wiring mistake that shorts the rail is limited to and ).
- Measure each resistor out of circuit and note the readings.
- Build the divider, check the wiring against the schematic, then switch the output on.
Hazards and safe setup: DC from a current-limited, isolated bench supply: no shock hazard, and the limit keeps a short harmless. Keep drinks off the bench, switch the output off before rewiring, and don't use the meter's current jacks for voltage readings (a common way to blow the meter's fuse).
Step 3 and 4: measure and compare
The numbers below are an example data set, so you can run the analysis before you build; replace them with yours. The example meter's DC-volts accuracy on the 6 V range is taken as with a count; read your own meter's specification sheet instead.
| Quantity | Example reading |
|---|---|
| at the breadboard | |
| , five readings a minute apart | , , , , |
| temperature, time | , 10:40 |
import numpy as np
def meter_dcv(reading, pct=0.5, counts=3, resolution=0.001):
"""Half-width of the example meter's accuracy band on the 6 V range, in V."""
return reading * pct / 100 + counts * resolution
vin, vout = 5.003, 3.398
repeats = np.array([3.398, 3.399, 3.398, 3.397, 3.398])
uA = repeats.std(ddof=1) / np.sqrt(len(repeats)) # Type A: scatter of the repeats
u_vout = np.hypot(meter_dcv(vout) / np.sqrt(3), uA) # with Type B: rectangular accuracy band
R1, R2, tol = 4.7e3, 10e3, 0.01
rng = np.random.default_rng(1)
n = 100_000
r1 = R1 * (1 + rng.uniform(-tol, tol, n))
r2 = R2 * (1 + rng.uniform(-tol, tol, n))
vs = vin + rng.uniform(-1, 1, n) * meter_dcv(vin) # the measured supply, with its uncertainty
pred = vs * r2 / (r1 + r2)
d = vout - pred.mean()
U = 2 * np.hypot(u_vout, pred.std()) # expanded uncertainty, k = 2
print(f"Type A of 5 repeats: {uA * 1e3:.2f} mV")
print(f"measured Vout = {vout:.3f} V, u = {u_vout * 1e3:.1f} mV")
print(f"predicted Vout = {pred.mean():.4f} V, u = {pred.std() * 1e3:.1f} mV")
print(f"difference {d * 1e3:+.1f} mV, expanded uncertainty of the difference {U * 1e3:.1f} mV")
print("consistent" if abs(d) <= U else "NOT consistent: look for a mistake")Type A of 5 repeats: 0.32 mV
measured Vout = 3.398 V, u = 11.5 mV
predicted Vout = 3.4033 V, u = 14.1 mV
difference -5.3 mV, expanded uncertainty of the difference 36.5 mV
consistent
The scatter of repeated readings (Type A, ) is tiny next to the meter's accuracy band (Type B, as a standard uncertainty): reading the display five times does not make the meter more accurate. The analysis treats the two voltage readings as independent, which overstates the uncertainty a little: both come from the same meter on the same range, so a gain error would affect them alike and partly cancel in the ratio. Say so in the report.
Step 5: sweep the input and fit the ratio
Set the supply to 1, 2, 3, 4 and 5 V, read both voltages each time, and fit a straight line. Its slope is the divider ratio measured over the whole range, and a non-zero intercept would reveal an offset in the meter.
import numpy as np
import matplotlib.pyplot as plt
vin = np.array([1.001, 2.002, 3.000, 4.004, 5.003]) # example readings, V
vout = np.array([0.680, 1.360, 2.038, 2.720, 3.398])
(k, b), cov = np.polyfit(vin, vout, 1, cov=True)
uk, ub = np.sqrt(np.diag(cov))
nominal = 10 / 14.7
print(f"slope {k:.5f} +/- {uk:.5f} (fit scatter only), intercept {b * 1e3:.2f} +/- {ub * 1e3:.2f} mV")
print(f"nominal ratio {nominal:.5f}, measured is {(k / nominal - 1) * 100:+.2f} % off")
err = vout * 0.005 + 0.003 # meter accuracy band, V
plt.errorbar(vin, vout, yerr=err, fmt="o", capsize=3, label="measured (meter band)")
plt.plot([0, 5.2], [b, b + k * 5.2], label=f"fit: slope {k:.4f}")
plt.xlabel("input voltage Vs (V)")
plt.ylabel("output voltage Vout (V)")
plt.title("Divider 4.7k / 10k: output against input")
plt.legend()
plt.grid(True)
plt.show()slope 0.67919 +/- 0.00008 (fit scatter only), intercept 0.26 +/- 0.25 mV
nominal ratio 0.68027, measured is -0.16 % off
The ratio is below nominal, well inside what 1 % resistors allow, and the intercept is zero within its uncertainty. The fit's own uncertainty () only describes the scatter of the points; the meter's gain accuracy limits what you really know about the slope, to about unless the gain errors cancel in the ratio.
Step 6: the report
Use this template; each heading is one or two short paragraphs or a table. The lab notebook lesson explains what belongs in each part.
Title: Verification of the 3.4 V reference divider (R1 4.7k, R2 10k, 1 %)
Author, date: ...
1 Objective Show that Vout = 3.40 V within the production spread at Vs = 5.00 V.
2 Circuit Schematic with values, tolerances, test points and meter connection.
3 Equipment Supply, meter (model, serial, calibration date), breadboard, resistors.
4 Method Setup, safety settings (5.00 V, 20 mA limit), order of readings, conditions.
5 Prediction Nominal, worst case, Monte Carlo 95 % range, meter loading.
6 Results Raw readings table, repeat readings, sweep table and plot.
7 Uncertainty Budget: meter accuracy (Type B), repeats (Type A), supply, resistors.
8 Discussion Agreement within k = 2? Correlations ignored? What would improve it?
9 Conclusion One sentence answering the objective, with the number and its uncertainty.
Appendix Python and SPICE files (Git commit hash), notebook page references.For the example data the conclusion would read: "The measured output, (), agrees with the prediction (); the divider meets its target within the production spread." Each expanded uncertainty is twice the standard uncertainty printed in step 4.
Extensions
- Replace the resistors with and and repeat: the meter's loading now shows (predict it first).
- Warm gently with your hand and watch the last digit: resistor temperature coefficients (thermal lesson).
- Put the analysis and the report in a Git repository, one commit per step.
Practice
- With resistors instead of , what is the worst-case output range?
- Why measure at the breadboard instead of reading the supply's display?
Answer
- and : about , five times wider.
- The display has its own accuracy (often coarser than a handheld meter), and the wiring drops a little voltage. Measuring both voltages with the same meter also lets some of its gain error cancel in the ratio.
Test yourself
What is the output of a divider with (top) and (bottom) from ?
Why is the Monte Carlo range narrower than the worst case?
- Monte Carlo has a bug
- Both resistors rarely sit at the extreme of their tolerance in the worst direction at the same time
- The worst case ignores tolerance
- Monte Carlo uses 5 % resistors
Five repeat readings scatter by , and the meter's accuracy band is . What limits the uncertainty?
- The scatter of the repeats
- The meter's accuracy
- The number of repeats
- The display's resolution
Why is the bench supply's current limit set to for a circuit that needs ?
- To make the circuit run faster
- So that a wiring short is limited to a harmless current while normal operation stays in constant-voltage mode
- Because the resistors need 20 mA
- The limit has no effect