I have been thinking about building an LC meter for a while since I do not have a multimeter that is capable of measuring inductance and while the multimeters I have can measure capacitance, they are not able to give accurate readings for small capacitance in the range of several pF’s.
There are quite a few good articles on how to build LC meters using PIC MCUs (like the ones here: 1, 2, 3), but instructions on how to build one with an ATmega MCU are few and far in between, although the basic principle is largely the same. So I decided to write this article on how to build an LC meter using an ATmega328p chip and Arduino libraries.
A typical LC meter is nothing but a wide range LC oscillator. When measuring an inductor or capacitor, the added inductance or capacitance changes the oscillator’s output frequency. And by calculating this frequency change, we can deduce the inductance or capacitance depending on the measurement.
The following schematic shows the comparator based LC oscillator I used in the LC meter. The oscillator portion is quite standard. Most of the other designs I have seen use LM311 comparator. But for this type of application, any comparator capable of oscillating up to 50kHz should be more than sufficient. I happen to have some spare LM339’s lying around so I used it in the oscillator circuit.

Note, there should be a 3K pull up resistor on pin 1 and the feedback resistor should be 100K instead of 10K.
Because what we are really meausring is the frequency of the oscillator, we can build a frequency meter using the same circuit at almost no additional cost. As you can see in the circuit above, a reed relay is used to switch the measurement from LC mode to frequency mode. In the schematics above, the second comparator forms a Schmitt trigger to condition the input waveform so that the frequency measurement can be made more accurate. When in the LC mode, the frequency output from the first comparator is simply feed through the Schmitt trigger. The output frequency is determined by
\[f_0=\frac{1}{2\pi\sqrt{LC}}\]
where
\[L=L_0 + L_{measured}\] and
\[C=C_0 + C_{measured}\]
Choosing a high accuracy L0 and C0 helps improve the accuracy of the meter.
Here’s the MCU side of the schematics:

This circuit is capable of measuring inductance in a wide range, from a few nH all the way up to a few Henrys. For capatance measurement, I have found that it is most suitable for measurement from a few pF to tens of nF. You maybe able to measure slightly larger capacitors if they have a high ESR rating. But this range limit in capacitance measurement should not be an issue as what we care most about is the accuracy in the pF range.
I used this frequency library for the frequency measurement. By default, the display is updated every second. This mode provides the most accurate result. You can shorten this update interval easily, but the measurement accuracy will be reduced.
The Arduino code for this project can be downloaded here (LCFrequencyMeter.zip). This project was developed using the NetBeans IDE and you may need to adjust the included header files if you are using Arduino IDE. For more information, please see my previous article on this topic.
The calibration method I used is like this: in capacitance measurement mode, the none-load reading is used to calculate stray inductance (assume that C0 is accurate) which is then used to compensate capacitance measurements. And similarly, in inductance measurement mode, we assume that L0 is accurate and the none-load reading (by shorting the test leads) is used to calculate stray capacitance which is then used to compensate inductance measurements. If you read through the code you will get a better idea on how this is done.
[adsense] |
The following picture shows the capacitance reading when using this meter to measure a known 2.22nF capacitor:
And this picture shows the LC meter in inductance mode, measuring a small inductor:
Here is a picture showing frequency measurement. The frequency source is a 555 timer generated square wave:
Within a selected mode, the display is auto ranged for the components/frequencies under measurement.
Hello Wong,
Can you pls send the hex file to me too?
upanadesara@gmail.com
thanks.
in windows 10 not work??
Thanks for posting this!
It’s a little unclear where the coil/cap to be tested goes (L/C on the left of the core schematic?) is named the same as the (L/C) sense switch on the 2nd comparator. Also where the relay contacts go on the core schematic. Is the relay only for push-button operation of the L/C vs. freq option, and would a simple DPDT switch do as well?
L/C switching is done using a DPDT switch (towards the left of the schematic) and the L/C frequency switching is done using a relay via the LC/Frequency momentary switch. Hope this helps!
Thanks for the quick response!
Hello,
This looks like a great project and I would like to make it. I have a few questions about the discrete transistors at the bottom of the schematic – I understand the one on the left is related to the function of the relay which switches between L/C and f, but what is the one on the right for ? Is it related somehow to this switch or is it something unrelated? If I wanted to simplify the device a little by leaving out the frequency counter, in addition to omitting the relay and the momentary switch, would I also omit that second transistor?
Thanks,. Rob
Ok, I figured out the answers to my questions, and. I built the circuit – it works great. I wired it up on a bread board, with an Arduino nano. I modified the code to use LiquidCrystal_I2C because the LCD displays I had lying around all had I2C backpacks on them. Once you switch to I2C you’ll never go back. Next I may make a PC board for SMD parts and put it in a small project box for use. Thanks Kerry for the project.
Hello Wong,
Can you pls send the hex file to me too?
nchit2018@agruni.edu.ge
thanks.
Dear, please could you send me the source code and schematic? i’m building this but it’s not working. Thanks
silent.hissss@gmail.com
Hi Kerry D. Wong.
Look great. You have done well
Is possible to get the source code for this, please.
Kind regards James
interested
can you share with me
for firmware file?
CAN YOU PLEASE SEND ME THE HEX FILE and schematic FOR THIS…. skldj420@gmail.com
Hi Kerry D. Wong. i am able to get arduino pde file , but unable to compile it because lots of missing files.. so can you please provide me the arduino ino file or just simple hex file… mdshakildj@gmail.com
Hi Kerry.
Good job. I am very interested in this project and I want to realize it, but I am stuck on the connection part to test the components on the MCU side of the diagrams, would you please enlighten me with a more detailed diagram on this side. I’m using arduino IDE and had to adjust the included header files:
#define __AVR_ATmega328P__
#include
#include
#include
#include
#include “Arduino.h”
#include
#include
#include
#include
#include
#include
Do you think that’s ok?
Thank you in advance for your reply.
mice project sir.
can you share with me for firmware and complete schematic.
Thanks
Merhaba
Firmware ve komple şema için benimle paylaşır mısınız?
teşekkürler
babak
hi eng Wong,
Can you pls send the hex file to me too?
gordanbabak@gmail.com
thanks.