A Pretty Good LC Meter Based on the AVR using ATTINY2313 Microcontroller

Calculates and displays L and C from oscillation frequency using reference components.
No relays, no range switching, a minimum of controls. And it is pretty accurate too!

Note: After reading this article,
check out the improved, modified An Even Better LC Meter…
A Pretty Good LC Meter Based on the AVR using ATTINY2313 Microcontroller
The 2 line x 16 character LCD shows the calculated inductance and the oscillation
frequency. The frequency might be of interest because inductors with cores can appear to
vary in inductance with changing test conditions.
Files for this project available for downloading:
To make the complete project you will need at a minimum both of the hex files below. You can also download the source files if you wish to customize them.The hex file containing code for the frequency meter – U3- ATTINY2313 or AT90S2313 2313LCmeter_070217A.hex
WINAVR C Compiler Source file 2313LCmeter_070217A.c
The WINAVR Project Folder 2313LCmeter_070217A_project.zipThe hex file containing code for the LCD driver chip – U4- ATTINY2313 or AT90S2313  LCDbuttons040904C.hex
The assembly source code for the LCD driver chip  LDCbutons040904C.asm
The assembly source code for the LCD driver chip updated for newer assmblers LDCbutons040904C_updated.asm
The include file needed by the LCD driver chip   2x16lcd.inc


There must be half a dozen similar LC meters on the web. Why didn’t I just download one of them and use it?  I suppose part of the answer is that I wanted to do some of it myself. As nice as these other projects are, I wanted to make an LC meter that others could copy and get working without very much trouble. That meant that “exotic” components need to be kept to a minimum, and to me, that means no relays or hard-to-find special switches. It also means that the complete design needs to be spelled out in sufficient detail to allow anybody with basic assembly skills to put it together and make it work.
This instrument requires two precision components: A precision capacitor and a precision inductor. You only need to start with one precision component, either the reference capacitor or the reference inductor, and using this meter, you can select or adjust the other precision component.
In my case, I used a pretty high accuracy BK Precision inductance/capacitance meter and sorted through piles of inductors and capacitors to find those that had the lowest error. I then used those parts, a 1 millihenry inductor and a 0.01 microfarad capacitor, in this meter.
The basis of this project is several similar projects on the world wide web and some magazine articles before the world wide web was a common means of information interchange. Unfortunately, I am not able to determine the originator(s) of the concept, but I suspect that it is as old as radio. Another project on my web site, LC Determination by  Resonant Frequency Measurement, measures the resonant frequency of an L/C circuit, but the hardware stops at the frequency measurement. It does not proceed to calculate the unknown inductance or capacitance.
To convert from frequency to inductance or capacitance requires a pocket calculator or spreadsheet, and is fine if only taking a few measurements per day. Beyond that, the manual labor seems a bit much, and the time to complete a measurement and calculation becomes burdensome. As I found myself spending more time winding transformers in my Thailand lab for various power supplies that I longed for a meter that would read out directly in inductance and capacitance, such as I had in my lab in Arizona.
The only difficulty in getting the instrument to display inductance and capacitance directly was in organizing the assembly language code, and probably more importantly, properly scaling the operations. I had looked into it, and it seems to be too much trouble. It would take about as much time and energy to add this feature to the LC meter as it would to learn to use a C compiler. So, that’s why this project is written in C.
Please excuse the fact that in some ways the source code looks more like assembly than C. This will improve with time.
It was a true pleasure to type:
inductance = (((numerator/(628*frequency))*(numerator/(628*frequency)))/capacitance);
and have the calculation performed and the result returned with high precision. It is a small difference from organizing assembly language code to do the same, but it is such small things that changes the way we do things.  Similarly, debugging was easier in C than in assembly language because I needed to look at and manipulate large numbers during debugging.

Basic Theory of Operation

