This is only a preview of the January 2025 issue of Silicon Chip. You can view 38 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 "Digital Capacitance Meter":
Items relevant to "Compact HiFi Headphone Amp":
Articles in this series:
Items relevant to "Gesture-controlled USB lamp":
Items relevant to "BIG LED clock":
Items relevant to "40A Current Probe":
Items relevant to "Battery-Powered Model Train":
Items relevant to "TCS230 Colour Sensor":
Purchase a printed copy of this issue for $13.00. |
Project by Stephen Denholm
This straightforward piece of test
equipment measures capacitor
values over a wide range, from about
10pF to 10,000μF (10mF). It’s easy to
assemble with all through-hole parts,
fits into a UB1 Jiffy box, and won’t
break the bank either.
I
Digital
Capacitance
Meter
occasionally need to measure values of
large electrolytic capacitors (up to at
least 6800µF) but have been restrained
by the limited capacitance measurement ranges of the DMMs I have. To
overcome this, I’ve resorted to setting
up a test circuit using a digital oscilloscope to measure a capacitor’s value
by measuring their charge time.
This worked well but was time consuming. I explored Silicon Chip magazines looking for a relatively simple
capacitance meter project that I could
expand my development skills on and
build. I found quite a few articles on
the subject, ranging from very simple
to quite advanced designs.
Of particular interest was the Circuit Notebook item “PIC capacitance
meter measures charging time” by William Andrew (July 2008; siliconchip.
au/Article/1874). It was a little too
siliconchip.com.au
basic for my requirements, but I liked
the relatively simple design concept,
which appeared to work.
I therefore decided to develop a
similar design that was also PICbased, would use the charging time
measurement concept, was relatively
simple to build and compact, covered
a range from about 10pF up to about
10,000µF, and was powered by a standard 9V battery.
I was also inspired by Jim Rowe’s
article on low cost 1.3-inch OLED displays in October 2023 (siliconchip.
au/Article/15980). I thought I would
have a go at also incorporating one
of those low-power display modules
into my design.
Circuit details
As shown in Fig.1, my circuit
uses an 8-bit enhanced mid-range
Australia's electronics magazine
PIC16F1847 microcontroller unit
(MCU). It has three capacitance ranges
selected by switch S1 and shows the
measured value of the capacitor under
test (Cx) on the 1.3-inch OLED display
(MOD1). The OLED is also used to
display any over/under range or battery voltage warning messages that
are necessary.
The measurement operating
sequence is commenced by pressing pushbutton switch S3. The MCU
will then first ensure that Cx is fully
discharged by switching on Q4 for
a short period, then off, discharging
it via the 33W resistor. It then starts
charging capacitor Cx via one of Mosfets Q1, Q2 or Q3 and the associated
series resistance.
At the same time, it starts the MCU’s
16-bit Timer1, which operates with a
counting interval of 1µs. The charging
January 2025 27
voltage developed across Cx is then
measured by the MCU’s Comparator1
positive input (C1IN+, pin 2) and compared to the voltage applied on its negative input C12IN0− (pin 17).
As soon as the charging voltage
exceeds the voltage at C12IN0−, the
comparator stops Timer1, initiates a
program interrupt and passes control
back to the main program, where the
Timer1 count register values are used
to calculate the capacitance.
As the source voltage for charging
Cx is the 5V Vdd supply, the comparator C12IN0− input is set to 63.2% of
Vdd, nominally 3.16V. This ensures
that the comparator operation and
hence measurement time will always
be equivalent to one RC time constant
of the capacitor under test.
That simplifies the calculation to
Cx = Timer1 count (µs) ÷ selected
range series resistance, scaled accordingly. For the Lo, Mid and Hi capacitance ranges, the MCU calculations
use series resistance values of 2MW,
25kW or 500W, respectively. It also
means that, even if the output of the
5V regulator drifts with temperature
or time, the measurements should
remain accurate.
The actual values used in the circuit are provided by the fixed/variable
resistance combinations VR1 + 1MW,
VR2 + 12kW and VR3 + 500W, which
are switched into or out of circuit by
the MCU via Mosfets Q1, Q2 and Q3.
I used P-channel SMD devices as, particularly for the Hi range, they need
28
Silicon Chip
low on-resistances to slightly improve
the measurement accuracy.
Suitable PNP transistors such as
BC858s with base resistors of say 1kW
to 3.9kW may work reasonably well,
but with a small reduction in measurement performance. However, I have
not tried that arrangement.
re-compiling the code and uploading it to the MCU if necessary. I did
briefly think about adding an auto-
zeroing function to the meter design
but decided it wasn’t worth the extra
effort for my particular requirements,
especially if I always stick to using the
same meter leads.
Performance
Construction
Performance-wise, my meter has
been providing quite accurate and
repeatable results across all three
ranges. I have confirmed this occasionally by checking the meter’s range
extremities against the calibration
capacitors that I now keep for such a
purpose. On the Lo range, it is necessary to keep the meter leads short to
minimise any stray capacitance.
In the MCU program code, I have
allowed compensation for zero-offset
in the Lo range calculations, which
significantly improves the capacitance
measurements for values below 1nF
and surprisingly allows the meter to
achieve quite accurate and consistent
results down to about 10pF.
This zero-offset value compensates for some inherent MCU program
instruction cycle time, which starts to
dominate the measurements for very
short capacitance charging durations.
It also compensates for the stray capacitance inherent in the physical construction of the meter and the short
leads I use.
The zero-offset value is hard-coded,
but it is not too difficult to change by
The board, coded 04111241 and
measuring 80 × 100mm, is a double-
sided design, but there are only a few
top-layer tracks that can easily be
replaced by wire links, as you will
see in the photo of my prototype. So
if you are etching the board yourself,
start by fitting the four wire links you
can see in that photo; they are also visible as top-layer tracks in the overlay
diagram, Fig.2.
Also note that there are four SMD
components that mount on the underside: Mosfets Q1-Q3 and regulator
REG1. They are shown in ‘X-ray’ fashion in Fig.2. Start by soldering them
in place while the board will still fit
flat on your bench.
Q1-Q3 are all the same types and
REG1 is in a different package, so it
should be obvious which goes where
and in what orientation. Do make sure
that the leads are sitting flat on the
board before soldering and not sticking up in the air, which would indicate
that the part is upside-down.
Tack each part by one pin and
check that all the leads are over the
matching PCB pads. If not, remelt that
Australia's electronics magazine
siliconchip.com.au
Fig.1: the circuit diagram for the
Capacitance Meter. S1 is used to
switch the capacitance range.
joint and gently nudge it into place.
Once it’s properly aligned, solder the
remainder leads and then refresh the
first joint.
Next, flip the board over and solder all the resistors in place. They are
mounted with the leads bent quite
close to the bodies. Follow the overlay
diagram to see which values go where.
There is just one diode, so fit that now,
making sure its cathode stripe goes
towards the top edge of the board as
shown in Fig.2.
You don’t have to use a socket for
IC1, but it makes it easier to swap that
chip if that ever becomes necessary.
Solder either the socket or IC1 directly
to the board, but in either case, make
sure it is orientated with its notched
(pin 1) end towards the top of the PCB.
Solder terminal block CON1 in place
now. We recommend that its wire entry
holes are kept towards the left-hand
side, although you can insert the wires
from either end.
Next, fit the headers (CON2-CON6),
100nF capacitor (which is not polarised) and transistor Q4 (orientated
as shown). Note that CON4 is only
required if you plan on (re)programming IC1 in-circuit. You could leave
the other headers off and solder wires
directly to the board, but we suggest
using headers to make assembly (and
if required later, disassembly) much
easier.
Mount the four trimpots next, making sure the adjustment screws all go
towards the bottom of the board as per
Fig.2: the overlay/wiring diagram for the Digital Capacitance Meter. Check
your OLED pinout before wiring it up; the 5V pin is at the top of CON5.
siliconchip.com.au
Australia's electronics magazine
January 2025 29
Fig.2. They are all different values, so
don’t get them mixed up.
Now solder the two electrolytic
capacitors in place, ensuring that the
longer (positive) lead goes into the
bottom hole in each case. The negative striped ends of the cans should be
near the top edge of the PCB.
PCB pins for test points TP1 and TP2
are not strictly required if you have a
double-sided board, as you can simply insert DMM probes into the plated
through-holes. If you have a single-
sided board, you will need to solder
PCB pins into the two test point holes.
Rotary switch
The last part to mount directly to the
PCB is the rotary switch. It is a twopole type. As supplied, it will probably have six positions, but we only
need three. To change that, undo the
nut and remove the washer from the
shaft. Prise up the stop washer and
rotate the switch fully anti-clockwise,
then re-insert the stop washer with its
pin going into the second hole between
the moulded “3” and “4”.
Check that it now only switches
through three possible positions. If
not, change the position of the stop
washer and try again. Once it’s correct,
put the lock washer back over the shaft
and tighten the nut on top.
In my build, the switch shaft length
as supplied was just long enough to
Figs.3 & 4:
the cutting
diagrams
for the base
and lid of the
Jiffy box. You
have some
flexibility
with the
locations
cutouts on the
lid, as they’re
mounted off
the board.
All diagrams
are shown
at actual
size, and all
dimensions
are in
millimetres.
30
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
pass through the front panel with
enough poking through to attach
the knob. The exact length required
depends on the height of the spacers
used to mount the PCB in the box and
the knob you’re using.
Ideally, you should temporarily
mount the PCB in the box so you can
check how much to cut off (if any). To
do that, you will first need to drill PCB
mounting holes in the base of the box
and at least one hole in the lid (for the
rotary switch shaft). The PCB mounting hole positions are shown in Fig.3
and the lid holes in Fig.4.
With the shaft cut to length, remove
the PCB from the box and solder the
switch to it. There are two possible
orientations, so match the switch to
the photos and overlay.
The next job is to mount the remaining parts on the front panel/lid and solder wires with female DuPont headers ready to plug into the headers on
the PCB. If you haven’t already, finish
making the holes in the lid as per Fig.4,
after reading the next two paragraphs.
Regarding the OLED screen, you can
see from the photos that I used countersunk head screws, Nylon washers
and nuts to mount it to a clear acrylic
sub-panel, then glued that panel to the
inside of the lid using epoxy. I did it
this way as the acrylic panel provides
some protection for the OLED screen;
the screw heads are hidden under the
front panel label.
You could use the same approach,
or mount the OLED directly to the lid
using the holes shown in Fig.4. However, if you do that, note that even if
you countersink the holes on the outside, the screws will probably still
project above the surface of the lid
due to its thinness. You may be able
to cover them with a label but it’s better to use my approach, if possible, if
you want a flat panel label.
If you use my approach, use washers to space the OLED screen from
the acrylic panel so the screen isn’t
crushed when you tighen the screws.
Strip off pairs of DuPont jumper
wires from the ribbon for the 9V battery snap and switches S2 & S3. Strip
off a set of four for the OLED. Cut them
so that you have bare wires on one
end, then solder them to the panel-
mounting parts (check the OLED pinout with reference to Fig.2). For the
two banana sockets, use medium-duty
hookup wire (or similar) in two different colours instead.
1 single- or double-sided PCB coded 04111241, 80 × 100mm
1 UB1 Jiffy box
1 panel label, 100 × 160mm
1 1.3-inch (33mm) 128×64 pixel I2C OLED display module (MOD1)
[Silicon Chip SC5026 or SC6511]
1 3mm clear acrylic sheet of ~43 x 41mm (for mounting the OLED module)
1 2-pole sealed rotary switch (S1) [Altronics S3022, Jaycar SR1212]
1 miniature panel-mount SPST toggle switch (S2)
1 panel-mount momentary NO pushbutton switch (S3)
[Altronics S0960, Jaycar SP0700]
1 small-to-medium knob to suit S1
1 2-way 5.08mm pitch terminal block (CON1)
3 2-pin headers, 2.54mm pitch (CON2, CON3, CON6)
1 5-pin header, 2.54mm pitch (CON4; optional, for ICSP)
1 4-pin header, 2.54mm pitch (CON5)
1 red panel-mount binding banana socket
1 black panel-mount binding banana socket
1 pair of banana plug to crocodile clip test leads
1 2MW top-adjust multi-turn trimpot (VR1)
1 20kW top-adjust multi-turn trimpot (VR2)
1 500W top-adjust multi-turn trimpot (VR3)
1 50kW top-adjust multi-turn trimpot (VR4)
1 18-pin DIL IC socket (optional)
1 9V battery snap
1 9V battery retaining clip
1 9V battery
5 M3 × 6mm panhead machine screw
8 M3 × 6mm countersunk machine screw
4 M3 × 10mm tapped spacers
4 Nylon M3 washers
5 M3 hex nuts
10 short (~100mm) female/female DuPont jumper leads, joined in a ribbon
2 100mm lengths of medium-duty hookup wire (red & black)
1 100mm length of 1.5mm diameter black/clear/white heatshrink tubing
2 PCB stakes/pins (optional)
Semiconductors
1 PIC16F1847-I/P 8-bit microcontroller programmed with 0411124A.HEX,
DIP-18 (IC1)
1 AMS1117-5.0 or similar 5V 1A LDO linear regulator, SOT-223 (REG1)
3 AO3401(A) or SQ2351ES P-channel logic-level Mosfets, SOT-23 (Q1-Q3)
1 BC337 45V 800mA NPN transistor, TO-92 (Q4)
1 1N5819 40V 1A schottky diode (D1)
Capacitors
1 470μF 10V radial electrolytic
1 100μF 10V ±5% tantalum [Vishay Sprague 293D107X5010D2TE3]
1 10μF 50V radial electrolytic
1 2.2μF 50V ±5% MKT [TDK B32529D0225J000]
1 100nF 50V ceramic or multi-layer ceramic
1 100nF 63/100V ±5% MKT [Altronics R3025B, Vishay BFC237012104]
Resistors (all ¼W 1% axial)
1 1MW
1 27kW
1 22kW
1 15kW
1 12kW
10 10kW
1 4.7kW
1 1kW
1 270W
1 33W
siliconchip.com.au
Australia's electronics magazine
Parts List – Digital Capacitance Meter
January 2025 31
You can then plug everything into
the headers on the PCB, using Fig.2 as
a reference, and screw the two banana
socket wires into the terminals of
CON1. Ensure the wire routing is correct for the 9V battery, OLED screen
and wires to CON1.
With IC1 out of its socket, switch on
power and check the voltage between
pins 5 and 14 of that socket. You
should get a reading between 4.5V
and 5.5V. If not, switch off and check
for faults.
Assuming it’s close to 5V, switch off
and insert IC1 in its socket, ensuring
it has the correct orientation and that
none of the leads fold up under the
body when you do so.
If IC1 has not been programmed,
you can now power the device back
on and connect an in-circuit programmer to CON4, with its pin 1 marking
to the left as shown. Use software like
Microchip’s free MPLAB IPE to load
the HEX file, which you can download from siliconchip.au/Shop/6/532
You can then switch it back on and
check that the screen display comes
up normally. If so, you can proceed
with calibration. Otherwise, power it
off and check your soldering and parts
placement.
Calibration
To initially calibrate the
meter, set the voltage
at test point
TP1 (IC1’s negative comparator input
voltage) to 3.16V by adjusting trimpot
VR4. There is no ground test point;
you could use negative (bottom) terminal of CON1.
Next, for each range in turn, make
repeated capacitance measurements of
a calibration capacitor of known value
while adjusting the selected range
trimpot (VR1-VR3) to progressively
obtain a calibrated value very close
to the known capacitances.
The parts list includes suggestions
of three low-cost 5% tolerance capacitors that could be used, although
sourcing the larger values may not be
easy (DigiKey and Mouser have suitable parts).
Cycle through the ranges and adjust
each to get the correct measurement
until you are only making minimal
adjustments.
In operation, once the measurement
and calculation of the capacitance
is completed, the MCU displays the
value on the OLED in units of either
pF, nF or µF depending on the range
selected and size of the capacitor
under test. If the measured value is out
of range, a warning is shown to select
a higher or lower range if possible.
Also, before any measurement of
Cx commences, the MCU checks the
battery voltage and a warning message
appears if it is low. If the voltage is too
low (less than about 7V), a message
to replace the battery is displayed
and measurement stops.
Conclusion
Having built, tested and
calibrated my meter, I
decided to check
my stock of
electrolytic
capacitors.
32
Silicon Chip
The finished Digital Capacitance
Meter with crocodile clips attached
(shown below). Our version of the
front panel label (shown here at
50% actual size) will be available
to download from our website at
siliconchip.com.au/Shop/11/585
I found some relatively new, unused
electrolytic capacitors with values
nowhere near their labelled value and
not within the specified tolerance. In
fact, I would say these capacitors had
been incorrectly labelled or manufactured, as they were that far out!
This was rather concerning as these
components had been sourced from
reputable suppliers. Buyer beware,
as they say!
I built the Touchscreen Wide-Range
RCL Box (June 2020; siliconchip.au/
Series/345) a few years ago now. I’ve
found it to be a very handy device.
When I first built it, I thoroughly
checked all the resistance values and
found these to be well within the ±1%
tolerance, which was great. However,
I did not check the C and L values.
So, out of interest, I decided to do
a quick check on the capacitance values with my new meter. Surprisingly,
I found two capacitors well outside
(>30%) the ±10% tolerance I was
expecting, even though I’m sure I had
purchased SMD capacitors with specified tolerances of ±10% or better. I
also performed a check with a DMM
on capacitance range and got very similar results.
I’m now waiting on a rainy day to
do some further diagnostics on the
RCL box.
SC
siliconchip.com.au
|