u050930_7661
TRANSCRIPT
-
elektor electronics - 9/200530
Flemming Jensen
Digital capacitance meters havebecome fairly inexpensive. Mostcommercial capacitance metershave a measurement range of a fewpicofarads to 2,000 mF. Some can evengo as far as 20 mF, but thats where itstops. Large capacitors with values ofseveral hundred millifarads, which areoften used in power supplies, printersand photocopiers, cannot be measuredusing such meters. That means youwill need a different (and more
ESR/C MeterA versatile meterfor capacitors
ESR/C Meter
The two most importantproperties of a capacitor areits capacitance and itsinternal resistance (ESR). Youneed to know both values inorder to judge whether acapacitor is suitable for aparticular application. Themeter described herecombines two popularElektor Electronics projects tocreate a convenient newinstruments that rightlybelongs in every well-equipped electronics lab.
advanced) type of meter.Theres another important property ofa capacitor that cannot be measuredusing a normal capacitance meter: itsequivalent series resistance (ESR).Beside the capacitance, it is one of themost important properties of a capaci-tor. An ideal capacitor is a purely reac-tive component, with a 90-degreephase shift between voltage and cur-rent. However, practical capacitorsalso have a non-zero resistance in
series with the ideal capacitance (seeFigure 1). The resistance representsthe losses inside the component, andit largely corresponds to the quality ofthe capacitor.Electrolytic capacitors tend to dry outafter a long time, which causes theirESR to increase. A pure reactance can-not generate any heat, due to thephase shift of exactly 90 degreesbetween voltage and current, but aresistance can generate heat. The heat
HANDS-ON TEST & MEASUREMENT
-
dissipated in a capacitor due to its ESRincreases in a switch-mode circuit,which causes its quality to deteriorateeven more. With an aged electrolyticcapacitor, it is not uncommon to findthat although the capacitance hasdecreased by only a few percent, theESR is more than 100 . An ESR of thismagnitude makes a capacitor com-pletely unusable in switch-mode cir-cuits and hardly usable for any othertype of application.
Why a combined meter?An ESR meter and a capacitance metermeasure two different things. Theycomplement each other. Thats why itsconvenient to combine the two meas-urements in a single instrument. Forthis purpose, the author has mergedthe especially popular ESR Tester pub-lished in the September 2002 issuewith the Autoranging CapacitanceMeter published in February 2003 (andalso designed by the author). Theresult is a handy instrument with adual function and outstanding charac-teristics.The new instrument also has a consid-erably more up-to-date design than theoriginal versions. The design of theoriginal ESR meter was based on avoltmeter IC, but new design is builtaround a type 16F877 PIC microcon-troller. The advantage of this is thatsome new features can be added,while there is also enough room for theprogram for the capacitance meter.The following capabilities have beenadded to the ESR meter:- AC resistance (ESR) and DC resist-ance are displayed simultaneously. Inthe old design, you had to select one orthe other by pressing a switch. The DCresistance indicates whether thecapacitor is internally shorted (andthus simply kaput).- The new design asks the user toshort the probes together when themeter is switched on, so the offset canbe measured. With the old design, thishad to be handled mechanically.- An audio function is built in to avoidhaving to always keep an eye on themeter. Thats primarily helpful whenyoure making measurements oncapacitors deep inside a device. Therounded-off ESR value is indicated bybeeps. If the measured ESR is in therange of 3.14.1 , for instance, fourbeeps are emitted. The meter also gen-erates a warning signal if the DCresistance is less than 10 . No beepsare emitted if the measured ESR is
greater than 10 , since a capacitorwith such a high ESR value probablyshould be replaced. If no signal is emit-ted, you should briefly check the dis-play to see whats wrong.No new functions have been added tothe capacitance meter. Here the majorchange consists of rewriting the codefor the PIC16F877.
Measurement principle of the capacitance meterThe complete schematic diagram isshown in Figure 2. The circuit of thecapacitance meter is based on a CMOSversion of the well-known 555 timer IC,which is used here as a monostablemultivibrator. The PIC provides thereset signal, controls the trigger input,and monitors the output of the 555.The larger the value of the capacitor tobe measured, the longer the output ofthe 555 remains high. A counter in thePIC counts up as long as the outputremains high. The count is read whenthe output goes low. The PIC automatically switchesbetween the various measurementranges. The meter has three ranges:19999 pF, 109999 nF, and >10 F. Tomake the measurement easy to read, avalue of 1000 pF or 1000 nF is shownas 1.00 nF or 1.00 F, respectively.The capacitance meter has automaticzero adjustment. After the instrument isswitched on, the PIC executes a rou-tine to measure the residual capaci-tance of the probe leads or other exter-nal circuitry. The measured value issubsequently subtracted from everyreading to yield the correct value, sothe offset resulting from using differentprobe leads does not affect the read-ing. Its thus important to ensure thatthe meter is not connected to a capac-itor when it is switched on, althoughthis actually only applies to the pico-farad range.For capacitance measurements in theother ranges, no problem will result ifthe capacitor is already connectedbefore the meter is switched on. Imme-diately after the automatic zero adjust-ment, the meter starts measuring inthe picofarad range. If the capacitanceis too large, a counter overflow occursand the PIC selects the nanofaradrange. A lower charging resistance isselected for this range (R17R19 andP2P4), so the charging current ishigher. If the capacitance is still toolarge, the PIC switches to the micro-farad range and completes the meas-urement in that range, regardless of
the charging time. The results are dis-played on a two-line alphanumericLCD module.
Hum interferenceThe input impedance is very high inthe picofarad range. In that range, thecapacitor is charged via a resistance of56 M. As a result, the meter is quitesensitive to AC mains interference(hum) in the picofarad range. Youshould keep the meter well away fromtransformers and similar componentswhen making measurements in thepicofarad range, since otherwise thedisplayed value may fluctuate.In order to suppress the effects of pos-sible hum, the measurement is madetwice in the picofarad range at aninterval of 10 ms. The average value ofthe two measurements is calculatedand displayed. That makes the meas-ured value more stable. The imped-ance is relatively low in the two otherranges, so no special measures aretaken. The measurements on thoseranges are thus single measurementswithout any averaging.
Large capacitancesCapacitors with values less than10 mF are continuously measured. Themeasurement cycle is repeated period-ically starting with the picofaradrange, followed by the nanofaradrange and then the microfarad range.Capacitors with values greater than
9/2005 - elektor electronics 31
ESR
idealcapacitor
reactive part XC = 2 f .C1
012022 - 11
Figure 1. The most important property of acapacitor is its capacitance. The second mostimportant property is its equivalent series
resistance (ESR).
-
to the capacitor being tested (thecapacitor under test or C.u.T.). Thevalue of the ESR can be determined bymeasuring the AC voltage across thecapacitor. If the capacitance is suffi-ciently high relative to the frequency,the voltage drop due to the reactiveimpedance is negligible, so the voltageacross the capacitor is entirely causedby the ESR. This voltage is rectifiedand fed to the voltmeter.The operating principle is illustrated inFigure 3. Here it is assumed that theC.u.T. is rated at 100 F and has anESR of 10 . The reactive impedance(XC) is equal to 0.5fC or approxi-mately 0.0159 , which is negligiblerelative to the ESR value of 10 . Thevoltage measured across the C.u.T. is
thus the voltage across the ESR. As thetwo electronic switches are actuatedsynchronously at the same frequency,a constant differential voltage is pres-ent at the input to the opamp. Theopamp passes the differential voltage(in this case 11 mV) to its output, sothe voltage at the output of the opampis proportional to the ESR value. Figure 4 shows a different example,with a test capacitor rated at 0.1 Fand having an ESR of zero ohms. Asalready noted, a fairly high frequency isused to keep the effect of the reactiveimpedance as small as possible so thateven small electrolytic capacitors withvalues as low as around 0.1 F can bemeasured. That makes it necessary tofurther reduce the effect of the initial
elektor electronics - 9/200532
HANDS-ON TEST & MEASUREMENT
10 mF (milli-farad) are not measuredcontinuously. Instead, a series of fourmeasurements are made and theresults are then averaged.This method ensures that the capaci-tor is fully discharged and charged andgenerates highly reliable measure-ments. It also limits the current con-sumption. The instrument must beswitched off and then on again in orderto make a new measurement. Contin-uous measurements are made in allother ranges.
Measurement principle of the ESR meterA 100-kHz square-wave signal thatsupplies a constant current is applied
+5V
22k
P5
X1
20MHz C4
27p
C3
22p
PIC16F84
OSC2
IC2
OSC1
MCLR
RA4
RA1RA0
RA2RA3
RB0RB1RB2RB3RB4RB5RB6RB7
1817
13121110
1615
14
1
3
987
6
2
4
5
C16
100nC15
100n
+5V
+5V
C7
100n
R25
10k
+5VR27
220
BZ1
IC3.C
12
1011
IC3.B
5
34
IC3.A
1321
IC3.D
6
98
TLC555
IC5DIS
THR
OUT
TR
CV
2
7
6
4
R
3
5
8
1
C17
100n
+5V
C2
47n
T1
BC557
200
P4
R19
120
R21
1k
1k
P3
R18
7k85
1M
P2
R17
8M2
S1
31
2
64
5
R26
10k
signal +
signal
R356
R456
R52k2
R62k2
R7
2k2
R8
2k2
D5D4
sense +
R156
sense R256
D2
1N4007
D3
2
3
1IC7.A
6
5
7IC7.BR11
1M
R141M
R101k
R121M
R910k
R201k
R2282k
R24
2k2
R13
1M
R23
47
C1
1n
100kP1
R1510k
R1610k
+5V
100k
P6
C6
220n
D1
5V6
C5
1016V
PIC16F877
RA4/T0CKRA3/AN3
RA5/AN4
RA1/AN1RA0/AN0
RA2/AN2
INT/RB0
RE0/AN5RE1/AN6RE2/AN7
RX/RC7
TX/RC6
MCLR
IC1
OSC2 OSC1
RC0
RB1
RB7
RB4RB3
RB6RB5
RB2
RC1
RC2RC3
RD0RD1RD2RD3
RC5RC4
RD7
RD4RD5RD6
11
15
40393837
3536
3433
3112
10
32
16
1718
19202122
26
252423
30
272829
14 13
1
32
4
65
7
89
K1
10111213141516
123
4
567
89
BT1
S2
+VBAT
R28
10k
R29
10k
78L05IC6
+5V
IC314
7
C14
100n
+5V
C11
1016V
ICL7660IC4
VOUT
OSC
V+C+ C-
LV
8 5
3
2 4
67
+5V
C1010
16V
C12
100n
C13
100n
IC78
4
+VBAT
-5V
-5V
-5V-5V
LC DISPLAY
040259 - 11
2x
1N40072x
IC7 = LF412
Cx
R30
180
IC3 = 74HC4066
C8
100n
C9
100n9V
1%
1%
1%
1%
Figure 2. The complete schematic diagram of the capacitance/ESR meter.
-
integration of the voltage waveform. Here the ESR is zero and the reactiveimpedance is 0.5fC, or approximately16 . As can be seen, the differentialconfiguration of the opamp causes thesawtooth integration waveform on theinputs to be summed to yield a saw-tooth voltage on the output with anaverage value of 0 V. The resulting volt-age after integration by the subse-quent RC network is 0 V, and this valueis applied to the input of the voltmeter.If the capacitor had an ESR of 10 , thesawtooth voltage on the output wouldstill have the same form, but it wouldbe superimposed on a DC componentdue to the ESR. After the sawtoothwas filtered out by integration, theremaining voltage would correspond to
the actual ESR value of 10 , while theeffect of the reactive impedance of16 would have been eliminated.
Multiple PICsThe frequency generator in the circuitof the original design has beenreplaced by a PIC (type 16F84). The16F877 cannot be used for this purposebecause the signal cannot be inter-rupted unless a DC tests is beingmade. The 16F84 uses the same clockoscillator as the 16F877. The advan-tage of using a second PIC is that itmakes it unnecessary to align the 100-kHz generator frequency. It also allowsthe generator to be easily switchedbetween AC and DC measurements.
These modes are controlled by the16F877, which uses interrupt routinesto determine what the 16F84 has to do.
Component selectionAs this circuit works with high fre-quencies and signal levels in the milli-volt range, a differential amplifier witha low offset and large bandwidth mustbe used. The LF412 meets theserequirements and is also not all thatexpensive.The HC version of the well-known 4066quad electronic switch IC provides fastswitching times, which reduces theeffect of the undesirable reactance bya factor of 2.The best results will be obtained if the
9/2005 - elektor electronics 33
1M
1M
1M
012022 - 12
2k2
2k2
2k2
2k2
1M
ESR
XC = 0
ESR =10
+5V0
1.255V1.244V
0
1.255V1.244V
0
1.255V
0
11mV0
1.244V0+5V
0
C.u.T. 100F
1
18
16F84
100kHzgenerator
1M
1M
1M
012022 - 13
2k2
2k2
2k2
2k2
1M
ESR
XC = 15
ESR =0
+5V0
0
50mV
+5V0
0
50mV
0
50mV
0 50mVpp
0VDC
0
50mV
C.u.T. 100nF
1
18
16F84
100kHzgenerator
Figure 3. With a capacitor rated at 100 F nd having an ESR of 10 , the reactive impedance is negligible and the ESR (which is purely resistive) determines the output voltage of the opamp.
Figure 4. The situation with a capacitor rated at 0.1 F and having an ESR of 0 . Here the average output voltage of the opamp is 0 V.
-
COMPONENTS LIST
Resistors:R1-R4 = 56R5-R8,R24 = 2k2R9,R10,R15,R16,R25,R26,R28,R29 =
10kR11-R14 = 1M 1%R17 = 8M2R18 = 7k85R19 = 120R20,R21 = 1kR22 = 82kR23 = 47R27 = 220R30 = 180P1 = 100k 10-turn presetP2 = 1M 10-turn presetP3 = 1k 10-turn presetP4 = 200 10-turn presetP5 = 25k presetP6 = 100k 10-turn preset
Capacitors:C1 = 1nFC2 = 47nFC3 = 22pFC4 = 27pFC5 = 10F 16V radialC6 = 220nFC7,C8,C9,C12-C17 = 100nF, lead
pitch 5mmC10,C11 = 10F 16V radial
Semiconductors:D1 = zener diode 5V6 500mWD2-D5 = 1N4007IC1 = PIC16F877-20/P, programmed,
Publishers order code 040259-41*
IC2 = PIC16F84A-20/P,programmed, Publishers order code040259-42*
IC3 = 74HC4066IC4 = ICL7660IC5 = TLC555IC6 = 78L05IC7 = LF412CPT1 = BC557
Miscellaneous:Bz1 = AC (passive) piezo buzzerS1 = switch, 2 changeover contactsS2 = switch, 1 make contactK1 = LCD module, 2x16 characters
(e.g., Digikey # 153-1078-ND)X1 = 20MHz quartz crystal2 wander sockets for banana plugMeasurement cableEnclosure, e.g., SERPAC H75 (Digikey
# SRH75-9VB-BD)PCB, Publishers order code
040259-1*Disk, source- and hex-code files,
Publishers order code 040259-11* or Free Download
* see Elektor SHOP page orwww.elektor-electronics.co.uk
elektor electronics - 9/200534
040259-1
BT1
BZ1
C1
C2
C3C4
C5
C6
C7 C8
C9C1
0
C11
C12
C13
C14
C15
C16
C17
D1
D2D3D4 D
5
IC1
IC2
IC3
IC4
IC5
IC6
IC7
K1
P1P2
P3P4
P5
P6 R1
R2
R3
R4R5
R6
R7
R8
R9
R10
R11
R12
R13
R14
R15
R16
R17
R18
R19
R20
R21
R22
R23R24
R25
R26
R27
R28
R29
R30
S1
S2
T1
X1
0402
59-1+ -
sense+
sense-
signal+
signal-
C+C
-
+-
040259-1
040259-1
Figure 5. Double-sided circuit board layoutand component layout for theESR/capacitance meter.
HANDS-ON TEST & MEASUREMENT
-
Karel Walraven
The first life signs of the circuit werehopeful. The display produced leg-ible texts, so at least the micro-processor is running its program.Then came the problems. Measur-ing capacitors was troublesome ifnot impossible usually, the dis-play remained stuck at one firm 0and thats no incentive to build anESR/C Meter. So we ran the usualchecks on the board. Always startby measuring the supply voltagedirectly on the IC pins both the+5 V and ground rails should beinspected. Next up is the micro-processor clock and bingo there wegot 6.66 MHz instead of thedesired 20 MHz the quartz crys-tal was cheerfully resonating at itsfundamental frequency instead ofthe third overtone. Sometimes this isa false reading however, the 50-pFscope probe capacitance wreakinghavoc at the oscillator input. How-ever, a rock solid 6.66 MHz wasmeasured at the oscillator output
and we were using a 1:10 probeso extra capacitive loading wouldbe small. This leaves several otherfault factors to be considered: thePIC may have been programmedfor standard crystal instead ofhigh speed crystal, or the two xtalloading capacitors may be toolarge. Also, the crystal itself may beat fault, some will simply refuse toswitch to overtone resonance. In ourcase, it turned out that the PIC wasincorrectly programmed and theproblem was solved quickly. Alasthe display now greeted us withtotal gobbledygook. Strange, butstill reassuring to know at this pointthat there were no display wiringerrors after all, the display hadworked just fine we corrected theclock frequency. A timing error? LCdisplays may not be driven too fast.For example, the datasheet tells usto observe a minimum length of450 ns for the enable pulse. Inter-nally, a PIC operates at the xtal fre-
quency divided by four, so in the-ory, at 20 MHz, it is able to supplynew data on its I/O pins every200 ns. That looked like a plausibleexplanation of the phenomenon wewere faced with. This kind of erroreasily creeps into a design. The testcircuit runs fine at a lower clockspeed, hooray, the design isquickly optimised while drawingthe schematic and then a finalcheck of the pulse timing is forgot-ten. However, it could also be anundiscovered error some LCDshave no problems with 200-nspulses, while others from a differentseries or manufacturer will hang.
We cast a critical eye on the LCDdriver routine, created a longerenable pulse and reprogrammedthe PIC. The LCD then worked asdesired. By itself, that is, becauseafter all this hard work, the readoutwas still meaningless. We quicklyfound out that the measured values
were invariably negative instead ofpositive, and the microprocessorprograms was known to turn anynegative value into a solid zero. Intheory, this can happen if thephase of the synchronous detectorhas been swapped over. After a lotof searching and debating, weagreed that that was not the case.Wild theories were heard then inthe lab, until it transpired that theswitch selecting between capaci-tance and ESR measurement wasincorrectly wired, causing a mightyoffset in the detector. Nobody hadthought of such a simple exchangeof two wires!
The moral of the story: always checkobvious matters first. Do not fear theworst and certainly do not digdeeper than necessary!
Keep smilingEven if we run intomajor problems in ourlab we always try tosee the positive side ofthings if only to con-vince ourselves that atroublefree life would beboring. EngineeringFlemming JensensESR/C Meter from blue-print right up to publica-tion in print was a farfrom smooth process andwith hindsight we haveto admit having made anerror or two whenassembling the proto-type. Nothing too seri-ous of course, but still
9/2005 - elektor electronics 35
-
36
HANDS-ON TEST & MEASUREMENT
recommended components are used.However, the performance is stillacceptable with a normal 4066.
Compact constructionThanks to the use of two microcon-trollers, the size of the overall circuitremains relatively small, so the printedcircuit board designed for the circuit(Figure 5) has quite modest dimen-sions.There are only a few components thathave to be connected to the circuitboard via short leads. The LCD moduleis connected to K1. Switch S1, which isused to select either capacitance orESR measuring mode, is wired to con-nector S1 on the circuit board using sixshort leads. Points C+ and C are con-nected to two measurement terminalsor sockets located on the front side ofthe enclosure. The pins marked Sig-nal+, Signal, Sense+ and Sense arefor connecting the additional ESR testleads with their separate sense lines inorder to measure capacitors while theyare still connected in a circuit (see Fig-ure 6).The battery and power switch S2 (BT1and S2, respectively) must also be con-nected to the circuit board, as well asthe beeper (BZ1).
Test probesFour-wire measurement is used here tocompensate for the voltage drop in thetest leads. Each of the test leads hastwo screened conductors, consisting ofa signal lead and a sense lead (seeFigure 6). This prevents the measure-ment from being corrupted by hum,noise or ESD interference and allows astable zero calibration to be imple-mented.
Calibrating the ESR meterThe offset is set to 40 mV instead of0 V because the ADC cannot handlenegative voltages. Short the testprobes together and connect a volt-meter to pin 7 of the LF412 (IC7). Thenadjust P1 for an offset voltage of 40 mV.The resulting offset can then be com-pensated by the software. However,that requires shorting the probestogether when the meter is switchedon in the ESR mode. The offset voltageis converted by the ADC. The resultingvalue is stored in an EEPROM and sub-tracted from the measured ESR valuewhen a measurement is made.Switch the meter to the ESR mode and
Probe 1
max. 0.5 m
012022- 15
A
B
Probe 2C
D
Things to payattention to Always discharge the capacitor beforeconnecting the meter to it.
Switch on the meter before connectingit to the capacitor to be measured.
Four measurements are made oncapacitors with values greater than10 mF. After that, the meter displaysReady, and it must be switched off andback on to make a new measurement.
Be patient when measuring capacitorswith very large values. It takes approxi-mately 10 minutes to measure a 370-mFcapacitor.
WarningAlthough the inputs of the meter are pro-tected by diodes, it is good idea to dis-charge large capacitors before measuringthem. The risk of burning out the protec-tion diodes is particularly high with fil-ter/buffer capacitors used in power sup-ply circuits.
Figure 6. How to build the two dualshielded measurement leads that connect
the probes to the actual instrument.
switch on the power. You can use P5 toadjust the contrast of the LCD module.Short the probes together when youare requested to do so. Now connectthe probes to a 10- resistor andadjust P6 until the display shows avalue of 10 . Connect the meter toseveral working capacitors in turn,without and without a 10- resistor inseries, to verify that the meter is work-ing properly.
Calibrating the capacitance meterYou need a pair of precision capacitorsto calibrate the capacitance meter. Avalue of 470 pF / 1% is suitable for thepicofarad range, and a value of220 nF / 1% can be used for the nano-farad range. Both values can beobtained at a reasonable price fromvarious vendors, such as Farnell. Donot use values of 1000 pF or 1000 nF,since that can cause the display toflicker between 999 pF and 1.00 nF or999 nF and 1.00 F, respectively. Theeasiest way to adjust the range above10 F is to use a commercial capaci-tance meter. An alternative method isto use the formula t = RC and a simplestopwatch.Keep the meter away from transform-ers and strong 50- (60-) Hz fields.Switch on the meter, connect it to the470-pF capacitor, and use P2 to adjustthe value on the display to match thevalue of the capacitor. Next, connectthe meter to the 220-nF capacitor anduse P3 to adjust it to the right value.Finally, you can use P4 to set the rightvalue for your reference electrolyticcapacitor.After that the meter is ready for use.From now own, no capacitor new, oldor NOS (new old stock) will hold anysecrets for you.
(040259-1)