Panteltje's LC_pic page

Panteltje's LC_pic page


A simple very accurate LC meter, based on a design by Phil Rice VK3BHR.
This one has no LCD, but has RS232 output and gets its power from the RS232 connection.


First of all, all credit goes to Phil Rice for the original design, I merely simplified it so it does RS232 output at 9600 Bd and no longer needs a LCD display or power source.
His website is here: http://ironbark.bendigo.latrobe.edu.au/~rice/lc/
That site also goes into some of the history of this design.


Specifications:
Measuring range is from 0 to > 0.1 uF for capacitance and 0 to > 10 mH for inductance.
Expected accuracy is +/- 1% of reading +/- 0.1 pF or +/- 10 nH
When using the Linux lcp program (included in this tgz archive) to communicate with the box, the maximum inductor size is > 1H, and the maximum capacitor size > 1 uF, see below.
The lcp program is a command line utility written in C, it should be easy to port it to other operating systems.


Screen output example, in a Linux xterm with ptlrc communication program, with 1300 pF connected:
1.3nF

With an other 33 uH coil connected:
33uH


Calibration:
If you have a reference capacitor, you can calibrate the output to that by shorting pin 6 or pin 7 (for up and down) to ground via a 1k resistor, calibration is saved in EEPROM.
In the lcp C source there is a #define at the top of the page for the calibration capacitor Cref, it is set to 1 nF, you can change that if you use a different capacitor value.
Cref should be a 1 % type, or else you will lose accuracy.

I build mine mostly from parts from the junk box, all except the box, it uses a Microchip PIC 16F648. costs less then 10 $, and this thing is better then some huge expensive stuff you can buy.
It should work with any terminal program on any PC, it also works on USB with an USB to RS232 adaptor.


This archive contains the diagram, the source asm files, and a pre-assembled hex file, and also a Linux C program and executable that extends the measurement range by doing the calculations on the PC.
This is done by having the PIC not only send the calculated component value, but also the 3 frequencies after each measurement.
As the PIC does the math in 24 bit floating point format, its range is limited, doing it on the PC extends the range for inductors to beyond 1 H, and for capacitors to beyond 1 uF.
Also in this version there is no longer a 'calibration switch' on the box, hitting the space bar on the PC keyboard will now activate calibration.
Click here to download lc_pic-0.6.tgz


The circuit diagram,
LC_pic circuit diagram
Some notes:
I used a 1 nF 1% capacitor for Cref, and switched it with a BFR96, maybe not the best way, experiments with a small MOSFET did not work out so well.
For the 100 uH coil I used 3 33 uH cheap inductors in series, making 99 uH.
For the 1 nF tuning cap I used 680 pF and 330 pF in parallel, together with the 99 uH this gives close to 60000 on the display, these values are not critical,
but as the frequency counter is 16 bits, and counts for 1/10 of a second, the maximum frequency it can measure before it overflows is 655350 Hz, so you have to stay below that.
The minimum you can count that way is about 10 Hz, with 1 count uncertainty.
The counted values for the 3 frequencies are displayed along with the result if you connect the box to a terminal, or use lcp -s, multiply by 10 to get Hz.
In debug mode (-v flag) lcp will also display the L and C value you used.


The hardware, the BOX:
LC_pic in box


The hardware, the PCB top, note the 3 33 uH coils to make 99 uH:
LC_pic PCB component side


The hardware, the PCB bottom:
LC_pic PCB wiring side


How it works:
The PIC is used as a frequency counter.
It measures the frequency of a simple LC oscillator with unknown (well you soldered in something, but the math below will show why differences are cancelled) L and C, with a 4 MHz crystal as reference.
First it measures this frequency 'f1'.
We know that L = 1 / (w1^2. C), where 'w' stands for Omega = 2 * pi * f.
Then it puts a known precise capacitor 'Cref' in parallel to the LC circuit, and measures the frequency again 'f2'.
We also know that L = 1 / (w2^2 * (C + Cref) )
Now we have 2 equations with 2 variables, we can solve for L and C:
1 / w1^2 * C = 1 / (w2^2 * (C + Cref)
w1^2 * C = w2^2 (C + Cref)
w1^2 * C = w2^2 * C + w2^2 * Cref
w1^2 * C - w2^2 * C = w2^2 * Cref
C (w1^2 - w2^2) = w2^2 * Cref
C = (w2^2 * Cref) / (w1^2 - w2^2)
So now we know C, and can put it into L = 1 / (w1^2 * C) to find L.

Then finally, to measure an unknown C, it removes the Cref and it puts the unknown capacitor parallel to the LC circuit, and measures again 'f3'.
To measure an unknown inductor it removes Cref and puts the unknown L in series with the L.
Now we can calculate Lx and Cx:
Cx + C = 1 / w3^2 * L, this gives for Cx:
Cx = (1 / (w3^2 * L) ) - C
Lx + L = 1 / (w3^2 * C), this gives for Lx:
Lx = (1 / (w3^2 * C) ) - L


Here is a nice simple terminal program you can use in Linux if you do not want to use the included lcp program:
ptlrc-0.5.tgz




Click here for some more Microchip PIC based projects

Click here for some programs I make available under the GPL.

Click here to send mail