LCF Meter

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Introduction

This project - authored by Freak HalFoster - is an inductance, capacitance, and frequency meter. I built the LC portion of this project this year, and it works quite well. I also built the frequency measuring circuit as a separate module, but I did not incorporate it into the final assembly.

The project's author provides a document which explains most of what a project builder needs to know, such as usage and basic circuit theory, but it does not discuss the LCD or the front panel buttons, which are things the builder needs to know about to build this project successfully. As such, I plan to discuss these things about the project:

- front panel controls
- LCD
- power supply
- parts substitutions
- reservoir caps
- capacitance measurement circuit theory
- frequency measurement circuit

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Front Panel Controls

The front panel controls and indicators are:
- Mode select switches
- Mode indicator LEDs
- Zero (calibration) button
- Connectors
- LCD

Mode Selector Switches

One of my goals for this project was to build it without altering the firmware. Unfortunately, I did not meet this goal, and this is why it is important to understand that the Mode Select Switches are, in fact, normally-open pushbuttons. I made the assumption that I could use a three-position selector switch for the modes, and a separate pushbutton for calibration. This assumption was wrong, and I had to modify the firmware to work-around it.

In the firmware, all four switch inputs make use of pin change interrupt. In the pin change ISR, the ISR masks off all but the four respective inputs, isolates the one input which is actively low, then inverts the value to make the input actively high. It places the value into a global variable, which the main loop checks to see if it has assumed a non-zero value. If it has, it will then execute a series of 'if..else' statements to activate the functionality associated with that pushbutton.

In the series of 'if..else' statements, the Zero button is last. Herein lies the problem with a mode selector switch. A selector switch continuously holds the selected input low, as opposed to a pushbutton, which only ephemerally holds it low. If the user presses the Zero pushbutton, the ISR will correctly indicate that both the Zero pushbutton, and the selector switch position, are active. The series of 'if..else' statements will first see that the selected mode is active, branch away, and never process the Zero button.

To fix this, I moved the two lines of code for the Zero pushbutton to the top of the 'if..else' block:

Original (unchanged) code:

_MDoChange:
    sbrc    Temp, SEL_F     ; was F switch pushed?
    rjmp    _MDoF           ; yes, change mode
    sbrc    Temp, SEL_C     ; was C switch pushed?
    rjmp    _MDoC           ; yes, change mode
    sbrc    Temp, SEL_L     ; was L switch pushed?
    rjmp    _MDoL           ; yes, change mode
->  sbrc    Temp, SEL_ZERO  ; was Zero switch pushed?
->  rjmp    _MDoZero        ; yes, zero current mode
    rjmp    _MDone

Modified code:

_MDoChange:
->  sbrc    Temp, SEL_ZERO  ; was Zero switch pushed?
->  rjmp    _MDoZero        ; yes, zero current mode
    sbrc    Temp, SEL_F     ; was F switch pushed?
    rjmp    _MDoF           ; yes, change mode
    sbrc    Temp, SEL_C     ; was C switch pushed?
    rjmp    _MDoC           ; yes, change mode
    sbrc    Temp, SEL_L     ; was L switch pushed?
    rjmp    _MDoL           ; yes, change mode
    rjmp    _MDone

So, if the builder has a selector switch laying around and wants to use it, and is also willing to alter the code, this simple adjustment will allow him to do so.

LEDs

Since the original design makes use of pushbuttons, they cannot convey, to the user, the currently active mode (L, C, or F), Instead, the LEDs inform the user about the active mode. As it were, the LCD's display also provides a fairly unambiguous indication about the currently active mode. Given that the LEDs are somewhat superfluous, it is up to the individual project builder to decide for himself whether or not he desires the LEDs.

Zero Pushbutton

There is not much to add to that which appears above, except to say that this button is not optional. The device does not work without calibration. As is the case with the other pushbuttons, the button takes advantage of the activation of internal pullups on the inputs to the microcontroller, so no additional circuitry is required.

Connectors

No advice can really be offered on this topic, since the project builder will use whatever he has on hand. However, one might consider, since this is a meter - with leads - that some sort-of banana jack receptacle might be convenient. We all know that connectorization is a highly personal subject, so it would be inappropriate to offer any further commentary on it.

LCD

To be discussed in another posting.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LCD

If the project builder wishes to work with the original firmware without alteration, he must adapt the LCD's hardware to the firmware. The firmware works with a customized serial-to-parallel interface based upon the work of author Myke Predko. If the reader is interested, the original design and circuit theory may be found here: http://www.rentron.com/Myke1.htm; however, the purpose of this post is to provide the builder with the pertinent information he needs to build this project, not to go on an academic diversion, so please keep reading.

