Built-in project · no microcontroller

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.

Teaching? Assign it to your class in one click.

Beginner About 15 minutes to build and run. Runs in your browser. Free, and no account needed.

The parts retail for about $5.15. On Mokxi they're free.

The circuit runs here once the page has loaded.

What you'll learn

  • RC low pass filters and the corner frequency
  • Predicting the cutoff with f = 1 / (2 pi R C)
  • Reading amplitude and phase lag on a two channel scope
  • Decibels and a Bode plot sweep
  • How instruments load the circuit they measure
  • Difficulty: Beginner
  • Time: About 15 minutes
  • Parts: 3

How it works

A function generator sends a 100 Hz wave through a 16 k resistor into a 100 nF capacitor. The scope's first channel watches the wave going in. The second channel watches the wave at the resistor and capacitor junction.

That junction wave is smaller and arrives late. The capacitor lets low frequencies through and drains away high ones, which makes this a low pass filter.

At 100 Hz you are right at the corner, near 99.5 Hz. The output is about 0.707 of the input and lags it by 45 degrees. The multimeter reads the output as a true RMS voltage.

Parts list

3 parts, plus the jumper wires and 3 bench instruments. The parts retail for about $5.15; on Mokxi they're free, and so are the instruments.

Wiring table

Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.

Part and pinConnects to
Function generator pin GNDGround
Capacitor, 100 nF pin 2Ground
Oscilloscope pin GNDGround
Multimeter pin COMGround
Resistor, 16k Ω pin 1Function generator pin OUT
Oscilloscope pin CH1Function generator pin OUT
Capacitor, 100 nF pin 1Resistor, 16k Ω pin 2
Oscilloscope pin CH2Resistor, 16k Ω pin 2
Multimeter pin VResistor, 16k Ω pin 2

The notes that come with it

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.

sketch.ino
// 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.

Troubleshooting

The usual mistakes with this circuit, and the fix for each.

  • The two scope traces look identical This project
    Check that CH2 connects to the junction of the resistor and capacitor, not to the generator. Also try a higher frequency, since the filter barely touches 20 Hz.
  • The output trace is flat or missing This project
    Make sure the capacitor's second pin goes to the shared ground. Without it there is no path to ground, so nothing gets filtered.
  • The meter reads lower than you expect at a few kilohertz This project
    The meter samples at 4 kHz, so its AC reading falls off at high frequency. Use the scope for those readings.
  • The signal is smaller than the knob says when connected to a circuit. Function generator
    The output has a 50 ohm source resistance, so a low-resistance load pulls the level down. Use a high-impedance load, or buffer the signal with an op-amp.
  • The reading on a pin is wrong or the wave is clipped. Function generator
    Keep the amplitude and offset within what the input can take. A microcontroller pin wants 0 to 5 V, never negative. Add a DC offset or a series resistor.
  • The LED is dim, burns out, or the pin reads wrong because the resistor value is off. Resistor
    Read the color bands again. A 220 ohm to 330 ohm resistor suits a typical LED on 5 V. 10k is a common pull-up or pull-down value. Check with a multimeter if unsure.
  • A pull-up or pull-down resistor is missing, so the input floats and reads random values. Resistor
    Tie the input to 5 V or ground through about 10k. Or use INPUT_PULLUP and wire the switch to ground.
  • An electrolytic capacitor heats up, bulges or pops. Capacitor
    Electrolytics have a polarity. The stripe marks the negative leg, which goes toward ground. Also keep the voltage under the rated value, such as 10 V or 16 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.