TExcelTAD
Home › Circuit Theory & Network Analysis › Mini Project: Analyse, Simulate and Characterise an Unfamiliar Network

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

+ - V1 5 V R1 10 kOhm R2 22 kOhm R3 4.7 kOhm C1 100 nF RL 47 kOhm vcc a b ADC input model
Part Value Tolerance Role
V1V_1 5.00 V5.00\ \text{V} bench supply, current limit 10 mA10\ \text{mA} supply
R1R_1, R2R_2 10 kΩ10\ \text{k}\Omega, 22 kΩ22\ \text{k}\Omega 1 % divider setting the reference
R3R_3 4.7 kΩ4.7\ \text{k}\Omega 1 % series resistor of the RC filter
C1C_1 100 nF100\ \text{nF} 10 % (ceramic X7R) filter capacitor
RLR_L 47 kΩ47\ \text{k}\Omega 1 % stands in for the ADC input

The designer intended vb=5⋅22/32=3.44 Vv_b = 5 \cdot 22/32 = 3.44\ \text{V}, forgetting RLR_L. 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):

va−5R1+vaR2+va−vbR3=0vb−vaR3+vbRL=0\begin{aligned} \frac{v_a - 5}{R_1} + \frac{v_a}{R_2} + \frac{v_a - v_b}{R_3} &= 0 \\ \frac{v_b - v_a}{R_3} + \frac{v_b}{R_L} &= 0 \end{aligned}

Result to reproduce: va=3.034 Vv_a = 3.034\ \text{V}, vb=2.758 Vv_b = 2.758\ \text{V}: about 20 % below the intended 3.44 V.

Step 2: Thevenin equivalent seen by the ADC

Remove RLR_L and C1C_1. The divider is a source Vth,a=5⋅22/32=3.4375 VV_{th,a} = 5 \cdot 22/32 = 3.4375\ \text{V} behind R1∥R2=6.875 kΩR_1 \parallel R_2 = 6.875\ \text{k}\Omega, and R3R_3 adds in series (Thevenin and Norton Equivalents):

Vth=3.4375 V,Rth=6.875+4.7=11.575 kΩ,vb=Vth RLRth+RL=3.4375⋅4758.575=2.758 VV_{th} = 3.4375\ \text{V}, \qquad R_{th} = 6.875 + 4.7 = 11.575\ \text{k}\Omega, \qquad v_b = V_{th}\,\frac{R_L}{R_{th} + R_L} = 3.4375 \cdot \frac{47}{58.575} = 2.758\ \text{V}

The same answer as Step 1, by a second method. The fix is now obvious: either buffer the node or make RthR_{th} much smaller than RLR_L.

Step 3: the power-on transient

When the supply steps from 0 to 5 V, C1C_1 charges through the resistance it sees with the source shorted (RL Circuits and the General First-Order Method):

RC=Rth∥RL=11.575⋅4758.575 kΩ=9.288 kΩ,τ=RCC1=0.929 msR_C = R_{th} \parallel R_L = \frac{11.575 \cdot 47}{58.575}\ \text{k}\Omega = 9.288\ \text{k}\Omega, \qquad \tau = R_C C_1 = 0.929\ \text{ms}

So vb(t)=2.758 (1−e−t/τ) Vv_b(t) = 2.758\,(1 - e^{-t/\tau})\ \text{V}, reaching 63 % at 0.929 ms0.929\ \text{ms} and 99 % at τln⁡100=4.28 ms\tau \ln 100 = 4.28\ \text{ms}. 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 V1V_1 to vbv_b (First-Order Low-Pass and High-Pass Filters):

H(jω)=VbV1=H01+jωτ,H0=0.5516 (−5.17 dB),fc=12πτ=171.4 HzH(j\omega) = \frac{V_b}{V_1} = \frac{H_0}{1 + j\omega\tau}, \qquad H_0 = 0.5516\ (-5.17\ \text{dB}), \qquad f_c = \frac{1}{2\pi\tau} = 171.4\ \text{Hz}

Supply noise at 100 Hz passes almost unattenuated; at 10 kHz it is about 35 dB35\ \text{dB} below the DC gain.

Step 5: all of it in Python, with tolerances

