Bradley Worley about
Bode plotting with the Agilent MSO-X 2024A Laziness is the true mother of invention


Inspired by a video by Dave Jones on how to get Bode plots using a swept sine generator and an oscilloscope, I decided to work out a way to pull Bode plots from my scope. Unlike Dave’s method, I only wanted to use a computer-connected digital scope, and no external signal source. Also, I wanted to recover phase information (for complete Bode plots) in addition to gain.

Well, anyone who claims that necessity is the mother of invention has clearly never met a programmer. (it’s actually laziness that drives invention) Strangely enough, it seems we’re the only people who’ve figured it out that a bolus of effort up front can pay for itself in the long term. Rather than methodically dialing up input frequencies and recording the measured response variables, I scripted it, as any programmer would.

With the goal in mind, I wrote a simple C program to text message with my Agilent MSO-X 2024A through the USB Test and Measurement Linux kernel driver. The program runs fine in a VirtualBox‘ed Debian Squeeze system on my iMac, and only requires a decently up-to-date Glibc.

Given a starting frequency, an ending frequency, and a number of points, the program captures the amplitude and phase shift of an analog circuit such that the captured points are evenly spaced in a log-frequency axis. The internal function generator (WaveGen) in the MSO-X is used to send ten cycles of a sinewave into the circuit. The output is measured and the measurements are sent back to the host computer.

Initial testing

To test the code, I lashed up a simple Sallen-Key bandpass filter on a breadboard, calculated its theoretical response, and then measured the true response of the circuit. The results are shown in the figure below:

Active filter testing

To really test the capabilities of this simple program, I used Texas Instruments’ FilterPro software to design an active 8th order Chebyshev bandpass filter around the Analog Devices OP462 quad opamp, as shown below:

I simulated the circuit in Berkeley SPICE and measured its response with usbtmc-bode. I caught a few small software bugs, but to no surprise, the measurements agree well enough with the simulations and design specifications. SPICE simulations indicated a filter with an effective bandwidth of 3.7 kHz with -3 dB transitions around 500 Hz and 4 kHz, and the measurements showed a 3.63 kHz effective bandwidth and a similar passband frequency range. See for yourself below! :)

Instrumentation amplifier

Finally, as a last test, I built up a circuit designed around the AD8428 fixed-gain (66 dB) instrumentation amplifier to try usbtmc-bode on a high gain circuit. With a bit of tweaking of the parameters inside the source code, everything worked out just fine. Check out the measurements:

Application video

The code

Of course, this page would be pretty useless without source code, huh? :P