AVR LC Meter With Frequency Measurement

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.

LC Meter - Oscillator

LC Meter - Oscillator

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

\[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:

LC Meter

LC Meter

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.

The following picture shows the capacitance reading when using this meter to measure a known 2.22nF capacitor:

Capacitance Measurement

Capacitance Measurement

And this picture shows the LC meter in inductance mode, measuring a small inductor:

Inductance Measurement

Inductance Measurement

Here is a picture showing frequency measurement. The frequency source is a 555 timer generated square wave:

Frequency Measurement

Frequency Measurement

Within a selected mode, the display is auto ranged for the components/frequencies under measurement.

Be Sociable, Share!


  1. xraid says:


    I am interested in building this, there seems to be a mismatch of code and schematics, there is a missing code for the backlight circuit going to pins 16-pb2 and 23-pc0 …

    do you have it handy ?

    some kind of spec for the relay in the “MCU side of the schematics:” would be most welcome … as i do not understand what part that would be … partly because as the code for that part is missing ;-) …


    • kwong says:

      Hi Xraid,

      The code uses the standard Arduino library, and the pinout are slightly different then the chip pinout. Please refer to (http://www.arduino.cc/en/Hacking/PinMapping) for more information. Pin 14- Pin 19 correspond to the analog pin 0 to 5.

      In the code for this LC meter, the relay is controlled by pin 14 (analog pin 0, which is pin 23 of the chip in the diagram) and the backlight is controlled by pin 10 (which is pin 16 in the diagram).

      The relay is used to switch between the LC mode and Frequency measurement mode automatically and you can use any kind of SPDT relays.

  2. xraid says:

    yes i got that . but not the circuit part for the pins 16-pb2 and 23-pc0, that is for regulating the LCD DRIVING VOLTAGE …

    there is no code for it ? …

    • kwong says:

      Check the variable pinRelay (Arduino pin 14) and pinBACKLIGHT (Arduino pin 10) and those are the two pins controlling the LCD back light and the relay.

      Not sure what you mean by “regulating the LCD driving voltage”. The HD44780 compatible LCDs can be driven by either TTL or CMOS voltage level and the backlight can be powered directly (some does require a current limiting resistor) by 5-6V DC supply.

      Hope this helps.

  3. xraid says:

    ahhh . k let me try … i dident get that the relay is the same relay as in the oscillator schematic and how its connected to the relay in the mcu schematic …

  4. Zack says:

    I’m in the process of building this awesome circuit, thanks for sharing!!! I do have one question so far though. Looking at the “LC Meter – Oscillator” schematic, I’m a bit lost on the relay portion at L/C-Freq. How is the coil of the relay hooked up/activated? I only see where the switching contacts are in this schematic. What does the coil connect to? Thank you.

  5. Paul says:

    Looks remakably like elmcie (with an atmega8).

  6. Stanley says:

    Hi, thanks for publishing the diagrams for the LC/Freq meter for AVR/Arduino…

    Can you also list all the components needed to make this meter assuming we are using an Arduino UNO board.

    I’ve done the LCD portion, so no issues wiring that part, I’m quite confused and could not understand the LC oscillator portion of the circuit..

    Can you explain more details about the LC Oscillator portion of the circuit ?

    Is the Freq going to Pin 5 or Pin 2 on the circuit…

    Perhaps some pictures ?

    Thank you

    • kwong says:

      The frequency output (to the far right of the op-amp schematic) goes to Arduino pin 5, and the switch (far left towards the bottom) goes to pin2. Pin2 (in the MCU schematic marked with L/C Switch Sense) is used to sense the position of the switch (i.e. in L or in C mode). Hope this helps.

  7. Nishank says:

    Hi Kwong,

    My name is Nishank and I am working on building a LC meter myself. However, much to my distress, i am not allowed to use the microprocessor that you used but i am allowed to use an 80C188 microprocessor and also, we are not allowed to use a 555 timer, however, we are required to use the timer of the microprocessor itself to measure the frequency. do u have any solution. any help would be greatly appreciated.


  8. hayankata says:

    can we use ATmega168(DUEMILANOVE) instead of ATMEGA328P.

  9. hayankata says:

    what is the range of Frequency measurement.

  10. Pete says:

    is it just me… or does the schematic and the circuit not match. When I ground pin 2… as it shows in diagram… I go int L mode… not C mode.

  11. vigulas says:

    hello, i would probably start to ask a little help but i think i need a lot of help….
    i´m just trying to set up this nice project but i know almost nothing about programming….:S
    i tryed to compile this file on arduino software and even after a few changes on #include line e keep having the same error….:
    In file included from LCFrequencyMeter.cpp:16:
    d:/arduino/arduino-0022/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected unqualified-id before ‘double’
    d:/arduino/arduino-0022/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)’ before ‘double’
    d:/arduino/arduino-0022/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)’ before ‘double’
    yeh…im just a big lame on this but do you think you could give a big little help?(if you think it is possible due to my so lame programming skils…:D )
    best regards

    • kwong says:

      Could you post your code so I can take a look at? Thanks.

      • vigulas says:

        hello many thanks for the so quickly reply :D
        the code is no mine (i wish i would have half of that skills….) the code i just downloaded from the link you´ve posted:

        * AVR LC/Frequency Meter
        * Kerry Wong
        * http://www.kerrywong.com

        #define __AVR_ATmega328P__


        enum MeterMode {

        //Frequency input is digital pin 5

        const int pinRS = 3;
        const int pinEn = 4;
        const int pinD4 = 16;
        const int pinD5 = 17;
        const int pinD6 = 8;
        const int pinD7 = 9;
        const int pinBACKLIGHT = 10;

        const int btn1 = 0;
        const int btn2 = 1;
        const int btn3 = 2;

        const int pinBtn1 = 11;
        const int pinBtn2 = 12;
        const int pinBtn3 = 15;

        const int pinRelay = 14;
        const int pinLCMode = 2;

        float F0 = 348000;
        const float Cth = 1000 * 1e-12; //theoretical 1000pF
        const float Lth = 221 * 1e-6; //theoretical 221uH

        boolean backLightOn = false;
        boolean dispFreq = false;

        float l0 = Lth;
        float c0 = Cth;
        MeterMode currentMode;

        LiquidCrystal lcd(pinRS, pinEn, pinD4, pinD5, pinD6, pinD7);
        unsigned long frq;

        const int BTN_PINS[] = {pinBtn1, pinBtn2, pinBtn3};
        boolean btnPressed[] = {false, false, false};

        void delayMilliseconds(int ms) {
        for (int i = 0; i < ms; i++) {

        boolean buttonPressed(int btnIdx) {
        if (digitalRead(BTN_PINS[btnIdx]) == LOW && !btnPressed[btnIdx]) {
        if (digitalRead(BTN_PINS[btnIdx]) == LOW) {
        btnPressed[btnIdx] = true;
        return true;

        return false;

        boolean buttonRleased(int btnIdx) {
        if (digitalRead(BTN_PINS[btnIdx]) == HIGH && btnPressed[btnIdx]) {
        if (digitalRead(BTN_PINS[btnIdx]) == HIGH) {
        btnPressed[btnIdx] = false;
        return true;

        return false;

        float calcV(float f, float VRef) {
        float v = 0;

        v = ((F0 * F0) / (f * f) – 1.0) * VRef;

        return v;

        void checkLCMode() {

        if (digitalRead(pinLCMode) == LOW) {
        currentMode = L;
        lcd.print("Mode: L");
        } else {
        currentMode = C;
        lcd.print("Mode: C");

        if (dispFreq) {
        lcd.setCursor(0, 0);
        lcd.print("Frequency: ");

        void setup() {
        for (int i = 0; i < 3; i++) {
        pinMode(BTN_PINS[i], INPUT);
        digitalWrite(BTN_PINS[i], HIGH);

        pinMode(pinLCMode, INPUT);
        digitalWrite(pinLCMode, HIGH);

        pinMode(pinBACKLIGHT, OUTPUT);
        digitalWrite(pinBACKLIGHT, LOW);

        pinMode(pinRelay, OUTPUT);
        digitalWrite(pinRelay, LOW);
        lcd.begin(16, 2);

        void displayFreq(long fin) {
        lcd.setCursor(0, 1);

        float f = 0;
        if (fin = 1000) {
        f = ((float) fin) / 1000.0;
        lcd.print(f, 3);
        lcd.print(” KHz”);

        void displayV(long fin) {
        float f = (float) fin;
        float v = 0;
        lcd.setCursor(0, 1);

        switch (currentMode) {
        case C:
        v = calcV(f, c0);

        if (v = 1e-9 && v < 1e-6) {
        v = v * 1e9; // n
        lcd.print(" ");
        } else {
        case L:
        v = calcV(f, l0);

        if (v = 1e-6 && v = 1e-3 && v = 1 && v < 100) {
        lcd.print(" ");
        } else {
        case F:


        void loop() {
        FreqCounter::f_comp = 106;
        while (FreqCounter::f_ready == 0)
        frq = FreqCounter::f_freq;


        if (buttonPressed(btn1)) {
        backLightOn = !backLightOn;
        if (backLightOn) {
        digitalWrite(pinBACKLIGHT, HIGH);
        } else {
        digitalWrite(pinBACKLIGHT, LOW);
        } else if (buttonPressed(btn2)) {
        switch (currentMode) {
        case C:
        c0 = calcV(frq, Cth) + Cth;
        F0 = frq;
        case L:
        l0 = calcV(frq, Lth) + Lth;
        F0 = frq;

        lcd.print(" Cal");
        } else if (buttonPressed(btn3)) {
        dispFreq = !dispFreq;

        if (dispFreq)
        digitalWrite(pinRelay, HIGH);
        digitalWrite(pinRelay, LOW);

        if (dispFreq)

        for (int i = 0; i < 3; i++) {
        if (buttonRleased(i)) {
        //the button is released, no action is necessary.

        i realy appreciate your reply
        many thanks
        best regards

  12. vigulas says:

    i don´t know why but on the beginig the code start with the include line where there sould be:
    #include interrupt.h
    #include binary.h
    #include HardwareSerial.h
    #include pins_arduino.h
    #include WConstants.h
    #include wiring.h
    #include wiring_private.h
    #include math.h
    #include WProgram.h
    #include EEPROM.h
    #include LiquidCrystal.h
    #include FreqCounter.h
    all the *.h are between


  13. vigulas says:

    hum….i´ve tryed to had that lines and didn´t work…
    had a look on google and found lots of problems and no solutions :D
    i just took out all the #define and then run compiling
    had each libraries evry time i got an error and there it is…
    GOT IT working, just changed the sequence….:S
    is this the realy problem? :S
    has i told you, know nothing about programing…:(
    ok, i´m going now to the hardware episode and will let you know about it ;)
    once again, many thanks
    best regards

  14. […] inductors and have an idea what their value is without doing a lot of math (f=1/(2*pi*(sqrt LC))). Kerry Wong has a nice page describing a reasonably accurate LC meter built around an ATMega328P and a LM339 […]

  15. […] LC meter then the one I had on a breadboard. As I said in the last post, the design is from Kerry D Wong. As an exercise, I made an attempt at getting the parts strictly from the local radio shack. […]

  16. FunSpark says:

    First off Happy Holidays and Thank You for posting such an awesome project!!
    I am pretty much a weekend warrior self taught amature when it comes to electronics, so this question may give you all something to smile about but anyway, there is no designation for the transistors you used other than npn which I understand and I know they are fairly interchangable in some regards however could ya help an old dog out and give up a part number or something please?? Its my holiday project and I have everything lined up except the comparators for the ocillator and the transistors… so I have to go shopping today and need to know so I dont smoke the whole thing!! :~)

    Thanks a bunch and thanks again for posting a great project!!

    Happy Holidays to All !! sorry for such a lame question…

  17. DaveSeether says:

    Hi Kerry , Is there any code available for the STM32F4 instead ?

  18. Anurag Bakshi says:


    I am planning on building this extremely useful project. I was designing a PCB to fit over the Arduino but I cannot seem to get it to work. Has any one already made a PCB for this?


  19. rep says:

    I built this circuit loaded the program but go very slowly, which may be the problem?

  20. swdev says:

    Is the schematic for this circuit correct? For example, the LM339 doesn’t appear to be connected to any power source (pins 3 and 12 on the LM339). Is this intentional?

    • kwong says:

      Typically the power connection is implied to simplify the schematics. But yes, power is needed for LM339 to work.

      • swdev says:

        Thanks. In the schematic VCC is both 5 volts and 3.3. Which are you actually running at? If you’re at 3.3 then are there any adjustments that need to be made to make it work at 5 volts? I’m running at 5 volts.

        I can’t get the Schmitt trigger section to work. If I take readings from pin 2 on the LM339 then I get a normal output (about 394 khz) but the output of the Schmitt section is not swinging enough to get a reading on the atmega input (ie. I get a frequency of 0 or very low like 20). I built two separate circuits (one surface mount and one through hole) and neither Schmitt section works. Any ideas?

  21. Gus says:

    I’m having a problem building this project. The first part of the circuit, the oscilator, is not giving me ~350Khz. I’m just getting 1 or 2 Hz. I’ve tried LM311, LM339 and LM393, all with the same results. I’m checking the frequency with a frequencimeter. I’m not concern yet to the Schmit Trigger part and Arduino part. I would like to verify first why the oscilator part is not running at ~350Khz.

    I’m doing the test using the Capacitor circuitry, but without actually measuring one, so the only parts I’m using are: 3 x 100K, 47K, 1K, LM IC, 2 x 10uF, 1 x 1000pF. With only those part I get 1 or 2 Hz with LM339 and LM393 and 5 or 6 Hz with LM311. All is powered by 5V from USB (I mean, no external power)

    What could be the issue? If anyone can measure the output freq. on pin 2 on LM339, without any measure cap, and selecting cap switch, could you post the resulting freq?


  22. Gus says:

    There’s a bug on the first image (the oscillator image): The “L” and “C” are inverted. When measuring caps, contact must be as the way you see on the image, and when “L”, the switch should be switched; so swaping “L” by “C” is what have to be done.

  23. Tuxology says:

    Hi Kerry Wong, I made your project, but I find myself in trouble with the code; importing the code in the Arduino IDE, the code compiles correctly, but the LCD display don’t work.
    May be due to different pin mapping between Arduino IDE and NetBeans (with your plugin installed?)?
    Could you kindly send me the program already compiled on your machine with Netbeans? (tuxologyATyahooDOTit)

    What changes must be made ​​to the code to make it work with Arduino “Ide”?

    Thanks a lot for the great project.

    • kwong says:

      I can definitely send you the compiled code (the only thing is that if the component values you used are different than mine then you would see significant measurement error). But it sounds like your circuit was not displaying anything? Using the NetBeans environment shouldn’t have any impact on the generated binaries as long as there were no compiling error.

      Could you tell me what specific symptoms you were getting? (e.g. no display at all, or not getting correct values?)

  24. Tuxology says:

    Hi Kerry Wong, with the code compiled with arduino “IDE” I see no display at all; the button for switch the relays in l\c mode works correctly, but without the display I cannot go ahead with the testing of the circuit.
    With Netbeans IDE… I am unable to set up netbeans :-(
    Thank a lot for the patience :-)

  25. Alchemysrt says:

    hi Keey wong, i cant see anything on LCD, i have the same problem that Tuxology user above

    • kwong says:

      Hi, could you double check your LCD pin connection and verify your code? Since the display code uses the standard Arduino Library, you should be able to verify that the LCD is working properly. Please let me know if you are able to isolate your problem.

      • Alchemysrt says:

        ah ok ok all right, pins 3, 5 , 7 , 8 , 9 , 10 of LCD must be GROUNDED :) , but i have a BIG PROBLEM, i can change LC / Frecuency mode… but i cant switch C from L mode and doesn´t work any measurement… i believe that is problem of DPDT switch on LCMETER CORE diagram… i have two questions… the relay on the MCU diagram is linked to LC / Frecuency SPDT SWITCH on LC METER CORE DIAGRAM? and two… the DPDT SWITCH selector of L or C in the core diagram is a basic DPDT SWITCH or a RELAY DPDT SWITCH?, i´ve just used a simple DPDT SWITCH for switching L or C… is that correct? thank you

        • Alchemysrt says:

          sorry i was mistake… PIN 3 of LCD IS CONTRAST VOLTAGE and shouldn´t be grounded… only 5,7,8,9 pins must be grounded… i wait for my big problem with L / C Switch and measurement problem

          thank you

      • Alchemysrt says:

        sorry i was mistake… PIN 3 of LCD IS CONTRAST VOLTAGE and shouldn´t be grounded… only 5,7,8,9 pins must be grounded… i wait for my big problem with L / C Switch and measurement problem

        thank you

  26. Alchemyst says:

    i have a BIG PROBLEM, i can change LC / Frecuency mode… but i cant switch C from L mode and doesn´t work any measurement… i believe that is problem of DPDT switch on LCMETER CORE diagram… i have two questions… the relay on the MCU diagram is linked to LC / Frecuency SPDT SWITCH on LC METER CORE DIAGRAM? and two… the DPDT SWITCH selector of L or C in the core diagram is a basic DPDT SWITCH or a RELAY DPDT SWITCH?, i´ve just used a simple DPDT SWITCH for switching L or C… is that correct? thank you

    • kwong says:

      Yes, the relay is the STDP switching between LC/Freq. The DPDT switch is just a basic switch. Since you can switch between LC and Frequency modes, you can first try using the frequency mode to measure a known frequency (e.g. from a simple oscillator) and if that works then your problem is most likely the op-amp circuit. If you have an oscilloscope, you may want to see if you can obtain a clean square wave from the output in L mode, which both input leads shorted.

  27. Alchemyst says:

    Hi Kerry, all works allright except “L mode” i cant Switch C mode to L mode… only i can Display C and Frecuency but when i use the DPDT Switch i cant get “L mode”, Please i need help :( , all circuit is revised and is allright but the problem persist and i cant solve this :(((((((

    • kwong says:

      It’s been a while….

      Anyway, if you look at the code, the LC mode is controlled by pin 2. So if it is not switching, you may have wired the LC mode switch to a different pin? Also, the pin needs to be set as input.

  28. […] to do this. For more design information, code and circuitry visit Kerry’s detailed page here. When building your own rendition of this meter, consider using ourLCD Keypad shield, which offers […]

  29. Gus says:

    Hi. I’ve finally did this project using the LM393 IC. I’ve to add a 1k resistor from 5v to the second output of the LM393 (pin 7) to make the signal more reliable.
    Links that help me figure this out:

    Here’s a photo:


  30. francisco says:

    Can this be built using the Arduino Uno?

  31. Francisco says:

    Hi Kerry
    If I built this circuit and copy the code exactly as you have written it (other than perhaps some of the pin designations) will this work with Arduino Uno?
    Thx again

  32. Francisco says:

    Sorry Kerry
    I already asked the question and you quickly answered it.


  33. texane says:


    I largely used your project to make a lcmeter (with some modifications:
    A few pictures here:



  34. Greg says:

    Hi Kerry,

    Thanks for the great project. Would it be possible for you to email me a HEX file? I only have an Atmel AVRISP mkll programmer.

    Best Regards,

  35. Nathan says:

    I might build an LC Meter. I was wondering though, would it be possible to use the built in comparator un the 328 ?

  36. dheeraj says:

    i am engineering student
    can i use atmega8 instead of atmega328

    how compile the above code downloaded from website
    how to make hex file to burn target mcu by using usbbasp programmer

    please help me

  37. jorgre says:

    Can someone explain what the left side of the 339 does, and the purpose of the various resistors and capacitors connected to it. I don’t understand the purpose of the 100k feedback resistor and the 10uF capacitors. As far as I can see, the left side of the 339 acts as some form of non-inverting derivator, but I can’t understand why it’s really there.

  38. Ka-Tua says:

    Hi Kwong
    how display the serial data in PC monitor (not using LCD component).

    thank for answered.

  39. Nenet says:

    Does anyone have done PCB. I would be grateful if you could send it to me. Thank you

  40. Elac says:

    Hello, I’m trying to make this and was wondering.
    Is there a full schematic and parts list for this project?

  41. Gab says:

    What type of switch is at the input side of the comparator.
    I want its technical name. A name I could mention in the
    market to get one.

  42. Juliana says:

    Dear, please could you send me the source code and schematic? i’m building this but it’s not working. Thanks

  43. prosim says:

    An interesting project. I wanted to ask whether the calibration is saved to the EEPROM?

  44. Martin says:

    Dear Mr. Wong!
    How do you switch between L and C mode? I cannot find it in the code. Does Btn3 all the work or is it done autmatically? If not how to modify the code to switch between 3 modes with one button?
    Thank you for this nice project. I did some mods and will send pics, when finished,

    • kwong says:

      Hi Martin,

      L/C mode is determined by the switch (DPDT) connected at Arduino’s digital pin 2. When in L mode, the 1000 pf capacitor is used to form an LC circuit with the external capacitor and when in C mode, the 221uH inductor is used to form an LC circuit with the external capacitor under test. Pin2 is used to sense which mode it is currently in and display accordingly.

      • Martin says:

        Dear Mr. Wong, Thank You for answering!
        My question was how the DPDT is driven (manually?). There is only one pinRelay defined associated with Btn3 to switch the SPDT to get to frequency mode. There is only one Relay in the MCU schematic. So how is it done? There is something missing for my understanding. Thank you for help.

  45. eni says:

    hi to all
    can I change the code of this project for an ATMEGA8A ?
    if your answer is yes,HOW?
    please guide me

  46. EV says:

    Hi, thanks for the circuit, i tried to build one, but the value of resistor in below picture make me canfused. plz help me:

  47. Jdub says:

    This is an awesome project! and I am attempting to build this… My question is do you think it will work with the Arduino Micro?
    Also I was thinking about putting this into one of the proto sheilds instead of custom pcb … I’m having trouble finding the 220uh inductor (locally) that you use
    and will be following this project
    as he based his design off of yours and gives you credit!
    anyways Awesome work!

    • kwong says:

      Yes, the source code is based on Arduino.

      • Jdub says:

        Alright I built this however I cant seem to get any result in either mode (haven’t tried freq yet).. In my build I had to substitute the 221uh inductor and the 1000pf capacitor ..
        using this site: http://www.1728.org/resfreq.htm
        I calculated yours to be running at 338khz
        I had a 47uh inductor and using that calculator it told me to use a 4.7nf capacitor to match the same frequency which “is” correct running 338khz.
        I edited these lines of your code:
        float F0 = 348000; // made no changes here
        const float Cth = 4700 * 1e-12;// 4.7nf ==//1000 * 1e-12; //theoretical 1000pF
        const float Lth = 47 * 1e-6;// 47uh ==//221 * 1e-6; //theoretical 221uH
        So in your opinion Where should i be looking to get a reading.. I figured even if some numbers are off I should still get a bogus reading right?
        Everything else works, switches, buttons, relay so im a little confused..

        i’m using a polyfilm cap 472j if that helps.. should be 5% accurate

Leave a Reply to kwong