Built-in project · no microcontroller

RLC resonance on the bench

A signal generator into a series resistor, inductor and capacitor, with a scope on the input and across the ring: sweep it and watch the peak, the -3 dB skirts either side of it, and the phase cross -90 degrees at resonance. 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.

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

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

The circuit runs here once the page has loaded.

What you'll learn

  • Series RLC resonance and the formula for f0
  • What Q means: how sharp the peak is
  • Reading a frequency response plot in decibels
  • Why an LC pair rolls off twice as fast as an RC
  • Difficulty: Intermediate
  • Time: About 20 minutes
  • Parts: 4

How it works

A function generator drives a 250 ohm resistor, a 10 mH inductor and a 2.5 nF capacitor in series. The scope's CH1 watches the input. CH2 watches the node between the inductor and the capacitor.

This circuit rings at one frequency, f0 = 1 / (2 pi sqrt(L C)), which is about 31.8 kHz here. Near that frequency the voltage at CH2 grows much larger than the input.

How sharp the peak is depends on Q, which is 8 for these parts. A frequency response sweep from 1 kHz to 300 kHz shows a peak of about 17.9 dB, then a steep fall of about 40 dB a decade.

Parts list

4 parts, plus the jumper wires and 2 bench instruments. The parts retail for about $5.35; 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, 2.5 nF pin 2Ground
Oscilloscope pin GNDGround
Resistor, 250 Ω pin 1Function generator pin OUT
Oscilloscope pin CH1Function generator pin OUT
Inductor pin 1Resistor, 250 Ω pin 2
Capacitor, 2.5 nF pin 1Inductor pin 2
Oscilloscope pin CH2Inductor 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 signal generator into a resistor, an inductor and a capacitor in
// series, with a scope on the input and on the node between the inductor and
// the capacitor.
//
// R = 250 ohm, L = 10 mH, C = 2.5 nF. Every coil and every capacitor put
// together like this ring at one frequency, and the formula says where:
//
//   f0 = 1 / (2 pi sqrt(L C)) = 1 / (2 pi sqrt(0.01 x 2.5e-9)) = 31 831 Hz
//
// and how sharp the ring is has a name too, Q, the size of the reactance at
// resonance against the resistance that damps it:
//
//   Q = (1 / R) sqrt(L / C) = (1 / 250) sqrt(0.01 / 2.5e-9) = 8.0
//
// A Q of 8 is a good bench number: sharp enough that the peak is real and
// obvious, gentle enough that a hand sweep finds it in a few tries rather
// than skating straight past it.
//
// Sweep it. Analysis... in the more menu, then Frequency response. Drive
// gen1, leave the input on the generator's own node, watch the node between
// the inductor and the capacitor, and sweep 1 kHz to 300 kHz at 40 points a
// decade. What comes back:
//
//   well below 31.8 kHz   flat, at 0 dB: the capacitor is nearly open and
//                          barely anything is dropped across R and L yet
//   the peak               about 17.9 dB, a ratio of about 7.9, near 31.6 kHz
//   at 31.8 kHz exactly    the phase crosses -90 degrees
//   100 kHz to 1 MHz       falling at about 40 dB a decade: an inductor and a
//                          capacitor, twice the roll-off an RC filter gives
//
// Two things worth stopping on.
//
// The peak comes in at a ratio of about 7.9, a hair under the formula's Q of
// 8.0. The scope's own 1 Mohm sits right across the capacitor, exactly where
// it sits in the RC filter on the bench, and it takes the same kind of small
// bite out of the reading, just a much smaller one: 1 Mohm here is five
// hundred times the tank's own 2 k ohm (sqrt(L / C)) rather than a few dozen
// times a filter resistor, so the peak barely moves instead of shifting the
// way that filter's corner does. The true peak also sits a hair below 31.8
// kHz for the same textbook reason a hand-solved RLC does in
// crates/analog/tests/ac.rs: f0 sqrt(1 - 1 / (2 Q^2)), which for a Q of 8
// lands at about 31.7 kHz, close enough that a hand sweep will not tell the
// two apart.
//
// One thing that does NOT move the peak at all: the generator's own 50 ohms.
// It sits upstream of the node the ratio is measured from, so it drops
// straight out of the reading, the same way it does for the RC filter on the
// bench. A real bench generator carries that resistor everywhere it goes; it
// simply is not part of this particular number.
//
// Two things to try. Double R to 500 ohms and Q drops to about 4.0, the peak
// falling to about 12 dB, very nearly exactly half, because R is the only
// thing in the formula Q actually depends on here. Halve C instead and f0
// doubles, since it lives under the square root together with L.

Troubleshooting

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

  • No peak shows in the sweep This project
    Probe the node between the inductor and the capacitor with CH2. Also make sure the sweep covers 31.8 kHz.
  • The output never rises above the input This project
    Check the order. The resistor and inductor go in series, and the capacitor goes from their junction to ground.
  • The peak moved after changing a part This project
    L and C set the frequency. R sets Q, so a bigger resistor lowers and flattens the peak.
  • 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.
  • A big voltage spike appears when current through the coil is cut, and it can damage a transistor or a chip. Inductor
    Put a flyback diode across the coil, or a snubber, so the current has a path when the switch opens.

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.