This is only a preview of the January 2018 issue of Silicon Chip. You can view 37 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 "Make your own Theremin – then make music!":
Items relevant to "The Lathe-E-Boy: high power Lathe Controller":
Items relevant to "Arduino LC Meter Shield Kit":
Items relevant to "High Power DC Fan Controller has loads of applications":
Items relevant to "El Cheapo Modules 12: 2.4GHz Wireless Data Modules":
Purchase a printed copy of this issue for $10.00. |
The Altronics Arduino LC
Meter Shield Kit
Altronics have just released a
complete shield kit based on Jim
Rowe’s Arduino LC Meter from
the June 2017 issue (siliconchip.
com.au/Article/10676). It includes
all the parts needed to build it on a
custom shield for Arduino, which
makes building it that much easier. It
even has the ability to auto-calibrate
and detect if you have an inductor or
capacitor connected.
T
his Altronics kit (Cat K9705)
comes with everything you need to
build a standard-sized Arduino shield
(70 x 54mm) which incorporates all
the functions of the Arduino LC Meter.
The kit is sold for $26.95 and the
only parts that aren’t included are
the Arduino itself and an enclosure
to put it in.
The new feature of this kit, mentioned in the introduction, is automatic detection of the type of component being tested. Jim’s design for the
LC Meter included a toggle switch to
select between inductance and capacitance measurement modes.
The Altronics shield uses a relay instead, under control of the Arduino,
and it automatically detects when it
needs to switch modes to suit the component you have connected across the
test terminals.
To make construction easier and the
final result a bit more streamlined, the
Altronics shield also uses a different
approach to calibration. Rather than
providing a switch and link to make
fine tuning adjustments, you can do
By Bao Smith
this over the USB serial console, if
necessary. Or you can skip that step
and just use it with the default calibration which is normally pretty accurate.
You will want to put it in some kind
of enclosure to make it handy to use
(as well as making it look more professional).
You could build it into a jiffy box
like Jim did in the June issue. Or you
could put it into the spiffy instrument
case that’s supplied with the Altronics
Mega Box kit that was described last
month, with pre-cut holes for the LCD,
USB/power supply and test terminals.
Circuit changes
Shown above are all the parts that come with the LC Meter Shield. The resistor
values are not marked on the PCB, so refer to the overlay diagram (Fig.2) for
clarification. Newer versions of the board will have the resistor values printed.
44
Silicon Chip
Celebrating 30 Years
The shield circuit diagram is shown
in Fig.1. This also shows how it interfaces with the Arduino. If you compare
this to our original circuit on page 30
of the June 2017 issue, you will see
that there are two main differences.
Firstly, this shield does not include
momentary toggle switch S3 or calibration link LK1 from the original
design. As mentioned above, calibration is performed via the serial interface from a PC instead, saving on the
cost and the space required for those
components.
The other difference is that DPDT
toggle switch S1, which was used to
switch between inductor and capacitor mode, has been replaced by DPDT
siliconchip.com.au
Fig.1: complete circuit diagram for Altronics’ LC Meter Shield. The LCD module is hooked directly to the shield,
compared to using the I2C serial module shown in the original June 2017 article.
relay RLY2, as mentioned earlier. RLY2
is driven by NPN transistor Q1 and has
its coil back-EMF quenched at switchoff by diode D2.
Because the switch is now activated
by the Arduino, there’s no need for
the Arduino to sense the position
of this switch. In fact, input pin D2,
which was used previously to sense
the position of the switch, is now an
output which drives transistor Q1 to
energise the relay when measuring
inductance.
The basic operation of the circuit
is still the same; the resonant LC network formed by L1 and C1 is driven
by an inverter built around high-speed
comparator IC1 and oscillates at a frequency dependent on the values of
those components.
The DUT is connected either in
parallel with C1 (if it’s a capacitor) or
in series with L1 (if it’s an inductor)
and the shift in oscillator frequency
is used to calculate and display the
component value.
The final difference you will notice
is that the Altronics design does not
require the alphanumeric LCD to have
an I2C interface module attached. It instead drives the LCD module using the
standard old 4-bit parallel interface.
Again, this saves you a little monsiliconchip.com.au
ey and time and it’s possible because
the Arduino has plenty of free pins to
drive the display in parallel mode. It
does require a few more wires to be
run but it isn’t hard, as you will see.
Only a small change to the program
was necessary to allow this and you
could change it back if you really wanted to use a serial LCD instead.
Construction
The biggest advantage of using the
Altronics shield kit, besides not having to collect all the parts yourself, is
that you don’t have to do as much wiring since the PCB connects up all the
components for you.
You just need to solder the supplied
components onto the PCB, plug it into
your Arduino, wire up the LCD, program it and away you go.
While all the supplied components
are through-hole, a fine tip solder iron
will help as some of the pins are a bit
close together.
Use the overlay diagram, Fig.2, as
a guide to mounting the components.
Start by fitting the low-profile components first (ie, the resistors and diodes). Be careful with the orientation
of the diodes; they face in opposite directions, so pay attention to Fig.2 and
the PCB silkscreen.
Celebrating 30 Years
We also recommend that you check
the resistor values with a multimeter
before fitting each one.
Solder the two 1nF MKT capacitors
(C1 & C2) next. We found they were a
little too wide to fit flush to the board
but you can bend the pins slightly to
help them fit.
We have been told by Altronics that
the next batch of PCBs will fix this, but
it’s not a big problem.
Follow by mounting the single
100nF multi-layer ceramic capacitor
(C5). The MKT and ceramic capacitors are not polarised.
Next, solder the two relays and the
IC socket. All three must go in the right
way around, as shown in Fig.2. BC337
transistor Q1 should be fitted next;
note that it is mounted quite close to
the adjacent relay but it will fit.
It’s then time to solder in the four
long-pin headers, with the long pins
poking out through the underside of
the shield board. This is a little fiddly
since you need to solder around the
bases of the pins but it isn’t too hard
if you use decent solder.
You can also solder the 2x3 dualrow pin header at this point; it’s the
only component that’s mounted on the
underside of the board, with the pins
soldered on the top side.
January 2018 45
Fig.2: PCB overlay for the LC
Meter Shield from Altronics.
Take care to note orientation
of the components when
applicable, and the values
of the resistors as they aren’t
marked on the board.
Make sure to not confuse the
47kW and 4.7kW resistors as
their colour band codes are
quite similar.
Finally, fit the two tantalum electrolytic capacitors (C3 & C4) and inductor
L1. Take care with the orientation of
the capacitors since it is critical; the
printed label on the capacitor body
will have a + sign indicating the positive lead and this must be soldered to
the positive pad as indicated in Fig.2.
In other words, the capacitors
should be soldered with their positive leads facing in towards each other.
Check your soldering carefully,
then plug IC1 into its socket (being
careful not to bend any of its leads
underneath the IC) and you are ready
to plug the shield into your Arduino
board.
Before you can program it, though,
you will need to attach the LCD panel.
Unlike Jim Rowe’s version of this project, this one does not use an I2C adaptor for the LCD.
So rather than having four wires,
two for the power supply and two
for the I2C bus (SDA/SCL), this one
requires all sixteen pins of the LCD
module to be wired up.
However, because it’s being driven
in 4-bit mode, about half of them are
connected to ground.
The required connections are shown
in the circuit diagram; the final software may change some of these pins,
so double check that your pin connections agree with the software.
Fitting it in the Mega Box
One thing to keep in mind is that
if you are building this unit using the
Altronics Mega Box described last
month, a 10kW contrast adjustment
trimpot is provided on the board.
The Mega Box also has pins 1 (GND),
2 (Vcc), 5 (R/W), 15 (BL+) and 16 (BL-)
already connected.
If you’re not using the Mega Box,
these spare pins will need to be connected before the display will work
properly; similar to what is shown
in Fig.1.
Note though that pin 16 on the Mega
Box is wired up to transistor Q3 and
you will need to connect its base drive
to +5V to enable the backlight.
Wiring up the LCD screen may seem
daunting but all the other connections are taken care of by the shield,
so once you have done this, you’ve almost finished.
The easiest way to wire the screen
up is to use male/female jumper leads;
the female end can plug into the header
on the LCD and the male plug goes into
the relevant pin on top of the shield
or Mega Box header.
Note that you can’t easily run connections to the top of the shield in the
Mega Box or the lid won’t fit, as there
just isn’t enough clearance. So wire up
to the headers provided on either side
of the Arduino board instead.
The array of extra ground pins in
the Mega Box will come in handy for
connecting the unused LCD pins to
ground.
Software
The software for this shield is a
modified version of our LC meter code
from the June 2017 issue.
For further details on its operation,
refer to that article (see siliconchip.
com.au/Article/10676).
Like the original firmware, you need
to install two libraries before you can
compile the software: FreqCount and
LiquidCrystal_I2C. FreqCount is available from www.pjrc.com/teensy/td_
libs_FreqCount.html
You also need the LCD and LiquidCrystal Arduino libraries if you don’t
already have them.
Having loaded the libraries and
opened the sketch file in the Arduino IDE, plug your Arduino/Mega Box
into your PC using a USB cable and
upload the code.
Once loaded, the program should
go through the initial calibration, the
relays should click over and the LCD
should start showing a reading.
You can then connect a capacitor or
inductor between the test terminals
and wait a couple of seconds and you
should get a reading showing its value.
Using it
Here is an overview of the
Mega Box PCB shown in last month’s issue.
Note the repeated pin number 5 on the board (for any readers
who didn’t spot it last month) will be fixed in newer versions of this board.
46
Silicon Chip
Celebrating 30 Years
There are a couple of things you
need to note when using this device
and this applies to any L/C meter.
Firstly, the banana sockets make it
convenient to plug in a pair of alligator clip leads and these are then easy
siliconchip.com.au
to clip to the leads of the component
you want to test.
But keep in mind that such leads
will have some capacitance (a few tens
of pF, depending on how close together
they are) and some inductance (maybe
as much as 1µH).
So to accurately measure a small capacitance, make a note of the reading
before and after connecting the clip
leads to the test capacitor and then
subtract the stray capacitance from
the reading.
To accurately measure inductance,
connect the alligator clips together,
read off the inductance, then connect
them to either end of the test inductor
and subtract the earlier (stray inductance) reading.
If making a direct connection to the
test socket, simply touching the test
component leads to the contacts on
the sockets may not be good enough.
This could introduce enough resistance to throw the reading off. You need
to make sure the component leads are
pressed firmly into the test socket surface to get the best result.
Calibration
As stated above, the LC Meter Shield
automatically calibrates itself the first
time it is powered up. But if you need
to make adjustments to the readings
(eg, because you have a more accurate
reference meter), you will need to do
this using the serial console instead.
Parts List
1 double-sided PCB, coded K9705, 68.5 x 53.5mm
1 set of four Arduino stackable headers (1 x 10-pin, 2 x 8-pin, 1 x 6-pin)
1 2x3-pin dual-row female header (ICSP connector)
1 EDR201A0550 reed relay (RLY1)
1 2A 5V mini DIL relay (RLY2)
1 8-pin DIL IC socket (for IC1)
1 black PCB-mount banana socket (CON1)
1 red PCB-mount banana socket (CON2)
Semiconductors
1 LM311P high-speed comparator (IC1)
1 100µH inductor (L1)
1 BC337 transistor (Q1)
2 1N4148 diodes (D1,D2)
Capacitors
2 10µF 25V tantalum electrolytics (C3, C4)
1 100nF multilayer ceramic (C5)
2 1nF±1% MKT/MKP (C1,C2)
Resistors (all 0.25W, 1% metal film)
3 100kW (R1,R2,R4)
1 47kW (R5)
1 4.7kW (R3) 1 1kW (R7)
Once you’ve uploaded the code to
the Arduino from the IDE, you can
open the serial console by using the
CTRL+SHIFT+M key combination.
You can perform calibration with either an inductor or capacitor but you
must accurately know its value. Before
connecting it up, measure the stray inductance or capacitance of your test
set-up, as described above, and compensate for it.
1 6.8kW (R6)
This means adding the stray capacitance/inductance measured before
connecting the component to its
known value.
Now connect it up and wait for the
reading to stabilise. If it’s exactly right,
you don’t need to do anything.
Otherwise, in the serial console,
enter:
calibrate xxx.xxpF/nH
Here we used the Altronics LC Meter with alligator leads to measure a 150nF±10% capacitor, our Agilent LCR meter
recorded exactly 150nF for the capacitor. The leads by themselves measured roughly 30pF.
siliconchip.com.au
Celebrating 30 Years
January 2018 47
Here is the Altronics LC Meter
reading a 200µH toroidal inductor.
In comparison, our Agilent LCR meter read an
inductance value of approximately 204µH. Overall, not too bad
considering the difference in price of the two pieces of equipment.
in the place of xxx.xxpF/nH, enter
the value you computed above. For
example, if your component is 1.01nF
and you measured 23pF of stray capacitance, you would use “calibrate
1033pF” while if you have a 10.7µH
inductor and measured 300nH of
stray inductance, enter “calibrate
11000nH”.
You should get a confirmation on the
console and the reading on the display
should then update to be the correct
(computed) value.
That completes calibration.
Accuracy and drift
We found our uncalibrated test unit
to be within a few percent of the error
value for numerous components that
we tested, compared to the readings
on an Agilent LCR meter.
We believe some of this discrepancy is due to the fact that component
values can vary depending on test frequency and the Agilent meter uses a
lower test frequency than the Arduino
LC Meter. Varying the test frequency
on the Agilent LCR meter would often
cause the result to change.
As some readers have pointed out,
LC meters based on this design will
drift as they warm up.
The June 2017 article suggested rebooting the unit prior to taking subsequent measurements, which does help
as it gives it a chance to re-read the “no
test component” oscillator frequency.
Drift is almost entirely due to changes in the behaviour of the LM311 comparator as it heats up from its own dissipation (power consumption).
The other solution is to leave the
meter running for some time before
using it so that its temperature has
stabilised.
What could be improved?
We have some ideas as to how to
compensate for this temperature drift
but they require a more complex circuit. We may present an update at
some point in the future, should we
come up with a meter design that eliminates (or mostly eliminates) drift in
the readings.
An example could involve using a
thermistor or similar to monitor temperatures and then adjust the relay.
Alternatively, we could repeatedly
switch the device under test in and
out of the circuit and measure the
oscillator frequency shift, although
that would require more complex
circuitry.
On the functionality side, if you’re
using the Mega Box with the LC Meter
there is some direct functionality that
isn’t easily accessible.
As it stands, you can only calibrate
via the serial console, or let the software handle it automatically. However, with the Mega Box the rotary encoder could be used to handle nudging
the calibration value similar to how the
SPDT momentary switch was used in
the June 2017 project.
Then one of the other pushbuttons
could be used to zero out the calibration value, which can be helpful in
dealing with any drift.
This requires software changes, but
SC
they shouldn’t be too difficult.
Resistor Colour Codes
No.
3
1
1
1
1
48
Value
100kΩ
47kΩ
6.8kΩ
4.7kΩ
1kΩ
Silicon Chip
4-Band Code (1%)
brown black yellow brown
yellow violet orange brown
blue grey red brown
yellow violet red brown
brown black red brown
5-Band Code (1%)
brown black black orange brown
yellow violet black red brown
blue grey black brown brown
yellow violet black brown brown
brown black black brown brown
Celebrating 30 Years
siliconchip.com.au
|