Recently there's been lots of interest in capacitor equivalent series resistance (ESR) and many other capacitor topics (e.g. see Deep Dive into ESR, Introduction and Capacitor Leakage Experiments and Experimenting with Polymer Capacitors ). This blog post briefly discusses how to build a tool that can attach to a PC, in order to measure the impedance of components. For a brief overview of impedance, and why it can be important, see Measuring Capacitor Characteristics
A normal multi-meter can measure resistance, which is related to the applied voltage, and the DC current through the component under test, using the formula R=V/I.
An impedance meter, also known as an LCR meter, does a similar thing but using AC current instead. This is useful because most components have reactance too, which results in a phase difference between the applied AC voltage sine wave, and the resultant AC current sine wave through the component. By measuring the phase difference, you can work out the capacitance (or inductance) of the component at that frequency, as well as any equivalent series resistance (ESR) of capacitors.
Although some multi-meters can measure capacitance or inductance, they will usually only do it at one frequency. An LCR meter will allow you to vary the frequency.
This project came about because I was building an audio amplifier, and wanted to connect it to the PC using a sound card. While looking for software, I found an application called Visual Analyser (it is Windows only, and closed-source, but free to download). Upon running it, I noticed it had LCR capability, and upon further investigation I noticed an author had published details (PDF) about a two op-amp circuit that can be attached to the sound card, to convert it into an LCR meter! So, I decided to take two of my (mono) audio amplifier circuit boards, and build the circuit to try it out. The results seem very good.
How does it work?
Shown further below is a high-level diagram of the system. Under command of the PC software, the sound card generates a sine wave. This is applied to a series circuit consisting of a known resistance and the unknown impedance. These two components in series act like a potential divider. As described at Measuring Capacitor Characteristics, by measuring the voltage (and phase) at the top and the middle of the potential divider, the PC software can determine the unknown impedance.
There’s more complication in the software (it needs to run a calibration routine for instance) but at a high level that’s all there is to it.
For the practical implementation, the known resistance is actually a bank of accurate resistors, switched in using a rotary switch. This allows the circuit to be usable for a wide span of unknown impedance.
The circuit diagram further below shows a possible implementation. It is the circuit I built, but it could be improved. The circuit contains lots of ‘do not fit’ component locations, so that the design can be modified in future.
The circuit uses a rotary switch in order to select the known resistance in the range of 10 ohm to 100k. It would be nice to have a lower resistance too, but that would need a buffer since otherwise the sound card output would be loaded too heavily.
The rotary switch has two poles, and the second pole could be used to light up LEDs to indicate the range. Perhaps that’s unnecessary though since the rotary dial can just be labelled.
For the audio connectors, normal sound cards have 3.5mm stereo jack connections or mono phono (RCA) sockets (two of them, for left and right), but ‘home music’ type of sound cards use 6.35mm mono jacks. Personally I feel the larger 6.35mm is a good option, because it allows for easy cable construction (the cables need a good braided shield, so tend to be fat) and separation of the two channels.
For the rotary switch, to simplify connections, one option could be to have a separate PCB (or an area of the PCB that is cut off), that solders to the pins of the rotary switch, and has the known resistances soldered on that board too. That way, only two wires need to be used, to connect between that separate PCB and the main PCB. Some holes on the PCB for mounting an L-shaped bracket for the rotary switch could be an option too.
Another idea could be to have the audio in/out brought out to a header connector too, in case in future an add-on board is used to (say) connect via I2S to a Pi or BBB for future custom software. That would have the advantage of eliminating variability between USB sound cards and any manipulation that Windows drivers or sound system may do (incidentally if you’re buying a sound card, an ‘ASIO input’ and ‘ASIO output’ capable card will eliminate such manipulations as I understand (I don’t know much about sound cards).
As mentioned I was working on a microphone amplifier, so I had lots of spare PCBs that accommodated a single op-amp on each. So, for the prototype, I used two of the boards (one was cut in half). The cables for the sound card were directly wired without sockets. The battery holders (two AA cells are used for +1.5V and -1.5V rails) were glued onto the PCB. The whole design should hopefully slide into a case intended for 160mm wide PCBs (I don’t have the case yet).
For the device-under-test (DUT) connection, I used a home-made cable set: Building Kelvin (4-Wire) Test Leads
The Gerber files are attached to this blog post, but they are not very useful for this project - better to build a dedicated PCB. Here's a close-up the op-amp area:
To operate it, download the Visual Analyser software, and install it. I used VA64, and it seems to work fine.
Connect up the LCR meter circuit to the sound card. I used the line in and line outputs. My sound card (Scarlett 2i2 2nd Gen) has gain control for the left and right inputs, so I cranked them up to max. If your sound card distorts at max, then you may not want to do that. I don’t know the implications, since I don’t know precisely what algorithm is used by the software. It presumably auto-adjusts the output channel amplitude, in order for the input channels to not significantly distort.
Next, run VA64 and there’s a checkbox near the lower-right side of the display, labelled ZRLC meter. Click on that to launch the LCR functionality!
The next step is to perform a calibration. This is really easy. First, ensure no DUT is attached. Then, select a desired range with the rotary switch, based on approximately the expected impedance at a desired frequency.
Next, select the desired frequency in the software (I selected 120Hz in the screenshot below) and use the drop-down to select the correct range. Click on the Measure button, and a calibration will occur at that frequency.
You can now attach the unknown impedance to the DUT (don’t forget to short any charged capacitance first!) and the results should be displayed! The screenshot below shows an ESR value of 1.297 ohm for a capacitor.
If you want to change frequency or range, you’ll need to press the Stop button to do that, and then disconnect the DUT and re-do the calibration.
From my initial minimal tests, the results appear good. I confirmed with an LCR meter that should be in-cal. I’ve not tested much so far though. I tested a resistor (it measured 8.8 ohm on both instruments), and a 22uF capacitor which measured 1.28 ohm ESR on both instruments too.
This project uses an off-the-shelf PC and sound card, in conjunction with the Visual Analyser software, to implement a low-cost LCR meter. The initial results seem good, although further tests need to be done.
Thanks for reading!
export-amplifier-board-rev1.zip 267.5 KB