Mini Project: Analyse, Simulate and Characterise an Unfamiliar Network
The roadmap's milestone for circuit theory is to analyse an unfamiliar linear circuit using appropriate methods and verify it through simulation and measurement. This project does exactly that for a small but realistic network: the input stage of a sensor board, where a divider sets a reference, a resistor and a capacitor filter it, and an analog-to-digital converter (ADC) input loads it. You will predict its DC operating point, its Thevenin equivalent, its power-on transient and its frequency response by hand and in Python, cross-check every number with ngspice, estimate the spread from component tolerances, and plan the bench measurement. The write-up template at the end is the deliverable.
The network
| Part | Value | Tolerance | Role |
|---|---|---|---|
| bench supply, current limit | supply | ||
| , | , | 1 % | divider setting the reference |
| 1 % | series resistor of the RC filter | ||
| 10 % (ceramic X7R) | filter capacitor | ||
| 1 % | stands in for the ADC input |
The designer intended , forgetting . Your job is to find what the circuit really does.
Step 1: DC operating point (nodal analysis)
In DC the capacitor is open. Two unknown nodes, a and b (Node-Voltage Analysis):
Result to reproduce: , : about 20 % below the intended 3.44 V.
Step 2: Thevenin equivalent seen by the ADC
Remove and . The divider is a source behind , and adds in series (Thevenin and Norton Equivalents):
The same answer as Step 1, by a second method. The fix is now obvious: either buffer the node or make much smaller than .
Step 3: the power-on transient
When the supply steps from 0 to 5 V, charges through the resistance it sees with the source shorted (RL Circuits and the General First-Order Method):
So , reaching 63 % at and 99 % at . Firmware should wait at least that long after power-up before trusting the first ADC sample.
Step 4: frequency response
With one capacitor the network is a first-order low-pass from to (First-Order Low-Pass and High-Pass Filters):
Supply noise at 100 Hz passes almost unattenuated; at 10 kHz it is about below the DC gain.
Step 5: all of it in Python, with tolerances
import numpy as np
def solve(R1, R2, R3, RL, C, V=5.0):
G = np.array([[1/R1 + 1/R2 + 1/R3, -1/R3], [-1/R3, 1/R3 + 1/RL]])
va, vb = np.linalg.solve(G, [V / R1, 0.0])
Rth = R1 * R2 / (R1 + R2) + R3
tau = Rth * RL / (Rth + RL) * C
return float(va), float(vb), tau
nom = dict(R1=10e3, R2=22e3, R3=4.7e3, RL=47e3, C=100e-9)
va, vb, tau = solve(**nom)
print(f"nominal: va = {va:.4f} V, vb = {vb:.4f} V, tau = {tau*1e3:.4f} ms, fc = {1/(2*np.pi*tau):.2f} Hz")
f = np.array([1, 100, 171.36, 1e3, 1e4])
H = (vb / 5) / (1 + 2j * np.pi * f * tau)
for fi, h in zip(f, H):
print(f" f = {fi:8.2f} Hz: |H| = {20*np.log10(abs(h)):7.2f} dB, phase = {np.degrees(np.angle(h)):6.1f} deg")
rng = np.random.default_rng(2026)
N = 20000
tol = dict(R1=0.01, R2=0.01, R3=0.01, RL=0.01, C=0.10)
samples = {k: v * (1 + rng.uniform(-tol[k], tol[k], N)) for k, v in nom.items()}
vbs = np.empty(N); taus = np.empty(N)
for n in range(N):
_, vbs[n], taus[n] = solve(**{k: samples[k][n] for k in nom})
print(f"Monte Carlo ({N} boards): vb = {vbs.mean():.4f} V, sd {vbs.std()*1e3:.2f} mV, range {vbs.min():.4f} to {vbs.max():.4f} V")
print(f"tau = {taus.mean()*1e3:.4f} ms, range {taus.min()*1e3:.3f} to {taus.max()*1e3:.3f} ms")nominal: va = 3.0340 V, vb = 2.7582 V, tau = 0.9288 ms, fc = 171.36 Hz
f = 1.00 Hz: |H| = -5.17 dB, phase = -0.3 deg
f = 100.00 Hz: |H| = -6.44 dB, phase = -30.3 deg
f = 171.36 Hz: |H| = -8.18 dB, phase = -45.0 deg
f = 1000.00 Hz: |H| = -20.61 dB, phase = -80.3 deg
f = 10000.00 Hz: |H| = -40.49 dB, phase = -89.0 deg
Monte Carlo (20000 boards): vb = 2.7581 V, sd 8.35 mV, range 2.7340 to 2.7824 V
tau = 0.9282 ms, range 0.831 to 1.028 ms
The DC value moves by under even at the extremes, the time constant by about (mostly the capacitor). Those are the bands your measurements should fall in (DC Sweeps, Sensitivity and Tolerance Analysis).
Step 6: cross-check in ngspice
One deck does the operating point, the transient and the AC sweep. The pulse source steps from 0 to 5 V at for the transient; the DC 5 value is used for op and AC 1 for the sweep. The meas thresholds are and the DC gain minus .
cat > net.cir <<'EOF'
* Mini project: divider, series resistor, ADC load and filter capacitor
V1 vcc 0 DC 5 AC 1 PULSE(0 5 0 1u 1u 1 2)
R1 vcc a 10k
R2 a 0 22k
R3 a b 4.7k
RL b 0 47k
C1 b 0 100n
.control
op
print v(a) v(b)
tran 10u 10m
meas tran t63 when v(b)=1.7432 rise=1
meas tran vb_end find v(b) at=10m
ac dec 50 1 100k
meas ac g0 find vdb(b) at=1
meas ac f3db when vdb(b)=-8.177 fall=1
.endc
.end
EOF
ngspice -b net.cir 2>&1 | grep -E '^(v\(|t63|vb_end|g0|f3db)'v(a) = 3.034038e+00
v(b) = 2.758216e+00
t63 = 9.289714e-04
vb_end = 2.758158e+00
g0 = -5.166983e+00
f3db = 1.713561e+02
Every number matches the hand and Python results: to 0.02 % (the transient uses a finite time step and a rise), to the digits shown, and after within of the final value.
Step 7: explore it live
The netlist lab runs the same circuit as a transient. Move to see the loading error and the time constant change together; raise it to and approaches the designer's 3.44 V.
At the defaults the cursor at reads , matching . Notice that does not start at zero: at the uncharged capacitor holds b at 0 V, so sits in parallel with and jumps to before rising with the same time constant.
Step 8: what you would measure
Setup. Build the network on a breadboard with the listed parts. Bench supply set to , current limit (the circuit draws about ). A DMM for DC, an oscilloscope with a 10:1 probe for the transient, a function generator for the frequency response.
| Measurement | How | Expected | Acceptance band |
|---|---|---|---|
| , | DMM, supply on for several seconds | , | (tolerances plus meter) |
| at b | measure with and without , then | ||
| scope on b, trigger on the supply step (or a 0 to 5 V, 20 Hz square wave from the generator in place of ), time to 63 % | to | ||
| generator sine, peak, sweep for the frequency where the output falls below its low-frequency value; check phase | to |
Two corrections to keep in mind. The DMM's input in parallel with lowers by about (0.09 %, from the source resistance at b), and a 10:1 scope probe's and about are equally negligible next to and . A 1:1 probe (, around ) would pull down by about , almost 1 %. And a generator has a output resistance, which adds to (0.5 %).
Hazards and safe setup. Everything is at or below with a current limit; the largest dissipation is in . Keep the generator's amplitude at or below peak and its offset such that the signal never goes below 0 V if a real ADC is attached (ADC inputs are often damaged by negative voltages).
Write-up template
- Objective. One sentence: what network, which quantities, which methods.
- Circuit. The schematic with node names and part values, tolerances and the measured values of each resistor and the capacitor.
- Predictions. Table of , , , , , from hand analysis, with the equations used.
- Simulation. The Python output and the ngspice transcript; one sentence on any difference and why.
- Tolerance analysis. Expected bands from the Monte Carlo run.
- Measurements. Raw readings with instrument, range and time; derived values with uncertainty.
- Comparison. Prediction, simulation and measurement side by side; does each measurement fall within its band? If not, which assumption failed?
- Design fix. Propose a change that brings within 1 % of 3.44 V (for example scale the divider down tenfold, or add a buffer) and recompute its new time constant and current draw.
- Conclusion. Three lines.
Extensions
- Replace by a real ADC's sample-and-hold model (a small capacitor switched in for a short time) using a
PULSE-driven switch in ngspice, and find the error on the first sample. - Repeat the analysis with mesh currents instead of node voltages (Mesh-Current Analysis) and confirm the same .
- Derive in SymPy and plot its pole (Transfer Functions, Poles, Zeros and Stability).
Test yourself
Why is about 2.76 V instead of the intended 3.44 V?
- the capacitor drops 0.68 V in DC
- the 47 kOhm ADC model loads the 11.6 kOhm Thevenin source
- the supply is only 4 V
- R3 is in parallel with R2
Which resistance sets the time constant with ?
- alone
- the resistance seen by with the source shorted:
- alone
The measured time constant is 1.00 ms. What do you conclude?
- the analysis is wrong
- it is within the band set by the 10 % capacitor, so it agrees
- the resistors are out of tolerance
- the scope is broken
At the cut-off frequency of this first-order network, the output phase relative to the input is…