python · try it yourself
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 ±0.9 %\pm 0.9\ \% even at the extremes, the time constant by about ±11 %\pm 11\ \% (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 t=0t = 0 for the transient; the DC 5 value is used for op and AC 1 for the sweep. The meas thresholds are 0.632⋅2.758=1.7432 V0.632 \cdot 2.758 = 1.7432\ \text{V} and the DC gain minus 3.01 dB3.01\ \text{dB}.

bash · try it yourself
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: τ\tau to 0.02 % (the transient uses a finite time step and a 1 μs1\ \mu\text{s} rise), fcf_c to the digits shown, and vbv_b after 10 ms≈10.8τ10\ \text{ms} \approx 10.8\tau within 0.06 mV0.06\ \text{mV} of the final value.

Step 7: explore it live

The netlist lab runs the same circuit as a transient. Move RLR_L to see the loading error and the time constant change together; raise it to 1 MΩ1\ \text{M}\Omega and vbv_b approaches the designer's 3.44 V.

At the defaults the cursor at t=2 mst = 2\ \text{ms} reads vb=2.44 Vv_b = 2.44\ \text{V}, matching 2.758 (1−e−2/0.929)=2.44 V2.758\,(1 - e^{-2/0.929}) = 2.44\ \text{V}. Notice that vav_a does not start at zero: at t=0t = 0 the uncharged capacitor holds b at 0 V, so R3R_3 sits in parallel with R2R_2 and vav_a jumps to 5⋅(R2∥R3)/(R1+R2∥R3)=1.40 V5 \cdot (R_2 \parallel R_3)/(R_1 + R_2 \parallel R_3) = 1.40\ \text{V} before rising with the same time constant.

0123012345t (ms)VV(a)V(b)at t = 5.000 msV(vcc)5.00 VV(a)3.03 VV(b)2.75 VI(V1)-197 uAI(R1)197 uAI(R2)138 uAI(R3)59.8 uAI(RL)58.4 uAI(C1)1.36 uA

Step 8: what you would measure

Setup. Build the network on a breadboard with the listed parts. Bench supply set to 5.00 V5.00\ \text{V}, current limit 10 mA10\ \text{mA} (the circuit draws about 0.2 mA0.2\ \text{mA}). 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
vav_a, vbv_b DMM, supply on for several seconds 3.034 V3.034\ \text{V}, 2.758 V2.758\ \text{V} ±1.5 %\pm 1.5\ \% (tolerances plus meter)
RthR_{th} at b measure vbv_b with and without RLR_L, then Rth=RL(Voc/VL−1)R_{th} = R_L(V_{oc}/V_L - 1) 11.58 kΩ11.58\ \text{k}\Omega ±3 %\pm 3\ \%
τ\tau scope on b, trigger on the supply step (or a 0 to 5 V, 20 Hz square wave from the generator in place of V1V_1), time to 63 % 0.929 ms0.929\ \text{ms} 0.830.83 to 1.03 ms1.03\ \text{ms}
fcf_c generator sine, 1 V1\ \text{V} peak, sweep for the frequency where the output falls 3 dB3\ \text{dB} below its low-frequency value; check −45∘-45^\circ phase 171 Hz171\ \text{Hz} 155155 to 192 Hz192\ \text{Hz}

Two corrections to keep in mind. The DMM's 10 MΩ10\ \text{M}\Omega input in parallel with RLR_L lowers vbv_b by about 2.6 mV2.6\ \text{mV} (0.09 %, from the 9.29 kΩ9.29\ \text{k}\Omega source resistance at b), and a 10:1 scope probe's 10 MΩ10\ \text{M}\Omega and about 15 pF15\ \text{pF} are equally negligible next to RLR_L and C1C_1. A 1:1 probe (1 MΩ1\ \text{M}\Omega, around 100 pF100\ \text{pF}) would pull vbv_b down by about 25 mV25\ \text{mV}, almost 1 %. And a generator has a 50 Ω50\ \Omega output resistance, which adds to R1R_1 (0.5 %).

Hazards and safe setup. Everything is at 5 V5\ \text{V} or below with a current limit; the largest dissipation is 0.39 mW0.39\ \text{mW} in R1R_1. Keep the generator's amplitude at or below 5 V5\ \text{V} 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

  1. Objective. One sentence: what network, which quantities, which methods.
  2. Circuit. The schematic with node names and part values, tolerances and the measured values of each resistor and the capacitor.
  3. Predictions. Table of vav_a, vbv_b, VthV_{th}, RthR_{th}, τ\tau, fcf_c from hand analysis, with the equations used.
  4. Simulation. The Python output and the ngspice transcript; one sentence on any difference and why.
  5. Tolerance analysis. Expected bands from the Monte Carlo run.
  6. Measurements. Raw readings with instrument, range and time; derived values with uncertainty.
  7. Comparison. Prediction, simulation and measurement side by side; does each measurement fall within its band? If not, which assumption failed?
  8. Design fix. Propose a change that brings vbv_b 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.
  9. Conclusion. Three lines.

Extensions

  • Replace RLR_L 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 vbv_b.
  • Derive H(s)H(s) in SymPy and plot its pole (Transfer Functions, Poles, Zeros and Stability).

Test yourself

Why is vbv_b about 2.76 V instead of the intended 3.44 V?

  1. the capacitor drops 0.68 V in DC
  2. the 47 kOhm ADC model loads the 11.6 kOhm Thevenin source
  3. the supply is only 4 V
  4. R3 is in parallel with R2

Which resistance sets the time constant with C1C_1?

  1. R3R_3 alone
  2. R1+R2+R3R_1 + R_2 + R_3
  3. the resistance seen by C1C_1 with the source shorted: (R1∥R2+R3)∥RL(R_1 \parallel R_2 + R_3) \parallel R_L
  4. RLR_L alone

The measured time constant is 1.00 ms. What do you conclude?

  1. the analysis is wrong
  2. it is within the band set by the 10 % capacitor, so it agrees
  3. the resistors are out of tolerance
  4. the scope is broken

At the cut-off frequency of this first-order network, the output phase relative to the input is…

  1. 0∘0^\circ
  2. −45∘-45^\circ
  3. −90∘-90^\circ
  4. −180∘-180^\circ