An LC oscillator oscillates at the resonant frequency of a parallel LC resonant circuit. When measuring an inductor, a precision capacitor is switched in to the circuit. When measuring a capacitor, a precision inductor is switched into the circuit.
If the Q of the resonant circuit is about 10 or greater, the measurement error contributed by this factor will be less than 1%. Q is the comparison of the losses in the circuit, often the result of resistance in the circuit, with the reactance of the inductor and capacitor. The Q of good quality capacitors is usually not a problem – just keep away from ceramic and electrolytic capacitors and you shouldn’t have a problem. The Q of the inductor is the one to watch out for. The first inductor that I used had a Q of 3 when measuring a 0.47 uf capacitor, and that made the error nearly 20%!
Q of the inductor is of greatest concern at the lowest operating frequency. In this application, this corresponds to the situation in which the highest value capacitor is being measured.  A 1 mH inductor resonates with a 1 uf capacitor at 5.035 kHz. The reactance of the inductor is 6.28 x 5.035 kHz x 1mH = 31.6 Ohms. In order to keep the error contributed by the Q of the coil to less than 1% of the measured value, the Q must be 10, so the resistance of the resonant circuit must be less than 1/10 of the reactance, or 3.16 Ohms. You can check the resistance of inductors you are considering for use as L2 with an Ohmmeter to find its resistance.
Before measuring, the circuit’s offset reactance needs to be measured and removed, using a zero set procedure. Turn the meter on for a few seconds, to allow enough time for the analog circuitry and the readings to settle, then if measuring an inductor, short the Lx/Cx terminals together, or if measuring  a capacitor, leave the terminals open. Press the ZERO SET button and hold it down for a couple of measurement cycles. The LED blinks one time each measurement cycle. Release the ZERO SET button, and after the current measurement cycle is completed, the meter should read zero.
A convenient alternative means of shorting the Lx/Cx terminals during ZERO SET for an inductance measurement is to press and hold the SHORT button during the ZERO SET procedure.


  • Inductance from 0.1 uH to 50 H with 0.1 uH resolution.  Note: High resistance in inductors contributes to  measurement error.
  • Capacitance from 1 pf to 1 uf with 1 pf resolution.  (Note: Resistance of the reference inductor limits accuracy with large capacitance values).
  • The pilot light blinks once during the transmission of the results from each measurement.
  • Resonant frequency is displayed in Hz.
  • Measurement interval is approximately 1.1 seconds.

The actual range of the firmware extends to 300 Microfarads and 300 Henries, but with the component values in the present oscillator circuit, the oscillator is not capable of operating that slow. For values above about 1 microfarads and 50 Henries, I suggest increasing the values of C1, C2, C3, and L2, and increasing the frequency measurement time from one second to 10 seconds or more.
Accuracy is, for the most part, dependent upon the accuracy of the reference inductor, the reference capacitor, and the 4 MHz clock oscillator for U3. Resolution is not the same as accuracy. Note that you could measure a 25 Henry inductor and display will show it in 100 nanohenry increments (as an example: 25074164.6). The accuracy of the measurement could probably only be on the order of 1%, and take note of the frequency: at 25 Henrys, the oscillator only runs at 318 Hz and is sampled for only one second, so the granularity of the measurement, that is the smallest change in the measured value that can be detected, is found by taking larger of the difference in frequencies 1 Hz above and 1 Hz below 318 Hz, compared to 318 Hz.

  • Inductance corresponding to  317 Hz = 25.232 H   +248 mH
  • Inductance corresponding to  318 Hz = 25.074 H
  • Inductance corresponding to  319 Hz = 24.917 H     -157 mH

The resistance of the inductor will affect the inductance measurement slightly. I have some pc mounted power supply chokes with very poor Q – about 100 oHms for the 10 millihenry inductor. Its measurement seems to be off about 5%. Capacitors tend to have much higher Q than inductors, and unless you are making your own using low Q dielectric, it would not be worth worrying about how the Q of capacitors affects the measurement.

osc loop
This meter assumes a lumped inductor and a lumped capacitor coupled directly against each other. If there is a lot of capacitance distributed over the inductance, such as in a delay line or transmission line, the resulting measurement will not be meaningful in terms of inductance of capacitance. This means that this is no the appropriate tool to measure the inductance of that 75 meter diameter lowfer loop antenna behind your house.On the subject of long test leads, I have noticed that my meter is susceptible to interference from my computer when I tried to use the meter right next to the computer. This is not a great surprise since the computer has two intentional transmitters operating (Bluetooth and WI-Fi), and of course some lesser incidental noise sources. Even if the meter were to be shielded, the test terminals, and any test leads connected to them can pick up noise.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top