While it is clear that the project's author decided to use a serial-to-parallel interface to economize the microcontroller's pins, he did not provide any details about the physical implementation of the interface, other than the pinout of the connector. One presumes he co-located a separate PCB in proximity to the LCD. However, the project builder may not necessarily wish to constrain himself to that, since the interface only saves five circuits. The LCD only requires ten circuits, yet the serial interface consists of five circuits, for a savings of only five wires. One might wish to place all of the interface circuitry on the main board, and make use of a standard, ten-wire cable to the LCD. If the LCD contains a backlight, one additional circuit might be required, or the builder could hardwire the backlight to an always-on condition, thereby saving a wire. The backlight LED's current-limiting resistor might also be mounted onto the LCD itself.

Both implementations - Predko's and Foster's - make use of a shift register to convert the serial input to a parallel output. Predko's "shift register" is not really one at all; it is a facsimile of one made from a six-channel D latch, where the output of one latch is fed to the input of another. Foster's adaptation makes use of a real, 8-bit shift register, although he did not specify the precise model number. My interpretation of Foster's design used a 74HC595 type.

The design requires an external resistor and diode, as shown in the schematic, which together with state of the signals on Q7, of the shift register, and the Serial Data input, form a crude AND gate. The output of the AND gate is the Enable strobe for the LCD. The Enable strobe output will only go high when both the Serial Data input and Q7 are high at the same time.

Furthermore, if the builder uses a '595 type shift register, he must connect the two clock inputs as shown in the schematic. The business of shifting data into the '595 and onto its pins is a two-step process. One clock input (SHCP) clocks the data into the chip, but does not otherwise affect the output, while the other (STCP) strobes the contents onto the output pins. When the firmware raises the data line high to create the Enable signal, it also strobes the contents of the shift register onto the output pins by virtue of its connection to the STCP clock input.

Lastly, the schematic shows a charge-pump inverter to supply a negative voltage rail for the LCD. The project builder should disregard this portion of the schematic unless his model of LCD requires a negative contrast voltage.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Power Supply

Nominally, the project requires +5 and -5 VDC voltage rails. The negative rail primary exists to supply the negative rail for the analog ICs within the frequency measurement portion of the circuit. It also supplies the negative rail for the DG419 SPDT analog switch, and the zeroing circuit for the frequency measurement input. It might also be useful if the LCD requires a negative contrast voltage.

If the project builder does not plan to incorporate the frequency measurement portion into his LC meter, and his LCD does not require a negative contrast voltage - as most do not - then he may wish to use a single +5 VDC rail.

What then, about the DG419 SPDT analog switch? Answer: I am not sure, since I substituted it with a digital IC. Its job is to switch between two digital inputs, so it will not see any signal that goes below ground, and might not even need a negative rail. This chip can be used in either single-ended or dual-ended modes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Parts Substitutions

I endeavored to stay as faithful to Foster's original design as possible, but as time wears on, availability to particular parts changes, and one must find suitable substitutions. These are the substitutions I made:

Designator  Original    Type                   Substitution    
IC2         74HC90      Decade Counter          74HC4017
IC3         MAX903CPA   High-speed Comparator   LT1016
IC6         LM6171      High-speed Opamp        OPA830
IC7         DG419       Analog Switch (SPDT)    74HC00
Q12         TIP101      Darlington Transistor   TIP102

I'll take them one-by-one.

74HC90
This IC is obsolete. Apparently, the 74HC390 is its replacement. When looking for a replacement, I did not find, nor know about, the '390. I just simply missed it, so I went with what I did find, which was the '4017. The '4017 is actually a Johnson counter. The objective of this IC, within the Foster design, is to divide its input by ten. The '4017 does this on its 'TC' output (Tens Carry or Terminal Count). This output produces one cycle for every ten input clock cycles, which is precisely the objective of the design, thereby making it a suitable part substitution. Both the '390 and the '4017 are 16-pin ICs.

MAX903CPA
For all intents and purposes, this IC is obsolete. One might find it at a very high price, but nothing he will want to pay. It has been replaced by the MAX9203, which is not available in a DIP package, and costs close to $3.00. I do not know if the one I chose - the LT1016 - is available in DIP, but I bought the SOIC version, and it cost less than $2 USD. They are fairly comparable in performance.

LM6171
I only purchase parts from a limited number of vendors, and I could not obtain this one. I suggest that if you can do so, get it. It is a really outstanding IC. I replaced it with one I could get - the TI OPA830. Its specs are not quite as nice as the National part, but it is not bad. I did, however, get tripped-up by the significantly higher input bias current associated with the Texas Instruments part. The input bias current actually flows out of the input pin. This current - which was approximately 4 uA - created a not-so-insignificant voltage drop within the high-impedance input biasing network. The imbalance that it created was so significant that I could not zero-out the bias level. I rectified it by imbalancing the resistor stack to accommodate the additional voltage drop induced by the bias current. If one wishes to emulate the original circuit topology, yet cannot obtain this part, be mindful of this issue, or consider a different circuit topology - something even the project's author suggests in the document.

