Silicon ChipHigh-Accuracy Digital LC Meter - May 2008 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Vectrix motorbike is the first electric vehicle for Australian roads / Enersonic Power Saver does not work
  4. Feature: The Vectrix Electric Motor Scooter by Ross Tester
  5. Feature: The Enersonic Power Saver by Leo Simpson
  6. Feature: Prototype PC Boards by Ross Tester
  7. Project: Replacement CDI Module For Small Petrol Motors by John Clarke
  8. Project: High-Accuracy Digital LC Meter by Jim Rowe
  9. Project: Low-Cost dsPIC/PIC Programmer by Mauro Grassi
  10. Project: High-Current Adjustable Voltage Regulator by Jim Rowe
  11. Vintage Radio: The versatile multi-band Ferris 174 portable by Rodney Champness
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the May 2008 issue of Silicon Chip.

You can view 32 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Replacement CDI Module For Small Petrol Motors":
  • CDI Module for Small Petrol Motors PCB [05105081] (AUD $7.50)
  • Replacement CDI Module PCB pattern (PDF download) [05105081] (Free)
Items relevant to "High-Accuracy Digital LC Meter":
  • PIC16F628A-I/P programmed for the Digital LC Meter [0410508A.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F628A firmware and source code for the High-Accuracy LC Meter [0410508A.HEX] (Software, Free)
  • Digital LC Meter PCB patterns (PDF download) [04105081/2/3] (Free)
  • Digital LC Meter front panel artwork (PDF download) (Free)
Items relevant to "Low-Cost dsPIC/PIC Programmer":
  • WinPIC software for the Low-Cost dsPIC & PIC Programmer (Free)
  • dsPIC/PIC Programmer PCB patterns (PDF download) [07105081/2] (Free)

Purchase a printed copy of this issue for $10.00.

By JIM ROWE High-accuracy Digital LC Meter Here’s a handy piece of test gear you can build for yourself – a Digital LC Meter for measuring inductance and capacitance over a wide range. It’s based on an ingenious measurement technique, delivers surprising accuracy and is easy to build. M ANY MODERN DMM’s (digital multimeters) have capacitance measuring ranges, especially the upmarket models. So it’s not hard to measure the value of capacitors, as long as their value is more than about 50pF or so. Below that level, DMMs are not very useful for capacitance measurements. Dedicated digital capacitance meters are available, of course, and they generally measure down to a few pF or so. But if you want to measure things like stray capacitance, they too are of limited use. 40  Silicon Chip It’s even worse when it comes to measuring inductors. Very few DMMs have the ability to measure inductance, so in many cases you have to use either an old-type inductance bridge or a ‘Q’ meter. Both of these are basically analog instruments and don’t offer either high resolution or particularly high accuracy. It’s different for professionals who for the last 20 years or so have been able to use digital LCR meters. These allow you to measure almost any passive component quickly and automatically, often measuring not just their primary parameter (like inductance or capacitance) but one or more secondary parameters as well. However, many of these you-beaut instruments also carried a hefty price tag, keeping them well out of reach for many of us. Fortunately, thanks to microcontroller technology, that situation has changed somewhat in the last few years with much more affordable digital instruments now becoming available. These include both commercial and DIY instruments, along with the unit described here. Main features As shown in the photos, our new Digital LC Meter is very compact. It’s easy to build, has an LCD readout and fits snugly inside a UB3 utility box. It won’t break the bank either – we estimate that you should be able to build it for less than $75. Despite its modest cost, it offers automatic direct digital measurement over a wide range for both capacitance siliconchip.com.au +5V 100k C 100k 10 F L COMP L1 Cx/Lx HOW IT WORKS: THE EQUATIONS (A) In calibration mode Fout (1) With just L1 and C1: 1 F1 = —————— 2.  L1.C1 (2) With C2 added to C1: 1 F2 = ———————— 2.  L1.(C1+C2) (3) From (1) and (2), we can find C1: 2 F2  C2 C1 = ————— (F12 – F22 ) C2 S1 100k C1 (4) Also from (1) and (2), we can find L1: 1 L1 = ————— 4.2 F12 .C1 47k RLY 10 F (B) In measurement mode CAL 1 (5) When Cx is connected: F3 = ———————— 2.  L1.(C1+Cx) so C/L Fig.1: the circuit uses a wide-range test oscillator, the frequency of which varies when an unknown inductor (Lx) or capacitor (Cx) is connected. This oscillator is in turn monitored using a microcontroller which accurately calibrates the unit and measures the change in oscillator frequency. The microcontroller then calculates the unknown component’s inductance or capacitance and displays the result on an LCD. (C) and inductance (L) with 4-digit resolution. In fact, it measures capacitance from just 0.1pF up to 800nF and inductance from 10nH to 70mH. Measurement accuracy is also surprisingly good, at better than ±1% of reading. It also operates from 9-12V DC, drawing an average current of less than 20mA. This means that it can be powered from either a 9V alkaline battery inside the case or from an external plugpack supply. How it works The meter’s impressive performance depends on an ingenious measurement technique which was developed about 10 years ago by Neil Hecht, of Washington state in the USA. It uses a wide-range test oscillator whose frequency is varied by connecting the unknown inductor or capacitor you’re measuring. The resulting change in frequency is measured by a microcontroller which then calculates the component’s value and displays it directly on an LCD readout. So there are basically only two key parts in the meter: (1) the test oscillator itself and (2) the microcontroller which measures its frequency (with and without the component being measured) and calculates the component’s value. To achieve reliable oscillation over a wide frequency range, the test oscillator is based on an analog comparator siliconchip.com.au with positive feedback around it – see Fig.1. This configuration has a natural inclination to oscillate because of the very high gain between the comparator’s input and output. When power (+5V) is first applied, the comparator’s non-inverting (+) input is held at half the supply voltage (+2.5V) by a bias divider formed by two 100kW resistors. However, the voltage at the inverting input is initially zero because the 10mF capacitor at this input needs time to charge via the 47kW feedback resistor. So with its non-inverting input much more positive than its inverting input, the comparator initially switches its output high (ie, to +5V). Once it does so, the 10mF capacitor on the inverting input begins charging via the 47kW resistor and so the voltage at this input rises exponentially. As soon as it rises slightly above the Cx = C1  ( F1 —– F3 2 2 –1 ) (6) Or when Lx is connected: 1 F3 = ——————— 2.  (L1+Lx).C1 so Lx = L1  F1 ( —– F3 2 2 –1 ) NOTE: F2 & F3 should always be lower than F1 +2.5V level, the comparator’s output suddenly switches low. This voltage low is fed back to the comparator’s non-inverting input via a 100kW feedback resistor. It is also coupled through the 10mF input capacitor to a tuned circuit formed by inductor L1 and capacitor C1. This makes the tuned circuit “ring” at its resonant frequency. As a result, the comparator and the tuned circuit now function as an oscillator at that resonant frequency. In effect, the comparator effectively functions as a “negative resistance” across the tuned circuit, to cancel its losses and maintain oscillation. Once this oscillation is established, a square wave of the same frequency appears at the comparator’s output and it is this frequency (Fout) that is measured by the microcontroller. In practice, before anything else is con- Specifications • • • • • • Inductance Range: from about 10nH to over 70mH (4-digit resolution) Capacitance Range: from about 0.1pF to over 800nF (4-digit resolution) Range Selection: automatic (capacitors must be non-polarised) Sampling Rate: approximately five measurements per second Expected Accuracy: better than ±1% of reading, ±0.1pF or ±10nH Power Supply: 9-12V DC at less than 20mA (non-backlit LCD module). Can be operated from an internal 9V battery or an external plugpack. May 2008  41 Parts List 1 PC board, code 04105081, 125 x 58mm 1 PC board, code 04105082, 36 x 16mm 1 PC board, code 04105083, 41 x 21mm 1 UB3 utility box, 130 x 68 x 44mm 1 16x2 LCD module (Jaycar QP5515 or QP-5516 – see panel) 1 5V 10mA DIL reed relay (Jaycar SY-4030) 1 100mH RF inductor (L1) 1 4.0MHz crystal, HC-49U 1 DPDT subminiature slider switch (S1) 1 SPST momentary contact pushbutton switch (S2) 1 SPDT mini toggle switch (S3) 1 18-pin DIL IC socket 1 2.5mm PC-mount DC connector 1 4x2 section of DIL header strip 1 7x2 section of DIL header strip 1 jumper shunt 1 binding post/banana socket, red 1 binding post/banana socket, black 2 PC terminal pins, 1mm diameter 4 M3 x 15mm tapped spacers 4 M3 x 6mm csk head machine screws nected into circuit, Fout simply corresponds to the resonant frequency of L1, C1 and any stray capacitance that may be associated with them. When power is first applied to the meter, the microcontroller measures this frequency (F1) and stores it in memory. It then energises reed relay RLY1, which switches capacitor C2 in parallel with C1 and thus alters the oscillator frequency (ie, it lowers it). The microcontroller then measures and stores this new frequency (F2). Next, the microcontroller uses these two frequencies plus the value of C2 to accurately calculate the values of both C1 and L1. If you’re interested, the equations it uses to do this are shown in the top (Calibration Mode) section of the box titled “How It Works: The Equations”. Following these calculations, the microcontroller turns RLY1 off again 42  Silicon Chip 5 M3 x 6mm pan head machine screws 1 M3 nut (metal) 2 M2 x 6mm machine screws (for S1) 4 M3 x 12mm Nylon screws 8 M3 Nylon nuts 4 M3 Nylon nuts with integral washers 1 9V battery snap lead 1 10kW horizontal trimpot (VR1) Semiconductors 1 PIC16F628A microcontroller programmed with 0410508A. hex (IC1) 1 7805 +5V regulator (REG1) 1 1N4148 diode (D1) 1 1N4004 diode (D2) Capacitors 1 22mF 16V RB electrolytic 2 10mF 16V RB electrolytic 1 10mF 16V tantalum 1 100nF monolithic 2 1nF MKT or polystyrene (1% if possible) 2 33pF NPO ceramic Resistors (0.25W, 1%) 3 100kW 2 4.7kW 1 68kW 4 1kW 1 47kW to remove C2, allowing the oscillator frequency to return to F1. The unit is now ready to measure the unknown inductor or capacitor (Cx or Lx). As shown in Fig.1, the unknown component is connected across the test terminals. It is then connected to the oscillator’s tuned circuit via switch S1. When measuring an unknown capacitor, S1 is switched to the “C” position so that the capacitor is connected in parallel with C1. Alternatively, for an unknown inductor, S1 is switched to the “L” position so that the inductor is connected in series with L1. In both cases, the added Cx or Lx again causes the oscillator frequency to change, to a new frequency (F3). As with F2, this will always be lower than F1. So by measuring F3 as before and monitoring the position of S1 (which is done via the C/L-bar line), the microcontroller can calculate the value of the unknown component using one of the equations shown in the lower section of the equations box – ie, the section labelled “In Measurement Mode”. From these equations, you can see that the micro has some fairly solid “number crunching” to do, both in the calibration mode when it calculates the values of L1 and C1 and then in the measurement mode when it calculates the value of Cx or Lx. Each of these values needs to be calculated to a high degree of resolution and accuracy. To achieve this, the micro’s firmware needs to make use of some 24-bit floating point maths routines. Circuit details How this ingenious yet simple measurement scheme is used to produce a practical LC meter can be seen from the full circuit diagram of Fig.2. It’s even simpler than you might have expected because there’s no separate comparator to form the heart of the measurement oscillator. Instead we’re making use of a comparator that’s built into the microcontroller (IC1) itself. As shown, microcontroller IC1 is a PIC16F628A and it actually contains two analog comparators which can be configured in a variety of ways. Here we are using comparator 1 (CMP1) as the measurement oscillator. Comparator 2 (CMP2) is used only to provide some additional “squaring up” of the output from CMP1 and its output then drives the internal frequency counting circuitry. The oscillator circuitry is essentially unchanged from that shown in Fig.1. Note that the micro controls RLY1 (which switches calibrating capacitor C2 in and out of circuit) via its I/O port B’s RB7 line (pin 13). Diode D1 prevents the micro’s internal circuitry from being damaged by inductive spikes when RLY1 switches off. In operation, IC1 senses which position switch S1 is in using RB6 (pin 12). This is pulled high internally when S1b is in the “C” position and low when S1b is in the “L” position. Crystal X1 (4MHz) sets the clock frequency for IC1, while the associated 33pF capacitors provide the correct loading to ensure reliable starting of the clock oscillator. The results of IC1’s calculations are displayed on a standard 2x16 line LCD module. This is driven directly from the micro itself, via port pins RB0-RB5. siliconchip.com.au siliconchip.com.au GND 14 33pF 33pF X1 4MHz 5 Vss C/L D1 2 7,8 (5V/10mA) RLY1 JAYCAR SY-4030 DIGITAL LC METER SC 2008 S1b Cx/Lx 16 RB6 12 RB7 13 K 1nF (C1) 1,14 6 (C2) 1nF 100k TANT L1 100 H 10 F S1a L C OSC1 15 9 OSC2 RB2 RB3 7 8 RB1 6 RB0 IC1 PIC16F628A 10 F 16V 47k 100k 4.7k 100k A May 2008  43 Fig.2: the complete circuit uses a PIC16F628A microcontroller to monitor and calibrate the oscillator and to drive the LCD module. Note that the analog comparator shown in Fig.1 is actually built into the microcontroller. IN 6 7 1 2 RLY1 LK1 CHECK FREQ F2 4x 1k LK2 CHECK FREQ F1 LK3 DECREASE C RDG 5 R/W GND 2 D5 12 13 D6 D7 17 AN0 AN2 CMP1 1 AN1 RB4 RB5 2 3 CMP2 MCLR 18 14 100nF Vdd 4.7k 4 11 10 S2 6 4 RS EN 14 1 Vdd D4 D3 D2 D1 D0 8 7 11 10 9 2X16 LCD MODULE GND 10 F 16V ZERO LK4 INCREASE C RDG 3 22 F 25V CONTRAST S3 IN OUT GND OUT A 7805 K D2: 1N4004 K A VR1 LCD 10k CONTRAST 68k 9V BATTERY D1: 1N4148 – + A D2 K POWER REG1 7805 The firmware in IC1 is designed to automatically perform the calibration function just after initial start-up. However, this can also be performed at any other time using switch S2. Pressing this switch simply pulls the micro’s MCLR-bar pin (4) down, so that the micro is forced to reset and start up again, recalibrating the circuit in the process. Links LK1-LK4 are not installed for normal use but are used for the initial setting up, testing and calibration. As shown, these links connect between RB3-RB0 and ground respectively. For example, if you fit LK1 and then press S2 to force a reset, the micro will activate RLY1 (to switch capacitor C2 into circuit) and measure oscillator frequency F2. This is then displayed on the LCD. Similarly, if you fit LK2 and press S2, the micro simply measures the initial oscillator frequency (F1) and displays this on the LCD. This allows you to not only make sure that the oscillator is operating but you can check its frequency as well. We’ll have more to say about this later. LK3 & LK4 allow you to perform manual calibration “tweaks” to the meter. This is useful if you have access to a capacitor whose value is very accurately known (because it has been measured using a full-scale LCR meter, for example). With LK3 fitted, the capacitance reading decreases by a small amount each time it makes a new measurement (which is about five times per second). Conversely, if LK4 is fitted instead, the microcontroller increases the capacitance reading by a small increment each time it performs a new measurement. Each time a change is made, the adjustment factor is stored in the micro’s EEPROM and this calibration value is then applied to future measurements. Note also that although the calibration is made using a “standard” capacitor, it also affects the inductance measurement function. In short, the idea is to fit the jumper to one link or the other (ie, to LK3 or LK4) until the reading is correct. The link is then removed. As mentioned above, links LK1-LK4 are all left out for normal operation. +5V Firmware & link functions EXT 9–12V DC Trimpot VR1 allows the LCD contrast to be optimised. JAYCAR 16x2 LCD MODULE QP-5515 /QP-5516 18050140 8002 C – 100 H + S3 9V IN L1 CON1 4004 1nF RLY1 SY-4030 C2 C1 1nF 10 F D2 REG1 7805 Cx/Lx + 4148 D1 + + LK3 LK4 LK1 LK2 100k 4.7k 4.7k 100k 100nF 100k S2 47k 10k BATTERY 1k 1k 1k 1k IC1 PIC16F628A 33pF X1 4MHz 33pF 1 1 1 10 F + VR1 2 Fig.3: follow this layout diagram to build the Digital LC Meter but don’t solder in the switches or the test terminals until after these parts have been mounted on the front panel. The 2-way pin headers for links LK1-LK4 are installed on the copper side of the board – see text. LCD CONTRAST 10 F RETE M C-L LATI GID 68k 14 13 S1 ZERO C—L 22 F POWER The PC board assembly is attached to the case lid using M3 x 15mm spacers and M3 x 6mm csk-head machine screws. Make sure that the assembly is secure before soldering the switch lugs and test terminals. They’re only used for troubleshooting and calibration. Power supply Power for the circuit is derived from an external 9-12V DC source. This can come from either a plugpack supply or from an internal 9V battery. The switched DC input socket automatically disconnects the battery when the plugpack supply is connected. The incoming DC rail is fed via reverse polarity protection diode D2 and power switch S3 to regulator REG1 – a standard 7805 device. The resulting +5V rail at REG1’s output is then used to power IC1 and the LCD module. Construction Because it uses so few parts, the unit is very easy to build. All the parts, except for switches S1-S3 and the Cx/ Lx input terminals, are mounted on a PC board coded 04105081 and measuring 125 x 58mm. The LCD module connects to a 7x2 DIL pin header at one end of the board and is supported at either end using M3 Nylon screws and nuts. Fig.3 shows the parts layout on the PC board. Here’s the suggested order of fitting the components to the PC board: (1). Fit DC power connector CON1 and the two 1mm PC board terminal pins for the internal battery connections. (2). Fit the six wire links, four of which go under where the LCD module is later fitted. Don’t forget the link immediately below switch S1. (3). Install the 4x2 DIL pin header used for links LK1-LK4. Note that this item must be mounted on the copper side of the board (not on the top), so that a jumper can later be fitted to any of the links when the board assembly is attached to the box lid). To install this header, just push the ends of the longer sides of the pins into the board holes by 1-2mm, then solder them carefully to the pads. That done, push the plastic strip down the pins so that it rests against the solder Table 1: Resistor Colour Codes o o o o o o No.   3   1   1   2   4 44  Silicon Chip Value 100kW 68kW 47kW 4.7kW 1kW 4-Band Code (1%) brown black yellow brown blue grey orange brown yellow violet orange brown yellow violet red brown brown black red brown 5-Band Code (1%) brown black black orange brown blue grey black red brown yellow violet black red brown yellow violet black brown brown brown black black brown brown siliconchip.com.au Silicon Chip Binders REAL VALUE AT $13.95 PLUS P & P This view shows the back of the case lid before the PC board assembly is attached. Note the “extension leads” soldered to slide switch S1’s terminals. joints, leaving the clean outer ends of all pins free to take a jumper shunt. (4). Fit a 7x2 DIL pin header for the LCD module connections. This header is fitted to the top of the PC board in the usual way. (5). Install the 11 resistors, seven of which go under the LCD module. Table 1 shows the resistor colour codes but you should also check each resistor using a DMM before soldering it to the board. (6). Install trimpot VR1, followed by inductor L1 and reed relay RLY1. (7). Fit the five non-polarised capacitors, followed by the 10mF tantalum, the two 10mF RB electrolytics and the 22mF RB electrolytic. Note that the tantalum capacitor and the electrolytics are polarised, so take care with their orientation. (8). Install relay RLY1, the 18-pin socket for IC1 and the 4MHz crystal X1. Follow these parts with diodes D1 & D2 and regulator REG1. Note that the regulator’s leads are bent downwards through 90° 6mm from its body, so that they pass through the holes in the board. Before soldering its leads, secure its metal tab to the PC board using an M3 x 6mm machine screw and nut. (9). Secure the LCD module to the PC board, using four M3 x 12mm cheesehead Nylon screws and 12 nuts (three on each screw). Fig.4 shows the details. At each mounting point, two plain nuts act as spacers between the modsiliconchip.com.au Table 2: Capacitor Codes Value mF Code IEC Code EIA Code 100nF 0.1mF 100n 104 1nF .001mF    1n 102 33pF NA   33p   33 ule and the PC board, while a third nut with an integral washer is fitted to secure the assembly under the PC board. Note that when you’re fitting the module to the top of the board, it should be lowered carefully so that the holes at the lefthand end slip down over the pins of the 7x2 DIL strip fitted earlier. (10). Solder the 14 pin connections on the top of the LCD module using a fine-pointed iron. (11). Plug the programmed PIC16F628A (IC1) into its socket, then fit four M3 x 15mm tapped spacers to the PC board mounting points. Secure these spacers using M3 x 6mm panhead screws. That completes the board assembly. It can now be placed to one side while you work on the case. Preparing the case As shown in the photos, the PC board assembly is mounted on the lid of a standard UB3-size jiffy box. If you’re building the Digital LC Meter from a kit, the plastic case will probably be supplied with all holes drilled and with screen printed letter- These binders will protect your copies of S ILICON CHIP. They feature heavy-board covers & are made from a dis­ tinctive 2-tone green vinyl. They hold 12 issues & will look great on your bookshelf. H 80mm internal width H SILICON CHIP logo printed in gold-coloured lettering on spine & cover H Buy five and get them postage free! Price: $A13.95 plus $A7 p&p per order. Available only in Aust. Silicon Chip Publications PO Box 139 Collaroy Beach 2097 Or call (02) 9939 3295; or fax (02) 9939 2648 & quote your credit card number. Use this handy form Enclosed is my cheque/money order for $________ or please debit my  Visa    Mastercard Card No: _________________________________ Card Expiry Date ____/____ Signature ________________________ Name ____________________________ Address__________________________ __________________ P/code_______ May 2008  45 6mm LONG CSK HEAD M3 SCREWS LID OF BOX 15mm LONG M3 TAPPED SPACERS LCD MODULE 14-WAY DIL HEADER 6mm LONG M3 SCREWS 12mm LONG M3 MYLON SCREWS WITH MULTIPLE NUTS 4x2 HEADER (LK1-LK4) PC BOARD (SMALLER COMPONENTS NOT SHOWN, FOR CLARITY) Fig.4: here’s how the assembly goes together. The LCD module is mounted using Nylon screws and nuts, while the completed board assembly is attached to the case lid using M3 x 15mm tapped spacers and machine screws. This side view shows the completed PC-board and lid assembly, ready for installation in the case. ing for the front panel. If so, it will be simply a matter of fitting the switches and binding posts to the lid. Note that slide switch S1 is secured using two M2 x 6mm machine screws, while S2 & S3 are mounted using their own mounting nuts and lockwashers. The binding posts mount to the panel in the same way. If you have to drill the case holes yourself, you can use a copy of the front panel artwork as a drilling template. In addition, you will have to drill/ream a 10mm diameter hole in the righthand end of the box to give access to the DC connector (CON1). This hole should be positioned 22mm from the front edge of the case and 9mm down from the lid, so that it aligns correctly with CON1. That done, the front panel artwork can be downloaded from the SILICON Checkout & calibration DIGITAL LC METER Cx SILICON CHIP ACTIVE LCD CONTRAST Lx GND 9V DC IN CAPACITANCE ZERO OR INDUCTANCE POWER Fig.5: this full-size front-panel artwork can be used as a drilling template for the front panel. The artwork is also on the SILICON CHIP website. 46  Silicon Chip CHIP website and printed onto photographic paper. It can then be attached to the lid using an even smear of neutral-cure silicone sealant and the holes cut out using a sharp hobby knife. Once all the panel hardware is in place, the next step is to fit the PC board. The first thing to note here is that the rear lugs of switches S2 & S3 will pass through their PC pads when the board is mounted on the lid, with just enough metal protruding to allow soldering. This also applies to the binding post terminals. However, slide switch S1’s lugs are not long enough for this, so after the switch is mounted on the lid, a short length of tinned copper wire (eg, a resistor lead offcut) must be soldered to each lug to extend its length. By the way, when you’re fitting these short extension wires, it’s a good idea to make a small hook at the end of each wire and pass it through the lug’s hole before squeezing it with needle-nose pliers. The idea here is to ensure that, once soldered, it’s not going to fall out when the lower ends of the wires are later soldered to the board pads. Once the extension wires have been fitted, you should be able to fit the PC board assembly on the lid so that all the switch and binding post leads pass through their matching board holes. That done, you can fasten it all together using four M3 x 6mm countersink head screws which pass through the front of the lid and into the spacers. The assembly can now be completed by soldering the switch and binding post leads and by fitting the battery snap connector. Your LC Meter is now ready for testing and calibration. To do this, first connect a plugpack supply or a 9V alkaline battery to the unit, set slider switch S1 to the “Capacitance” position and switch on using S3. As soon as power is applied, the message “Calibrating” should appear on the LCD for a second or two, then the display should change to read “C = NN.N pF”, where NN.N is less than 10pF. If this happens, then your meter is probably working correctly, so just leave it for a minute or two to let the test oscillator stabilise. During this time the capacitance reading may vary slightly by a few tenths of a picofarad siliconchip.com.au Adaptor Board For Very Small Capacitors Fig.6: this is what appears on the LCD screen after zeroing the unit in capacitance mode. PLACE SMD CAPACITOR HERE FOR MEASUREMENT 04105082 as everything settles down – that’s normal. Now press “Zero” button S2 for a second or two and release it. This forces the microcontroller to start up again and recalibrate, so you’ll briefly see the “Calibrating” message again and then “C = 0.0pF”. This indicates that the microcontroller has balanced out the stray capacitance and reset its zero reference. Troubleshooting If you don’t get any messages displayed on the LCD, chances are that you’ve connected either the battery snap lead or the plugpack lead’s connector with reversed polarity. Check the supply connections carefully. With power applied, you should be able to measure +5V on pin 14 of IC1 with respect to ground. Alternatively, if you get some messages on the LCD but they’re not as described, it’s time to check that the meter’s test oscillator is working properly. To do this, switch off, fit jumper shunt LK2 (ie, at the back of the board), then apply power and watch the LCD. After the “Calibrating” message, the micro should display an 8-digit number which represents the oscillator frequency F1. This should be between about 00042000 and 00058000, if your components for L1 and C1 are within the usual tolerance. If the figure you get for F1 is “00000000”, your test oscillator isn’t SEE YOURSELF ON YOUR 04105083 PIN JACKS PLUG BODIES & PIN JACKS SOLDERED TO PC BOARD COPPER BODIES OF BANANA PLUGS 'SHORTING BAR' FOR ZEROING METER IN INDUCTANCE MODE Fig.7: the adaptor board (left) is designed to facilitate the measurement of very small capacitors, including SMD devices. The “shorting bar” (above, right) allows easier zeroing of the meter in its inductance mode. T O HELP MEASURE very small capacitors – including trimmers and SMD capacitors – we have designed a small adaptor board which can be plugged into the meter’s binding post terminals. This adaptor board provides a pair of closely spaced pin jacks, along with copper pads separated by a 1mm gap. The pin jacks make it easier to measure small leaded capacitors and very small trimmers, while the copper pads alongside are for measuring SMD capacitors. The adaptor board is easily assembled. It mounts copper-side-up on two banana plugs, which are soldered to the copper around the two large holes. working and you will need to switch off and look for the cause. The possibilities include missed solder joints, a poor solder joint involving one of the oscillator components, or perhaps a tiny sliver of solder bridging adjacent tracks or pads. That done, the two pin jacks (cut from a SIL or DIL socket strip) are soldered into the two smaller holes. To use this adaptor board, you simply plug it into the top of the Digital LC Meter’s binding posts and then press the Zero button to force the meter to cancel out the additional stray capacitance. You can then measure small leaded capacitors, trimmers or SMD capacitors simply by applying them to the top of the adaptor. Finally, we have also designed a second small adaptor board which acts a “shorting bar”. It connects between the two normal binding posts of the Digital LC Meter, to allow zeroing of the meter in its inductance mode. If you do get a figure in the correct range, write the value down, then switch off and transfer the jumper shunt to the LK1 position. Re-apply power and check that the LCD now shows a different 8-digit number after calibrating. This will be F2 – ie, the For your nearest dealer location, call Vectrix Australia lmct 10392 164 Rouse St, Port Melbourne, Victoria 3207 Phone (03) 9676 9133 Fax (03) 9676 9155 info<at>vectrix.com.au siliconchip.com.au May 2008  47 Acknowledgements The Digital LC Meter described in this article is based on a 1998 design by Neil Hecht of “Almost All Digital Electronics”, in Auburn, Washington USA (see his website at www.aade.com). Mr Hecht’s design used a PIC16C622 microcontroller, together with an LM311 comparator in the measuring oscillator. His firmware also made use of floating-point maths routines for PIC processors. These was written by Frank J. Testa and made available on the website of PIC manufacturer Microchip Technology (www.microchip.com). Since then, various people have produced modified versions of the design, including Australian radio amateur Phil Rice, VK3BHR of Bendigo, Victoria. Mr Rice and others have also modified the firmware and adapted it to use the PIC16F628 micro with its internal comparator. They also added the firmware calibration facility. Further information on Mr Rice’s version can be found on the website of the Midland Amateur Radio Club (www.marc.org.au). In summary, a great deal of the credit for this latest version of the design must go to those earlier designers. The author acknowledges their work. oscillator frequency when capacitor C2 is switched in parallel with C1. Because the two capacitors are nominally the same value, F2 should be very close to 71% of F1. That’s because doubling the capacitance reduces the frequency by a factor equal to the square root of two (ie, 1/√2 = 0.707). If your reading for F2 is well away from 71% of F1, you may need to replace C2 with another capacitor whose value is closer to C1. On the other hand, if F2 is exactly the same as F1, this suggests that RLY1 is not actually switching C2 in at all. This could be due to a poor solder joint on one of RLY1’s pins or you may have wired it into the board the wrong way around. Once you do get sensible readings for F1 and F2, your Digital LC Meter will be ready for calibration and/or use. If you don’t have a capacitor of known value to perform your own ac- Using A Backlit LCD Either the Jaycar QP-5515 LCD module (no backlight) or the QP5516 LCD module (with backlight) can be used with this project. If you intend running the unit from a plugpack or if battery use will only be for short periods, then the backlit QP-5516 can be used. Alternatively, for general battery use, we recommend the QP-5515 – its current consumption is much lower and so the battery will last a lot longer. 48  Silicon Chip curate calibration, you’ll have to rely on the meter’s own self-calibration (which relies largely on the accuracy of capacitor C2). In this case, just remove any jumpers from LK1-LK4 and fit your meter assembly into its box, using the self-tapping screws provided to hold everything together. The battery sits in the bottom of the case. It is secured by wrapping it in foam, so that it is firmly wedged in place when the lid assembly is fitted to the case. Fine-tuning the calibration If you happen to have a capacitor of known value (because you’ve been able to measure it with a high-accuracy LCR meter), you can easily use it to fine-tune the Digital LC Meter’s calibration. First, switch the unit on and let it go through its “Calibrating” and “C = NN.N pF” sequence. That done, wait a minute or two and press the Zero button, ensuring that the LCD then shows the correctly zeroed message – ie, “C = 0.0 pF”. Next, connect your known-value capacitor to the test terminals and note the reading. It should be fairly close to the capacitor’s value but may be somewhat high or low. If the reading is too low, install LK4 on the back of the board and watch the LCD display. Every 200ms or so, the reading will increment as the PIC microcontroller adjusts the meter’s scaling factor in response to the jumper. As soon as the reading reaches the correct figure, quickly remove the jumper to end the calibration adjustment. Conversely, if the meter’s reading for the known capacitor is too high, follow the same procedure but with the jumper in the LK3 position. This will cause the micro to decrement the meter’s scaling factor each time it makes a measurement and as before, the idea is to remove LK3 as soon as the reading reaches the correct figure. If you are not fast enough in removing the jumper during either of these calibration procedures, the microcontroller will “overshoot”. In that case, you simply need to use the opposite procedure to bring the reading back to the correct figure. In fact, you may need to adjust the calibration back and forth a few times until you satisfied that it is correct. As previously mentioned, the PIC microcontroller saves its scaling factor in its EEPROM after every measurement during these calibration procedures. That means that you only have to do the calibration once. Note also when you calibrate the meter in this way using a known value capacitor, it’s also automatically calibrated for inductance measurements. Using it The Digital LC Meter is easy to use. Initially, you just switch it on, set S1 to “Capacitance” (NOT “Inductance”), wait a minute or two for it to stabilise and then zero it using pushbutton S2. It’s then just a matter of connecting the unknown component to the test terminals, selecting “Capacitance” or “Inductance” using S1 and reading the component’s value off the LCD. Alternatively, you can zero the Digital LC Meter on the “Inductance” range by fitting the shorting bar shown in Fig.7 (since this bar has virtually zero inductance). This shorting bar is initially connected between the test terminals and switch S2 then pressed to zero the reading. That done, the shorting bar is removed and the unknown inductor connected to the test terminals. Note that if you don’t have S1 (Capacitance/Inductance) in the correct position, the micro will usually give an “Over Range” error message on the LCD. This will also occur if the component’s value is outside the meter’s measuring range – ie, above about 800nF for capacitors or 70mH SC for inductors. siliconchip.com.au