RC filter on the bench
A function generator into an RC low pass, with a two-channel scope on both ends and a multimeter reading the output: sweep it from the knobs and watch the phase lag. There is no microcontroller in it: the simulator solves the 5 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
BeginnerRuns in your browser. Free, and no account needed.
How it works
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// A function generator into an RC low pass, with a scope on both ends of
// it and a meter across the output.
//
// R = 16 k, C = 100 nF. The corner is where the capacitor's reactance equals
// the resistance:
//
// f0 = 1 / (2 pi R C) = 1 / (2 pi x 16000 x 100e-9) = 99.5 Hz
//
// The generator is set to 100 Hz, which is as good as on the corner, so the
// filtered trace (blue, CH2) comes out at 0.707 of the yellow one and a whole
// eighth of a cycle behind it: 2 V peak in, 1.41 V peak out. The meter reads
// the same thing the other way around: true RMS, so 0.99 V against the
// 1.41 V RMS going in.
//
// Sweep it by hand. The - and + under the frequency on the generator's face
// step 1, 2, 5 per decade without opening a panel:
//
// 20 Hz the traces sit almost on top of each other, lag about 11 degrees
// 100 Hz 0.707 and 45 degrees, the corner
// 500 Hz down to about a fifth, lag nearly 80 degrees
// 2 kHz the blue trace has all but gone
//
// Count the lag in divisions. At 100 Hz one cycle is 10 ms, the time base is
// 2 ms a division, so a whole cycle is five divisions and 45 degrees is
// five eighths of one.
//
// Two things the instruments will not do, and both are marked on the parts.
// The generator drives through 50 ohms, which is nothing against 16 k here but
// halves the amplitude into a 50 ohm load. The meter samples at 4 kHz, so
// above about a kilohertz its AC reading is under-sampled and reads low;
// the scope is the instrument for that, which is the real lesson.
//
// Sweep it all at once: the Bode plot.
//
// Analysis... in the more menu, then Frequency response. Drive gen1, leave the
// input net on the generator's own node, watch the filtered node, and sweep
// 1 Hz to 100 kHz at 20 points a decade. What the engine draws:
//
// below the corner flat, at -0.15 dB
// about 101 Hz the marked -3 dB point, and -45 degrees of lag
// 1 kHz -20.1 dB, -84 degrees
// 10 kHz -40.0 dB, -89 degrees
//
// Ten times the frequency is twenty decibels less: that is what one capacitor
// does, and it is a straight line on a log axis.
//
// Now the interesting part. The formula says the corner is at 99.5 Hz and the
// pass band should be 0 dB, and the plot says 101 Hz and -0.15 dB. Both of
// those are the instruments, and both are real. The scope's probe is 1 Mohm
// and the meter on volts is 10 Mohm; the two of them in parallel are 909 k,
// sitting across the capacitor. That divider is the 0.15 dB, and the R in
// 1 / (2 pi R C) is no longer 16 k but 16 k in parallel with 909 k, which is
// 15.7 k, so the corner moves up to 101 Hz. Take both instruments off the
// node and it goes back to 99.5 Hz. A real 1 Mohm probe on a real 16 k source
// does exactly this, which is why bench probes are 10 Mohm on the x10 range.
//
// What the plot will not show you, because the engine does not model it: no
// noise, no distortion, and no second pole in an op-amp. A transistor does have a high-frequency corner of its own now:
// every card carries its junction capacitance since Analog 3.
Parts list
6 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Full-size breadboard
- 1 × Function generator
- 1 × Resistor, 16k Ω
- 1 × Capacitor, 100 nF
- 1 × Oscilloscope
- 1 × Multimeter
How it is wired
3 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Ground: Function generator pin GND; Capacitor, 100 nF pin 2; Oscilloscope pin GND; Multimeter pin COM
- Function generator pin OUT; Resistor, 16k Ω pin 1; Oscilloscope pin CH1
- Resistor, 16k Ω pin 2; Capacitor, 100 nF pin 1; Oscilloscope pin CH2; Multimeter pin V
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.