DG419
This IC switches a single input on the microcontroller between one of two, digital signals: the digital output of the frequency conditioning circuit, or the oscillation output of the inductor measurement circuit. I suppose that if Foster used it successfully, then it's OK to use, and I would not counsel against it. However, since the signals are all digital, a digital IC would also be suitable in this position. To that end, I contrived a SPDT switch from an ordinary, quad NAND gate.


TIP101
The TIP102 is the highest voltage model in the TIP100..102 series, and may be more readily available because of that fact. It makes no material difference, to the circuit, which one of the three types is used.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Reservoir Caps

The original LCF Meter schematic groups a large number of reservoir capacitors together at the top of the page. It is something of a tedious task to cross-reference them against the other diagrams to figure-out where they belong - that is, to figure-out which parts they serve. Since I have done that work, I provide it here for the prospective builder.

                                    IC      IC
RefDes  Value   Part(s)     RefDes  pin #   pin name    Rail

C13     100 nF  LM393       IC5     8       VCC         +5VDC
C14     100 nF  ATMega88    IC1     7       VCC         +5VDC
C15     100 nF  MAX903      IC3     1       VCC         +5VDC
C16     100 nF  74HC14      IC4     14      VCC         +5VDC
C17     100 nF  ATMega88    IC1     20      AVCC        +5VDC
C18     100 nF  DG419       IC7     7       V-          -5VDC
C19     100 nF  MAX903      IC3     4       VEE         -5VDC
C20     100 nF  MAX903      IC3     5       Latch       +5VDC
C21     22 uF   CS_500UA    R6,R7                       +5VDC
C22     47 uF   CS_50MA     R2,R3                       +5VDC
C23     2200 uF PWR                                     +5VDC
C24     1000 uF PWR                                     -5VDC
C25     10 uF   CS_5UA      R10,R11                     +5VDC
C26     100 nF  74HC90      IC2     5       VCC         +5VDC
C27     22 uF   ATMega88    IC1     20      AVCC        +5VDC
C28     22 uF   DG419       IC7     4       V+          +5VDC
C29     100 nF  DG419       IC7     4       V+          +5VDC
C30     22 uF   LM6171      IC6                         -5VDC
C31     100 nF  CS_500UA    R6,R7,R2,R3                 +5VDC
C32     100 nF  CS_5UA      R10,R11                     +5VDC
C33     100 nF  ATMega88    IC1     20      AVCC        +5VDC
C34     22 uF   LM6171      IC6                         +5VDC
C35     22 uF   LM6171      IC6                         -5VDC
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Capacitance Measurement Circuit Theory

The project document provided by the project's author, Freak HalFoster, explains the overview of this circuit well enough to get things going, but its worth a bit more explanation.

Capacitance Measuring Circuit
The capacitance measuring circuit works on two principles: 1) a capacitor integrates the current flowing through it; 2) the integration of a step is a ramp. Put those two things together: a current step through a capacitor will produce a voltage ramp on the output. That is the principle upon which this circuit works.

The current step is provided by one of three current sources. Turn on the current source with a digital signal from the microcontroller, and it will sort-of "shoot" a current 'step' through the capacitor-under-test. In turn, the capacitor will produce a voltage ramp across it. This ramp feeds into a window comparator. The window comparator is so-named because it has two thresholds, not just one. The ramp will cross a lower threshold into the 'window', then cross another higher threshold to exit the window. During its time within the window, the output of the comparator circuit will be high. The microcontroller will measure the length of this logic-level pulse to determine its duration. It will use this timing information against a known reference value to determine the capacitance value.

The threshold levels of the window are 0.75 V and 4.25 V, for span of 3.5 V. The Darlington transistor discharges the capacitor-under-test to something below the 0.75 V level to prepare it for the test.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Frequency Measurement Circuit

Of the three circuits in the project, this is the trickiest one to get right. It is, after all, a high-speed design, meaning that care must be taken to do things right. I, for one, did not. My circuit works, but only if it sees a clean, digital signal. This alone was good enough to assess the frequency-measuring competence of the device and the efficacy of the digital SPDT switch mentioned elsewhere. It proved that the meter is extremely accurate. One need not worry about that.

The problem that I experienced is that this circuit did not work with analog signals. Through inference - because I do not have an oscilloscope to prove this - the output of the comparator oscillated. This is, of course, the difficulty when working with analog-to-digital conversion with a comparator. One wants it to be fast, but 'fast' means instability. The instability must be managed. I believe Foster managed his design with copious helpings of reservoir capacitors. He seemed to place more emphasis on boosting the opamp rather than the comparator, but the comparator is the one more prone to instability.

My recommendation is to prototype this circuit before committing to it unconditionally. One of the things that the builder might take into account is the possible addition of hysteresis to the comparator circuit. In that event, the signal from the opamp should go to the inverting (minus, or negative) input of the comparator, so that the hysteresis can be fed back to the non-inverting input.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This DIY LC meter , seems interesting too

http://www.cappels.org/dproj/Eve...

/Bingo