A Surprisingly Accurate Digital LC Meter



An inductance / capacitance meter by Phil Rice VK3BHR

Almost as published in Amateur Radio magazine, April 2004.

Measuring range is from 0 to >0.1uF for capacitance and 0 to >10mH for inductance.
Expected accuracy is +/- 1% of reading +/- 0.1pF or +/- 10nH
Frank Winter VK4BLF has made a nice printed circuit board for this meter. (It's much nicer than my unit which was constructed on "dot matrix" board.) See http://members.optusnet.com.au/frankwinter/ for details. Frank also has a nice Amp-Hour meter described on his site.

Mark Webster has suitable displays for sale (and at a nice price too!). See http://home.exetel.com.au/marknac/displays.htm

There's also links to a heap of useful information on Mark's page.


Here's some answers to Occasionally Asked Questions!

For those people who want to use a different Ccal capacitor, here's a javascript Floating-Point converter I hacked up (with a lot of help from friends). It converts real numbers into Microchip's 24 bit format. (This may also be useful to anyone who wants to adjust their LC meter to read the wrong value. ;-). Please feel free to grab a copy.


This project (or derivations of it, or vaguely similar LC meters) are available on the web in several different languages. My thanks to the following people for their translations.

Author Language Web Site
Marek SP7DQR Polish http://sp7dqr.waw.pl/lcmeter_pl.html
Aleksandr Buyevskiy Russian http://www.cqham.ru/lc_meter.phtml
Patrick TK5EP French http://tk5ep.free.fr/tech/lcmeter/fr/lcmetre_f.php
Volker SM5ZBS German http://www.janson-soft.de/lcmeter/lcmeter.htm


Why?

Several years ago, I built a "one transistor oscillator", which I used to measure small inductance values (by measuring the frequency of oscillation and applying the formula for resonant frequency of an LC circuit). Following from the frequency meter project published in the September 2002 issue of AR, I wondered if I could combine the oscillator and frequency meter to make a direct reading inductance/capacitance meter. I had seen an instrument that did exactly this on the web at http://www.aade.com/lcmeter.htm for $120US and thought "I'd like one of them".

How?

The AADE web site gave details of how their design worked and a circuit diagram. This led me to propose a design using their oscillator, but in a slightly different way. Like theirs, mine would measure the free running frequency of an LC oscillator, then successively apply a known capacitance then the unknown inductor (or capacitor). After that, the maths used to calculate inductance or capacitance would be quite different. A brief play with the required formulas showed that it was COMPLICATED! some complicated formulae
At this time the maths all seemed too hard.

A lucky find!

Then I discovered Microchip Application Note - "AN575 IEEE754 Compliant Floating Point routines" (add subtract, divide and multiply). It didn't take long to load the code into a PIC 16F84, but the 32 bit floating point routines nearly filled the entire chip. This left no room for the frequency measuring, inductance/capacitance calculations and display formatting instructions.


At this stage, I found that I could use the Microchip 24 bit Floating Point code and, by being a little careful, could fit it all in and achieve a numerical error of less than 0.1%. Overall accuracy would then be limited by the oscillator behaviour and one "calibration capacitor".

The Hardware!

This is a combination of two stolen designs.


The oscillator design originally came from the AADE LC meter web page. It uses an LM311 comparator with positive feedback to make a parallel LC oscillator with digital output. It seems to oscillate readily over a wide range of L and C values. Hopefully, it follows the "well known formula for resonant frequency".
The frequency measuring part is a cut down version of the September 2002 Frequency Meter article from AR. The original idea for this came from the web pages of Eamon Skelton, EI9GQ.


Most of the components were mounted on a prototyping board (the sort that has copper donut lands spaced on a 0.1 inch grid.

Heres a link to a fuzzy photograph and an overly large sketch of my layout. Naturally, your layout will depend on available components.

The Software

This was the hard part (and the fun part) of the project. Luckily, it's easy to duplicate and the copies work as well as the original.

The program takes two measurements when "zeroed". First the oscillation frequency is measured using only the internal inductor and capacitor (F1). Then a standard capacitor (Ccal=1000pF +/- 1%) is added in parallel and the frequency is measured again (F2).

The program then goes into a repeating loop where it measures the frequency of the oscillator using the internal inductor and capacitor and whatever unknown external inductor or capacitor is connected (F3). Some serious maths (formulae 4 and 8) is performed each time to calculate the unknown external component value. This value is then scaled in engineering units and formatted for display.

After getting quite a few requests for the source code, I have decided to make it public. I am never going to get rich selling it. If you get rich, I don't want to know! (If you have fun with it, I do want to know ;-)
You have a choice of seven versions. (I would avoid the first, even though it works OK ;-)


Assembler source code Hex PIC code
lc004.txt an "early" version, only for the 16F84 lc004.hex
lc628.asm ported to the 16F628 by Egbert, PA0EJH
lc006.txt A version for both the 16F84 and the 16F628, incorporating modifications by Egbert, PA0EJH lc006.hex for the 16F84
lc006b.hex for the 16F628
lcmeter.zip Andreas Winter has improved the program by:.
  • Moving the text-strings to the EEPROM to save some valuable space in program memory
  • Checking for numerical overflow. The display showed 838nF/83.88mH if the cap or the coil was too large - (8388608 = 2^23) - The program now checks the FPFLAGS for overflows and the program now shows "max" instead of 838nF/83.88mH.
  • Calibrating in L-Mode continues until there is actually a coil connected - that way it is no longer possible to calibrate in L-Mode without anything connected
  • It now shows L:calibrating or C:calibrating to indicate the mode it is in
  • When you switch the mode or change the test-jumper the program now restarts forcing a recalibration.
lcmeter.zip
lc006d.txt A "two range" version by Cristi Morariu
Click here for a short article describing Christi's version, complete with pictures and diagrams.
LC006d32.txt A "32 bit" version by Cristi Morariu
Click here for a copy of Cristi's email describing this version.
lc007.txt (25th. October 2005) A version for both the 16F84 and the 16F628. This incorporates error checking of ALL floating-point calculations. (Every single + - * & /) lc007a.hex for the 16F84
lc007b.hex for the 16F628
LC Meter Version 2. (15th. November 2007) Revised hardware, using a 16F628 to replace the 16F84 and the LM311. Performance is no better or worse, but the circuit is marginally simpler AND there is a PC board layout for it and it has software calibration too!
You will also need two other files:
  • p16f84.inc which comes with the Microchip Asembler.
  • FP.TXT which has, in the past, been found on the Microchip Web site. See http://www.microchip.com - search for AN575. The file you really want is called FP24.A16. Take out the subroutines FLO1624 and INT2416, which aren't used.

The Fine Print (Software Warranty)

This code comes with no warranty and no support. It worked for me and a lot of other VKs. If it works for you, that's GREAT. If you get rich selling it, I don't want to know!

Getting Started

To aid initial troubleshooting, the PIC program includes a test mode which is entered by shorting link LK1 and pressing "zero". The PIC will now repeatedly count oscillator cycles for 0.1 second and display the result. With just the 82uH inductor and 1000pF in circuit (no external component, no calibration capacitor), the oscillator will run at about 550KHz and the display will show around 55000 If the frequency is too high (anything over 655.350KHz), the display will show "Over Range". If the oscillator isn't running, the display will show "0".
For best accuracy, the free running frequency should be 10% to 15% below 655KHz. If it is too close, it may accidentally overflow the PIC's internal 16 bit count. You may need to adjust the inductance to get get the frequency right..
A second link, LK2, connects the calibration capacitor. The oscillator should then run at about 394KHz.
A third link, from pin 10 of the PIC 16F84 to ground (LK3), caters for "badly behaved" displays. If your display only ever shows 8 characters (ie. no pF, nF or uH as appropriate) then try grounding pin 10 of the PIC.

Operation

In practice, it's a bit like an ohm meter. For an inductor, just short the leads and press the zero button, then connect the unknown inductor. For a capacitor, zero it with the leads open, then connect the unknown capacitor. The meter can be zeroed with an unknown component connected. For subsequent components, it then indicates the difference (+ or -) from the original component value. Great for matching parts!

How Accurate?

Accuracy depends on the user doing the "right thing" and on the unknown component being of fairly high Q. The PIC's internal program relies on the setting of the L/C switch being appropriate for the component. Since all the PIC is doing is measuring the frequency of the oscillator, any strange component that allows the oscillator to work will be reported as an inductor or a capacitor depending on the L/C switch. For example a 22 Ohm resistor is reported as a 3.14uH inductor or a 119nF (0.119uF) capacitor. This isn't even remotely correct! When the unknown component has high Q (as you usually want in a tuned circuit) AND the L/C switch is set correctly, the prototype generally shows errors of less than 1%.
I checked the accuracy of the LC Meter against an old Marconi bridge, for capacitors of 33pF to 0.22uF. For inductors, I only checked values from 475uH down to 60uH. Below that value, the Marconi bridge was a bit "cranky".
While the LC Meter is self calibrating, errors depend a little on the components used in the oscillator LC tank (L and C on the circuit diagram) and on the "standard" capacitor (Ccal), which should be 1000pF to within 1% or better.
The worst errors occurred when using a ferrite bobbin style choke from a switchmode power supply for "L". Here the error was less than 1% for capacitors below 3300pF and 2% for inductors less than 475uH. The error climbed to 3% for 0.22uF capacitors.
Surprisingly, the best accuracy used a "moulded" choke scrounged from an old TV. Here, the error was less than 1% for capacitors less than 0.22uF and less than 1% for inductors less than 475uH.
In all cases, I used a 1000pF styroseal capacitor for the oscillator tank "C". A "greencap" would be a suitable substitute but a ceramic capacitor may not be a good choice. Some of these can have high losses.
I have no reason to suspect any strange non-linearities in the readings for low value components. Small component values are, in theory, directly proportional to frequency difference (when the part is added to the oscillator). The software inherently follows this proportionality. The only way I can verify this is to construct some small L/C tuned circuits and measure their resonant frequency - and I haven't got round to doing that yet.

Conclusion

With the aid of a little easily copied FREE software, you can have your own (possibly) accurate inductance and capacitance meter. With the worst possible set of components from the junk box, accuracy should be better than 3%. If you are lucky, accuracy should generally be better than 1%. It's now possible to design a tuned circuit, construct it and have it resonate on the right frequency first time, every time.

Still got a question or two about the project?

Here's the OAQ - answers to Occasionally Asked Questions! Please check this out before emailing me. It might just answer your question. I will put more answers here as they materialise (in answer to emailed questions ;-).

References

  1. The original idea and the oscillator came from http://www.aade.com/lcmeter.htm
  2. The frequency measuring code came from http://ironbark.bendigo.latrobe.edu.au/~rice also http://homepage.tinet.ie/~ei9gq/stab.html
  3. Microchip's Web Site provided the Floating Point code essential to the working of the meter. See http://www.microchip.com - search for AN575

No comments:

Post a Comment

Labels

PROJECTS 8086 PIN CONFIGURATION 80X86 PROCESSORS TRANSDUCERS 8086 – ARCHITECTURE Hall-Effect Transducers INTEL 8085 OPTICAL MATERIALS BIPOLAR TRANSISTORS INTEL 8255 Optoelectronic Devices Thermistors thevenin's theorem MAXIMUM MODE CONFIGURATION OF 8086 SYSTEM ASSEMBLY LANGUAGE PROGRAMME OF 80X86 PROCESSORS POWER PLANT ENGINEERING PRIME MOVERS 8279 with 8085 MINIMUM MODE CONFIGURATION OF 8086 SYSTEM MISCELLANEOUS DEVICES MODERN ENGINEERING MATERIALS 8085 Processor- Q and A-1 BASIC CONCEPTS OF FLUID MECHANICS OSCILLATORS 8085 Processor- Q and A-2 Features of 8086 PUMPS AND TURBINES 8031/8051 MICROCONTROLLER Chemfet Transducers DIODES FIRST LAW OF THERMODYNAMICS METHOD OF STATEMENTS 8279 with 8086 HIGH VOLTAGE ENGINEERING OVERVOLATGES AND INSULATION COORDINATION Thermocouples 8251A to 8086 ARCHITECTURE OF 8031/8051 Angle-Beam Transducers DATA TRANSFER INSTRUCTIONS IN 8051/8031 INSTRUCTION SET FOR 8051/8031 INTEL 8279 KEYBOARD AND DISPLAY INTERFACES USING 8279 LOGICAL INSTRUCTIONS FOR 8051/8031 Photonic Transducers TECHNOLOGICAL TIPS THREE POINT STARTER 8257 with 8085 ARITHMETIC INSTRUCTIONS IN 8051/8031 LIGHTNING PHENOMENA Photoelectric Detectors Physical Strain Gage Transducers 8259 PROCESSOR APPLICATIONS OF HALL EFFECT BRANCHING INSTRUCTIONS FOR 8051/8031 CPU OF 8031/8051 Capacitive Transducers DECODER Electromagnetic Transducer Hall voltage INTEL 8051 MICROCONTROLLER INTEL 8251A Insulation Resistance Test PINS AND SIGNALS OF 8031/8051 Physical Transducers Resistive Transducer STARTERS Thermocouple Vacuum Gages USART-INTEL 8251A APPLICATIONs OF 8085 MICROPROCESSOR CAPACITANCE Data Transfer Instructions In 8086 Processors EARTH FAULT RELAY ELECTRIC MOTORS ELECTRICAL AND ELECTRONIC INSTRUMENTS ELECTRICAL BREAKDOWN IN GASES FIELD EFFECT TRANSISTOR (FET) INTEL 8257 IONIZATION AND DECAY PROCESSES Inductive Transducers Microprocessor and Microcontroller OVER CURRENT RELAY OVER CURRENT RELAY TESTING METHODS PhotoConductive Detectors PhotoVoltaic Detectors Registers Of 8051/8031 Microcontroller Testing Methods ADC INTERFACE AMPLIFIERS APPLICATIONS OF 8259 EARTH ELECTRODE RESISTANCE MEASUREMENT TESTING METHODS EARTH FAULT RELAY TESTING METHODS Electricity Ferrodynamic Wattmeter Fiber-Optic Transducers IC TESTER IC TESTER part-2 INTERRUPTS Intravascular imaging transducer LIGHTNING ARRESTERS MEASUREMENT SYSTEM Mechanical imaging transducers Mesh Current-2 Millman's Theorem NEGATIVE FEEDBACK Norton's Polarity Test Potentiometric transducers Ratio Test SERIAL DATA COMMUNICATION SFR OF 8051/8031 SOLIDS AND LIQUIDS Speed Control System 8085 Stepper Motor Control System Winding Resistance Test 20 MVA 6-digits 6-digits 7-segment LEDs 7-segment A-to-D A/D ADC ADVANTAGES OF CORONA ALTERNATOR BY POTIER & ASA METHOD ANALOG TO DIGITAL CONVERTER AUXILIARY TRANSFORMER AUXILIARY TRANSFORMER TESTING AUXILIARY TRANSFORMER TESTING METHODS Analog Devices A–D BERNOULLI’S PRINCIPLE BUS BAR BUS BAR TESTING Basic measuring circuits Bernoulli's Equation Bit Manipulation Instruction Buchholz relay test CORONA POWER LOSS CURRENT TRANSFORMER CURRENT TRANSFORMER TESTING Contact resistance test Current to voltage converter DAC INTERFACE DESCRIBE MULTIPLY-EXCITED Digital Storage Oscilloscope Display Driver Circuit E PROMER ELPLUS NT-111 EPROM AND STATIC RAM EXCITED MAGNETIC FIELD Electrical Machines II- Exp NO.1 Energy Meters FACTORS AFFECTING CORONA FLIP FLOPS Fluid Dynamics and Bernoulli's Equation Fluorescence Chemical Transducers Foil Strain Gages HALL EFFECT HIGH VOLTAGE ENGG HV test HYSTERESIS MOTOR Hall co-efficient Hall voltage and Hall Co-efficient High Voltage Insulator Coating Hot-wire anemometer How to Read a Capacitor? IC TESTER part-1 INSTRUMENT TRANSFORMERS Importance of Hall Effect Insulation resistance check Insulator Coating Knee point Test LEDs LEDs Display Driver LEDs Display Driver Circuit LM35 LOGIC CONTROLLER LPT LPT PORT LPT PORT EXPANDER LPT PORT LPT PORT EXTENDER Life Gone? MAGNETIC FIELD MAGNETIC FIELD SYSTEMS METHOD OF STATEMENT FOR TRANSFORMER STABILITY TEST METHODS OF REDUCING CORONA EFFECT MULTIPLY-EXCITED MULTIPLY-EXCITED MAGNETIC FIELD SYSTEMS Mesh Current Mesh Current-1 Moving Iron Instruments Multiplexing Network Theorems Node Voltage Method On-No Load And On Load Condition PLC PORT EXTENDER POTIER & ASA METHOD POWER TRANSFORMER POWER TRANSFORMER TESTING POWER TRANSFORMER TESTING METHODS PROGRAMMABLE LOGIC PROGRAMMABLE LOGIC CONTROLLER Parallel Port EXPANDER Paschen's law Piezoelectric Wave-Propagation Transducers Potential Transformer RADIO INTERFERENCE RECTIFIERS REGULATION OF ALTERNATOR REGULATION OF THREE PHASE ALTERNATOR Read a Capacitor SINGLY-EXCITED SOLIDS AND LIQUIDS Classical gas laws Secondary effects Semiconductor strain gages Speaker Driver Strain Gages Streamer theory Superposition Superposition theorem Swinburne’s Test TMOD TRANSFORMER TESTING METHODS Tape Recorder Three-Phase Wattmeter Transformer Tap Changer Transformer Testing Vector group test Virus Activity Voltage Insulator Coating Voltage To Frequency Converter Voltage to current converter What is analog-to-digital conversion Windows work for Nokia capacitor labels excitation current test magnetic balance voltage to frequency converter wiki electronic frequency converter testing voltage with a multimeter 50 hz voltages voltmeter

Search More Posts

Followers