Dick
Cappels' project pages
http://www.projects.cappels.org
Return to
HOME
(more projects)
Experimental 1 Khz Inductance
Meter
Using a 1 milliamp, 1 kHz test signal,
measures 100 uH to 30 mH, resistance and Q.
If you see this posted anywhere other than projects.cappels.org,
please email me at projects(at)cappels.org
Its only a breadboard. The
display shows total impedance (Z),
the angle of the voltage across the inductor under test with
respect to the applied current (A), the Resistance of the
inductor (R), and the inductance (L). The empty
8 pin socket
in the upper-left is from a previous experiment. The red wire
trailing to the right goes to the shield, which was
removed for the photograph. The part of the
image with the display was enhanced after the picture was taken.
Downloads
Download the complete WINAVR project with Peter Fluery's LCD Library:
1kHz_Inductance_meter_c_files.zip
Download just AVRStudio hex file:
1klm080813B.hex
Downlad the schematic
1klm18aug08.gif
Find updates at
www.projects.cappels.org
HOME
(More Projects)
Introduction
I get a lot of use from my Even Better LC Meter (
http://www.cappels.org/dproj/EvenBetterLCMeter/Even_Better_LC_Meter.html)
but as satisfying as the meter is to use -its quick and pretty
accurate, but when measuring inductors with low Q, there are
significant errors, and there was the ever-present nagging issue of the
test frequency being a function of the value - it does not test the
inductor at a standard frequency, so with some inductors, in particular
those with iron of ferrite cores, the results might not correlate well
with some of the better made inductance meters.
1 kHz is a commonly used test frequency, and I resolved to see if I
could make an inductance meter that uses a 1 kHz test signal at a low
level. I also wanted to use a low level test signal so that the test
current would have a minimal effect on the measurement. Magnetic cores,
and soft ferrites in particular, change in permeability as a function
of the current through the winding. I chose 1.0 milliamps peak-to-peak
as a test current. Given that I wanted to be able to measure inductance
down to 100 uH, my attention turned to the problem of how to accurately
measure the amplitude and the phase of as little as 63 millivolts
across a 100 uH inductor.
Searching the web, I saw that people were having pretty good
success using synchronous demodulators, and this appealed to me since
my exploration of synchronous demodulators a few years ago (
Experimental 1
kHz Synchronous Demodulator and
Digital Lock-in
Milliohmmeter) lead me to appreciate how well these
demodulators can separate a signal from the noise.
Looking around on the web a little more, found the user's manual
for an
M3
Electgronix Digital LCRZ Meter kit, which, aside from spelling out
the meter's impressive capabilities, also explained a few short
paragraphs explained how the meter worked. That was enough to convince
me to give this technique a try. By the way, if case you are starting
to get the idea that this project is a quick and dirty knock-off of the
M
3
design, its not. The M
3 kit has much more range, measures
lot more than just inductance, and seems to be quite a bit more
accurate.
My project is just an exploration of circuit and firmware techniques,
mostly to see what it would take to get such an instrument operating. I
think that if you have the time to build the kit, the M
3 kit
is an excellent way to get a full function LCRZ measurement capability
that rivals that of some of the most expensive factory built
instruments, but at fraction of the cost. You might want to have a look
at the
M3
Electgronix webiste, and in particular at the web page for their
meter kit. You can even download the manual for their kit on the page
at this link:
http://www.m3electronix.com/lcr.html.
The result of this investigation is some circuit concepts, some
firmware techniques, and some learning. Notably, the internal reference
impedances are switched on and off without the use of electromechanical
relays or switches, and a comparatively low parts count version can be
made with some sacrifice in measurement linearity. The ATTINY861
that I chose to
use in this investigation seemed to have way more program space that I
thought I would need - 8 k Bytes, in all, but as the design progressed,
the space filled up rapidly. Soon, I was at the point of scrimping to
save memory. I think an experienced embedded C programmer would be able
to find plenty of places in my code where space can be saved, but this
was all I could cram into that chip.
My meter has two ranges: From about 0.6 to 33 Ohms and a higher,
overlapping range from about 30 Ohms to about 330 Ohms. Having only two
ranges, made it easy to switch ranges automatically.
In designing the meter, I assumed the most useful model to me: a pure
inductor in series with a pure resistance. I ignore capacitance all
together. The meter calculates and displays the impedance of the
inductor under test, the angle of the voltage across the inductor with
respect to the driving current, and displays the actual inductance and
resistance. The resistance display can be switched between resistance
and Q, where Q is defined as the impedance divided by the resistance.
Taking a hint from the M
3
Electgronix manual, the instrument is first calibrated with the use
of a precision resistor, which is measured and compared against an
internal reference, thus calibrating the internal reference. The
internal reference is then used for future calibration. Calibration
parameters, for both the original calibration and subsequent
calibrations using the internal reference, are stored in the EEPROM on
the ATTIN618 micro controller.
As a result of running out of program memory, I was not able to get the
data display to work to my liking. Below 100 uH, the decimal point
disappears, and can be a problem. A 90 uH inductor, for example, looks
like 9 mH on the display.
This is a good time to mention patents. Don't assume that anything you
read on this web site is not covered by somebody's patent(s) somewhere
in the world. I have seen methods similar to this one mentioned in
issues U.S. utility patents, and given the breadth of technologies and
techniques covered in this project, I think the only safe assumption is
that commercial use of this circuit would infringe on some
patent. As mentioned previously, the intent of this project is to
learn, not to devise a design for a product.
The
Method
Block
diagram of the measurement system.
The
method is very simple: Drive the
inductor with a 1 kHz current source and then measure the amplitude and
the angle with respect to the drive current, of the voltage across the
inductor under test. The results are displayed on a liquid
crystal display. An internal reference is used for automatic
calibration, and push buttons allow the user to initiate calibration
modes and switch the display between Q and Resistance.
The voltage across the inductor under
test is measured over two areas, 90 degrees apart. One of the two areas
is arbitrarily regarded as being the real part, that in phase with the
1 milliamp sine wave being used to drive the inductor, and the other
being arbitrarily regarded as the imaginary part, that which is 90
degrees out of phase from the 1 milliamp sine wave. Within the
measurement, a total of four measurements are taken. Two for the real
part, and two for the imaginary part. The real and imaginary parts
measured, then measurements shifted by half a cycle are taken, and
after correcting the sign, the two are averaged to remove some offsets.
This approach is similar to that mentioned in the M3
Electgronix manual. Offsets are removed from each measurement and
five measurements cycles are averaged. The resulting magnitudes are
used to calculate the raw vector.
The Circuit
The complete schematic is rather
large, so
please click on the image above to
go to the page with the schematic.
Micro
controller,
User Interface, and
Display
The major blocks in this section of the
circuit are the 2 line x 16 charter Liquid Crystal Display, the push
buttons, a latch to create two additional output signals, the pulse
width
modulation output and first low pass filter stage, and the
micro controller itself.
The 2 line x 16 character Liquid Crystal Display uses the Hitachi
HD44780 controller. Displays that use the KS0073 are also supported by
the drivers.
The excellent drivers provided
by Peter Fleury
http://homepage.hispeed.ch/peterfleury/
Mr. Fleury's cod is used here and included in the zipped file with his
kind
permission. Mr. Fleury's code supports both of the popular controllers
for this display. The 10k pot, labeled "R7" is used to adjust the
display to account for the viewing angle.
The ATTINY816 was not as good a choice for this project as I imagined
when I started. besides running out of program memory space, I also ran
short on I/O. To solve this problem, I multiplexed three pushbuttons
("Reset", "CAL", and the mis-labeled "D/Q") on some of the LED control
and data lines. A latch, the 74HC573 is used to latch data from two of
the display's connections, in order to get two additional output lines.
The microcontroller is an Atmel ATTINY861. It runs at 16 Mhz. I had
started out thinking I would run it at 20 MHz, but 16 MHz worked out
much better in terms of getting a 1 kHz sine wave.
The sine wave is made up of 64 samples per cycle, normalized to a top
value of 249 in order to obtain a frequency of 1.000 kHz. The PWM
output is on pin 2 of the controller. The 10K pot in series with pin 2
is used to adjust the amplitude of the sine wave. The 10k pot, along
with the 10k fixed resistor in series with it, in conjunction with the
.047 uf capacitor is the first pole of the series of low pass filters
that the PWM sine wave passes through on its way to the inductor under
test.
Reference Voltage Buffer
In
order to get the analog circuits to work, there needs to be some sort
of common reference for the signals. In some cases, this would be
ground, but since I prefer to have one end of the power supply
grounded, mainly for safety reasons, but also minimize noise, a
floating reference was created. The two 100k resistors divide the
5 volt power supply in half to generate a 2.5 volt reference. This
reference is buffered by U1C and its heavily bypassed with the 330 uf
capacitor to suppress make it quiet with respect to ground. The shield,
is connected to the 2.5 volt reference and it is insulated from ground.
The
Low Pass Filter
The PWM signal from the ATINY861 is
just full of harmonics, The first filter right after the PWM output of
the chip removes most of them, but when driving an inductor with a
current, which is the approach I took with this circuit, the harmonics
are a real problem because the reactance of the inductance increases
with frequency, so the harmonics become fairly pronounced and post some
risk of causing the buffer following the inductor under test clipping
because of excessive amplitude. I ended up adding six poles of
filtering with a corner frequency of about 800 Hz. This seems to be
sufficient. In a simpler, though somewhat lower accuracy version of
this
instrument, the current source can be replaced with a resistor and the
filtering could be greatly reduced.
The
Current Source and Buffer
The 1 kHz sine wave from the 7 poles of
filtering is used to drive a current source, U2D, and the current
source in turn, drives the inductor under test. I used 1% resistors so
I could get a suitably high impedance with which to drive the inductor
under test without needing to trim the circuit with a pot. The value,
84.5 k just happens to be a value that I had available that was fairly
high resistance, but not high enough to invite an high-resistance
related problems, like excessive offsets due to opamp leakage currents,
or noise pickup.
The 1 K resistor between the current source and the inductor under
test, the 1k resistor just to the left of the inductor under
test, doesn't really do anything. I had put it in the circuit
when trying a 1 k resistor instead of a current source. I think it can
be safely replaced with a short.
A buffer, U1A, buffers the voltage across the inductor under test so it
can be used to drive the integrator in the next stage. I think the
maximum calibration error that would result if this buffer were omitted
would be less than 1% because the load is 30k and the impedance the
meter measures ranges from near zero to 300 Ohms.
I used a Texas Instruments TLV2774 quad op-amp because it gave the best
results of the available op-amps, but I obtained results nearly as good
when using an LM324 for U2. when using an LM324, I found that
adding a 1K resistor from the output of U2D to ground reduced the
harmonic distortion. I first tried this resistor with the expectation
that some of the harmonic distortion I was seeing was the result of
crossover distortion, and the success of this suggests that crossover
distortion was the cause of the harmonic content with an LM324. The
TLV2774 is an excellent opamp but it is quite a bit more expensive than
the LM324.
U1 needs to be an excellent opamp, such as the TLV2774. The most
critical specs are input offset voltage and gain-bandwidth product.
Synchronous
Demodulator and A-to-D Converter
This circuit block
samples the sine wave across the inductor under test. The amplitude of
the sine wave is proportional to the total impedance of the inductor
under test, and the amount the sine wave shifted with respect to a
resistive load is used to determine how much of that impedance is from
resistance and how much is from inductance.
To determine the phase, the sine wave is sampled at two different
phases, each 90 degrees apart and then the angle computed from the
measured real and imaginary components. After that, calibration data
are used to correct the angle.
A synchronous demodulator is used to sample the sine wave. The
operation
of synchronous demodulators is pretty well covered on
these two web pages:
http://cappels.org/dproj/syncdet/syncdet.html
http://cappels.org/dproj/dlmom/dlmom.html
I opted for a half-cycle phase comparator, sort of half wave
rectification of the incoming signal, in order to save parts. With
"full wave" sampling, the measurement time could be cut in half. The
two web pages referenced above use "full wave" sampling.
Prior to sampling, the integrator is zeroed by taking the Ramp Up/Ramp
Down pin high or low, depending upon the state of the output of the
comparator, U6, and keeping it high or low until the state of the
comparator changes, thus indicating that the output of integrator U1B
has crossed the reference voltage. At this point, the Ramp Up/Ramp Down
pin is left to float so it doesn't interfere with the measurement cycle
that follows. During measurement, 250 cycles of the 1 kHz sine wave are
measured in each of four phases. The four phases are the real axis,
averaged with the inverted measurement from the negative of the real
axis, and the imaginary axis averaged with the inverted measurement of
the imaginary axis. Taking a cue from the M
3
Electgronix manual, this is done to cancel some of the offsets in the
circuit. It was confirmed experimentally that using 250 cycles,
which is a harmonic of the 50 Hz power line frequency, made the
measurements more repeatable.
To find out how much the average voltage applied to the integrator
during each measurement, the integrator is again driven to zero with
the Ramp Up/Ramp Down control signal, and the time required to zero the
integrator is measured using the on-chip 16 bit timer in the ATINY861.
This 16 bit value in the is averaged with several other measurements in
a boxcar averager to further reduce the noise in the measurement before
being used to compute the resistance and inductance values.
I used an external comparator in the A-to-D converter because the
measurements showed less noise than when I used the comparator on the
ATTINY861. In a lower cost version, the internal comparator can be
used. I the case of the external comparator, the 2.5 volt reference
supply is used as the reference, and when using the comparator on the
ATINY861, the ATTINY861's on-chip 1.2 volt reference is used.
Switchable
Reference Impedance
During basic calibration, the
characteristics of an internal reference "short" and internal reference
30.1 Ohm load are measured with respect to a real world short and a
real world 30.1 ohm resistor connected to the test terminals.
The purpose of the internal reference is to allow quick automatic
recalibration without the need for the user to short the test terminals
then connect a precision reference resistor across it each time.
Basically, a hands-off automatic calibration cycle.
The
internal reference short and reference resistance are switched by U3D
and U3C respectively when needed by the recalibration routine, and the
resistance U3 is removed by the loop gain of opamp U7, TLV2770. Here,
the high gain-bandwidth product of the TLV2770 is pretty important. At
1 kHz, the capacitance from the Device Under Test (or Inductance Under
Test) terminals resulting from the circuit in its "off" state is
insignificant compared to the maximum impedance value of about 300 Ohms.
The 30.1 Ohm resistor does not need to
be this exact value, though it should be pretty close. It is important
that the resistor be a very stable type, because the entire calibrated
stability instrument is entirely dependent upon this resistor.
The resistor I used is specified at 50 parts per million temperature
stability, and
this is more than stable enough for my purposes.
Drift
It would be best if the components in the analog part of the
circuit are low drift. In particular, I am thinking about the
components in the filter, the current source, and the synchronous
demodulator/A-to-D converter circuits. It is essential that the
resistor in the reference impedance circuit be stable with time and
temperature. If the resistor in the reference impedance circuit is
stable, and the opamp is pretty good, then automatic recalibration
should be able to compensate for
small amounts of drift in all the other components.
The
Shield
In my experiments, I found that placing the circuit board on a
conductive shield, connected to the 2.5 volt reference supply, reduce
noise pickup considerably. I had visions of a completely shielded
enclosure for the circuit along with a partially shielded pair of test
clips, but since this is an experimental circuit rather than a complete
instrument, I have not mounted it in a box. Any circuit such as this
does need to be carefully shielded, especially from the power lines.
Description of Controls
The instrument only has a few controls:
Reset
button
This button resets the micro controller and is also used to
start
the fundamental calibration sequence. It can also be used to escape a
calibration sequence.
Calibration
This button starts the automatic calibration sequence and if pressed
immediately after reset, starts the fundamental calibration sequence.
D/Q
This button switches the display mode between displaying resistance and
displaying Q. Where Q is defined as reactance/resistance.
Calibration
The instrument needs to be calibrated initially by adjusting one
pot and going through an initial calibration cycle with a reference
resistor. After that, periodic calibration can be performed by merely
pressing the CAL button and letting the instrument calibrate itself
using the internal references. While performing the calibrations, it is
a good idea to keep your hands away from the inductor under test
terminals. If the circuit is not shielded, its a good idea to not move
your body around much either, as the inducted changes in the electric
field around the can affect calibration.
Initial
Calibration
Initial calibration has two parts: The first part is the
characterization of the values of the internal reference short and the
internal reference resistance, and the second part is the calibration
of the instrument by the use of the internal references.
The first thing to do is to set the current waveform to the inductor to
about 1 milliamp peak-to-peak. Short the inductor under test terminals,
and adjust R7 for 1.0 volt peak-to-peak on
the output of U2D. The precise value is not important because this
value will be measured in the next part of the calibration.
The next step is the fundamental calibration of the internal
calibration, followed by automatic calibration of the instrument. You
will need a 30.1 Ohm resistor. A precision, low drift resister is
preferred, but lacking that, you can a 30 Ohm 5% resistor, preferably
one that you selected to be as close to 30.1 Ohms as possible. You will
also need to use two fingers, a finger and a thumb, or to at least be
very agile with one of them.
Hold down the CAL button with one finger then press and release the
RESET button. The firmware name and revision level should be displayed,
followed by this message:
Short pins, then
press cal button
Release the CAL button and short the inductor under test pins, then
press and release the CAL button.
A display with the following message will be displayed for about 15
seconds.
Short.
Please wait.
During the time the message above is displayed, the instrument
is characterizing the internal short reference. An asterisk (*) will
appear part way into this process to indicate that the process is still
running. When the characterization is complete, the following message
will be displayed.
30.1 Ohm on pins,
press cal button
When the message above appears, remove the short and connect a 30.1 Ohm
resistor across the inductor under test terminals, then press and
release the CAL button.
Resistance.
Please wait.
Again, an asterisk will flash during the process to show that the
process is running. After about 15 seconds, the message below will
appear.
Remove device
press cal button
Remove the 30.1 reference resistor, and press and release the CAL
button
and the message below will appear.
Meas. Int. Ref.
Keep your hands away from the inductance under test terminals during
this operation, and wait about 30 seconds for the internal reference to
be measured and The following periodic calibration cycle to complete.
Asterisks will be displayed to indicate that the process is running.
When the process is complete the meter will start taking measurements
and the "
Overflow" message will
be displayed.
Now, the internal calibration references have been measured, their
parameters stored in EEPROM in the ATTINY861, the meter has been
calibrated, and the calibration data stored in EEPROM in the ATTINY861,
and the meter is ready to use. After the power is cycled, calibration
data in the EEPROM will be used so that measurement can be taken
immediately, thought its a good idea to give the instrument some time
to settle before either calibrating or taking measurements.
Periodic Calibration
Make sure there is nothing connected to the inductance under
measurement terminals and press then release the CAL button. This will
start the automatic calibration cycle.
Usage Notes
This inductance meter measured impedance and angle. The maximum dynamic
range of the analog circuitry is a little more than 33 Ohms in the low
range scale, and a little more than 330 Ohms in the high range scale.
Depending upon the phase angle of the voltage waveform with respect to
the sampling pulses, higher impedances can be measured. But this is
mostly a matter of luck, so don't depend upon it.
Use a low resistance and low inductance connection for the inductor
under test terminals. Stray resistance in the hundredths of an ohm can
affect the readings and maybe more importantly, calibration.
Low resistances in series with high inductances are not accurate. Some
of this is because of an error in correction of the phase angle, but
not all of it, and I haven't been able to track this down yet. If you
have any insight, please share it with me at projects(at)cappels.org.
Return to
HOME
(more projects)
Contents ©2008 Richard Cappels All Rights Reserved. Find updates
at
http://projects.cappels.org.
First posted in August, 2008
You can send email to me at
projects(at)cappels.org. Replace
"(at)" with "@" before mailing.
Use of
information
presented on this page is for personal, nonprofit educational and
noncommercial
use only. This material (including object files) is copyrighted by
Richard
Cappels and may not be republished or used directly for commercial
purposes.
For commercial license, click
here.
Liability Disclaimer
and intellectual property notice
(Summary: No warranties, use these pages at your
own risk. You may use the information provided here for personal and
educational purposes but you may not republish or use this information
for any commercial purpose without explicit permission.) I neither
express nor imply any warranty for the quality, fitness for any
particular purpose or user, or freedom from patents or other
restrictions on the rights of use of any
software, firmware, hardware, design, service,information, or advice
provided,
mentioned,or made reference to in these pages. By utilizing or relying
on software, firmware, hardware, design, service,information, or advice
provided, mentioned, or made reference to in these pages, the user
takes responsibility to assume all risk and associated with said
activity and hold Richard Cappels harmless in the event of any loss or
expense associated with said activity. The contents of this web site,
unless otherwise noted, is copyrighted by Richard
Cappels. Use of information presented on this site for personal,
nonprofit
educational and noncommercial use is encouraged, but unless explicitly
stated
with respect to particular material, the material itself may not be
republished
or used directly for commercial purposes. For the purposes of this
notice,
copying binary data resulting from program files, including assembly
source
code and object (hex) files into semiconductor memories for personal,
nonprofit
educational or other noncommercial use is not considered republishing.
Entities
desiring to use any material published in this pages for commercial
purposes
should contact the respective copyright holder(s).