This is only a preview of the March 2020 issue of Practical Electronics. You can view 0 of the 80 pages in the full issue. Articles in this series:
|
Analyse signal diodes, rectifier diodes,
Zeners, Schottkys, photodiodes,
LEDs... and more!
By
Tim Blythman
Diode Curve Plotter
Our new Diode Curve Plotter is a superb piece of test gear that is both
practical and educational. It’s very versatile and fits in the palm of your
hand. It automatically tests diodes in both directions and plots the
resulting current/voltage curve on a colour LCD screen. It tests zener
diodes up to about 100V, but it can also test LEDs, schottky diodes,
regular diodes, transient voltage suppressors and more.
T
here have been many diode
tester projects. Tyically, they
were rather simple and only
able to provide a measurement of, for
example, a zener voltage. Also, they
were often treated as an ‘add on’, and
required a separate multimeter to
display the result.
This new unit utilises the same 2.8inch colour LCD touchscreen used in
the Micromite BackPack from May
2017, but this time it’s being paired
with an Arduino Mega board and a
custom PCB, which provides the user
test interface.
What can it do?
The main feature of the Diode Curve
Plotter is that it performs a full bidirectional current/voltage (I/V) sweep
of a connected diode (or other component) and display the results in a
graphical form.
14
For zener diodes, the zener voltage
and current are displayed on the screen,
along with the zener impedance at that
point. You can move the test point to get
different voltage, current and impedance readings along the curve.
The unit can produce up to 100V at
up to 30mA for testing diodes, providing a wide testing range. For devices
like LEDs, you can limit the test voltage
and current to avoid damaging them
during testing. It also has a specific
LED testing mode, to make that job
even easier.
The plot data can also optionally be
sent to a connected computer as rows
of CSV (comma-separated value) data,
allowing plots to be stored and analysed further if necessary. You can plot
and analyse this data on your PC using
just about any spreadsheet program.
Getting back to the unit itself, cursors on its screen allow the operating
point to be varied, by selecting either
a voltage or current, so that the operating conditions can be examined across
the range of the plot. For example, you
could investigate how a zener diode
performs at points away from the ‘knee’
of the zener curve.
The hardware scans the diode in
both quadrants. It shows the full plot
on the display, but only the forward
operating point conditions are displayed in detail. A ‘Reverse’ button
allows the plot to be flipped so that
the reverse characteristics can be
checked without rerunning the test.
This is handy if the diode is connected
backwards, or to check its behaviour
in both forward and reverse directions.
The unit has adjustable current,
voltage and power-limiting parameters. But given that each test takes
a few seconds to complete, even if
these limits are set slightly high, any
Practical Electronics | March | 2020
over-current or over-voltage condition
is quite brief and unlikely to cause
any damage.
The LED test mode is essentially a
constant-current mode, which provides a set output current. It shows the
forward voltage, power and voltage/
current ratio for the connected device.
The current and voltage limits can
be set to the nearest milliamp and volt
respectively, so even unknown devices
can be probed without risk.
If a resistor is connected, the voltage/current ratio will, of course, correspond to the resistance, and thus the
diode tester can even be used as a very
basic ohmmeter.
How it works
The Diode Curve Plotter is a sandwich
of three boards: an Arduino Mega or
compatible board forms the bottom
layer and provides the processing
power. The LCD touch panel is the top
layer, providing the display and user
interface. In the middle, the custom
PCB contains the other parts, which
measure the parameters of the connected diode.
By the way, the reason we are using an Arduino Mega rather than an
Arduino Uno in this project is that we
need the extra Flash memory space provided by the larger chip on the Mega.
We are not using any of the extra pins.
High-voltage generator
As we noted, the unit can test diodes
up to 100V, but it runs from 5V DC,
so it needs a way to generate higher
voltages to apply to the device under
test (DUT).
The circuit diagram of the Diode
Curve Plotter is shown overleaf in Fig.1.
Inductor L1, N-channel MOSFET
Q1 and diode D1 operate as a standard
boost converter which is driven by IC2,
an LM311N comparator.
The plotter mounted in a
UB3 Jiffy Box, with a laser-cut front
panel to reveal the touchscreen display.
Practical Electronics | March | 2020
Features and specifications
• Tests zener diodes, LEDs, TVSs, silicon diodes, schottky diodes and more
• Colour touchscreen interface
• Tests up to 100V/30mA from 12V DC supply (can run from 5V, including USB)
• Automatically plots I/V curve in both quadrants
• Reads out current, voltage, power and impedance at any point in the curve
• Adjustable current/power limit for smaller devices with 0.4W and 1W presets
• Simple LED testing mode
• On-screen button to show reverse characteristics
• Based on an Arduino Mega with custom shield
It runs from a 5V DC supply, which
is convenient, because that means you
use a USB power bank, USB charger or
even a PC/laptop USB port. But note
that it may draw more than 500mA
when testing higher-voltage, higherpower devices, so a computer USB
port may drop its bundle under these
conditions. A 1A+ charger or battery
bank is recommended.
The boost regulator draws power
from the Arduino’s VIN pin, which
is connected directly to its DC power
jack. In case the unit is powered via
the USB socket instead, the 5V supply
flows through schottky diode D2 into
the VIN rail, thereby powering the
boost converter.
IC2, the LM311 comparator, is used
both as an oscillator to drive the gate
of MOSFET Q1 and also as a current
limiter. Note that an LM311 can only
sink current at its pin 7 output, so
pin D3 of the Arduino (‘BOOSTCTL’)
must be high to enable the oscillator.
This pulls pin 7 up via the 1kΩ resistor; normally, it is held low by a 10kΩ
resistor, so Q1 is off by default.
Since the Arduino’s D3 output is
capable of generating a low-frequency
PWM signal, we can switch the boost
circuit on and off rapidly with a varying duty cycle to control the resulting
boosted voltage.
The circuit around IC2 is not a fixed
oscillator; instead, it monitors the
current passing through inductor L1
using the 1Ω 1W series resistor. When
Q1 switches on, the voltage across the
1Ω resistor increases as the current
through L1 builds and its magnetic
field builds up, until the threshold
set by the comparator’s resistor network is reached. At this point, Q1 is
switched off.
The 100kΩ feedback resistor provides hysteresis, allowing the current to drop a small amount before
Q1 switches on again and the cycle
repeats. The resulting waveform has
a high duty cycle, as required for a
boost circuit with such a high output/
input ratio.
When Q1 switches off, the voltage at
the end of inductor L1 that’s connected
to its drain shoots up and so diode D1
becomes forward-biased, charging up
the 1µF capacitor to a much higher
voltage than the incoming supply.
This voltage is divided by 100kΩ
/3kΩ resistors, filtered by a 100nF capacitor and fed to analogue input ADC1
of the Arduino. The divider provides
a voltage which is within the 0-3.3V
range of the Mega’s analogue-to-digital
converter (ADC).
While the Mega’s ADC has a 0-5V
range by default, we are using its onboard 3.3V regulator as a more precise
reference, and so we can measure up
to around 108V with this divider.
Jumper JP1 usually feeds 3.3V into
its AREF pin.
This divider also discharges the
1µF capacitor so that its charge will
not persist after the boost converter
is switched off. With the capacitor
charged to 100V, the 100kΩ resistor
dissipates around 100mW, which
is well within the ratings of a small
1/4W resistor.
Note that the 13kΩ resistor connected to pin 2 of IC2 via a 10kΩ
resistor sets the maximum inductor
current (ie, in L1) which effectively
determines the maximum voltage that
the boost generator can produce, and
also affects the maximum current that
the unit will draw.
So if you want to reduce the
maximum test voltage (eg, to allow
the unit to run from a USB port that
15
+5V
+3.3V
1 0 0nF
MOSI
+5V
+5V
D/C
MOSI
SCK
LED
MISO
T_CLK
T_CS
T_DIN
T_DO
T_IRQ
SD_CS
SD_MOSI
SD_MISO
SD_SCK
4
RLYCTL
5
LCDDC
6
LCDRST
7
9
4
6
2
5
ADC3
ADC1
IO 5/PWM
ADC0
36k
IO8
IO 9/PWM
12
ARDUINO MEGA
OR EQUIVALENT
A
14
D2
K
1N5819
15
TP3
IO 11/MOSI
+5V
+3.3V
IO 13/SCK
RESET
A
K
+5V
SDA
TO LCD
SCL
IPA60R520E6
G
LK1
VIN
1 1W
VIN
IC2: LM311
10k
10k
62
2
3
5
6
8
IC2
4
1 0 k
A
100nF
10k
10k
TP1
L1
100 H
100k
7
Q1
IPA60R
520E6
1
62
D1
1N4004
D
S
TP2
CON1
1 F
250V
TEST
TERMINALS
OPTO1 PC817
2
D
K
1
100 F
4.7k
D1, D2
AREF
6x
1k
18
36k
GND
GND
17
1k
6
VIN
IO 12/MISO
16
IC1b
GND
IO 10/SS
13
4.7k
5
7
470
11
1k
2
4
MISO
10
IC1a
ADC2
IO 4/PWM
3
IO7
SCK
+5V
8
1
IO 6/PWM
LCDCS
8
ICSP
IO 2/PWM
IO 3/PWM
3
3
BOOSTCTL
ADC 5/SCL
ADC 4/SDA
DC VOLTS
INPUT
RESET
5x
470
2
IO 1/TXD
USB TYPE B
CS
IO 0/RXD
TOUCHCS
OPTOCTL
GND
1
1
CON2
VCC
IC1: LM358
MOD1
4
1M
1M
100k
30k
10nF
RLY1
3
10nF
30k
1k
3k
1 0 0nF
OPTO2 PC817
1
1 3 k
10k
2
4
IC1, IC2
3
100
SC ZENER/ DIODE /LED
Zener/Diode/LED
Curve
Plotter
CURVE
PLOTTER
20 1 9
PC817
+
4
8
1
4
1
2
Fig.1: the Diode Curve Plotter is based on an Arduino Mega (MOD1), a boost regulator (IC2/Q1/L1), two optoisolators
which operate as a controlled current source (OPTO1 and OPTO2) and a relay to reverse connections to the DUT (RLY1).
The test voltages and current are fed back to the Arduino so it can plot the curve and display measurements.
can only supply 500mA) then you can drop the value
of this resistor to 12kΩ or even slightly lower, down to
as little as 11kΩ.
Test circuitry
The test voltage is fed to the DUT via two optoisolators,
OPTO1 and OPTO2, and relay RLY1. At the other end, the
DUT is connected to ground via a 100Ω resistor.
OPTO1 and OPTO2 are configured as a controllable current source, with both collectors connected directly to the
high-voltage supply and both emitters to the DUT. Their
phototransistors are connected in parallel to enhance the
amount of current they can supply to the DUT.
Their LEDs are connected in series, so that the effective
current transfer ratio (CTR) is doubled. They are controlled
by a PWM signal from pin D10 of the Arduino which is fed
to the two 62Ω resistors. The 100µF capacitor smooths the
PWM signal, in combination with those resistors, so that a
steady, controllable current flows.
16
The modulated current goes to the DUT via relay RLY1.
When its coil is energised, it reverses the connections to
the DUT. The 100Ω resistor operates as a current shunt,
allowing currents up to 33mA to be measured against the
3.3V reference voltage. The voltage across this shunt is
monitored at the Arduino’s A2 analogue input.
In practice, while testing a device, the unit sweeps the
test voltage with the relay switched on, monitoring both
the current and voltage, then performs another sweep with
the relay switched off, so that current flows through the
device in both directions during a single test pass.
Measuring circuitry
Four main parameters are measured by the Mega’s internal
10-bit ADC. Two have already been mentioned: the voltage
on the 1µF capacitor and the test current, as measured using the shunt. The other two parameters measured are the
voltages at each end of the DUT. Both are fed into 1MΩ /30kΩ
voltage dividers, giving the same 108V maximum reading.
Practical Electronics | March | 2020
These voltages are fed into the two halves of IC1, an
LM358 op amp. By default, these are configured as unitygain buffers, with the 36kΩ resistor in the feedback path
having little effect. In this mode, voltages up to 108V can
be measured with around 0.1V resolution (108V / 210).
But there is also a 4.7kΩ resistor and 1kΩ resistor from
the inverting input of each op amp to two digital pins on
the Arduino. These are initially left floating, and in this
case, do not affect the op amp’s operation.
However, if either is pulled low by its corresponding pin
on the micro, that changes the op amp gain to either 8.66
(ie, 36kΩ÷4.7kΩ + 1) or 37 (ie, 36kΩ÷1kΩ + 1). This amplifies the sensed voltages, giving resolutions of around 10mV
and around 3mV respectively, with the maximum readings
being about 12.5V and 3V. So the gain is only increased
when measuring lower voltages, to improve resolution.
All ADC measurements are sampled 16 times and averaged to improve precision and stability. Any error due to
input offset will be taken care of during calibration stages.
Touchscreen interface
The touchscreen plugs into header socket CON2. The
screen is powered from the 3.3V regulated supply, while
the backlight is powered from the 5V rail. The Arduino
controls it over two SPI (serial peripheral interface) buses.
One is used for updating the screen and one for getting data
from the touch sensor.
Their MISO and MOSI (data) and SCK (clock) lines are
connected together to share the same set of hardware SPI
pins on the Arduino, via its six-pin ICSP header. The screen
and touch controller have separate chip select (CS) pins, at
pins 3 and 11 on CON2, so the Arduino can select which
one it is communicating with by pulling one of the two
digital outputs (D7 or D2) low.
These five lines, plus the data/control line on pin 5 of
CON2, have 1kΩ resistors connected from each pin to
ground, plus 470Ω series resistors between the LCD pins
and the Arduino. These form voltage dividers, reducing
the 5V swing on the Arduino outputs to a 3.3V swing, to
suit the LCD electronics. The MISO line is driven by the
LCD so no level shifting is needed, as the Arduino will
read 3.3V as a high level.
The remaining five pins on CON2, the interrupt request
line from the touch controller (T_IRQ) and the four SPI
control lines for the SD card socket are unused and so are
left disconnected.
Software operation
While testing, the boost converter is modulated by the
PWM signal from pin D3 to maintain a voltage at TP1 that’s
slightly higher than the desired test voltage, but within the
programmed limits. Then, the current through OPTO1/
OPTO2 is varied across the testing range.
The difference between the voltages measured at both
ends of the DUT, plus the current through the 100Ω shunt
are recorded in an array.
RLY1’s state is toggled to reverse the polarity of the DUT,
and the test is repeated, after which the results are plotted
in a graph on the screen.
The Arduino Mega interpolates the data points to find
the voltage and current at which the device power equals
the selected operating point. The relevant figures are then
shown in a small box on top of the graph, as well as drawing lines which show where that point is on the curve.
The box display includes the voltage, current and power at
the operating point, as well as the zener impedance, derived
from the gradient of the voltage/current curve at that point.
The raw I/V data is then dumped to the serial port, where
it can be read by the PC and used for additional analysis.
Practical Electronics | March | 2020
Screen1: the splash screen/main menu allows you to select
between the two different types of tests (I/V Test or LED
Test) and access the Settings and Calibration menus.
Screen2: the typical result of the I/V Test run on a 75V
zener diode. A 250mW operating point is identified and
indicated on the graph.
Screen3: here we have selected the I/V Test option with
an LED connected to the unit and it has performed the
measurements and plotted the graph. It’s showing that
10mW is achieved, a forward voltage of 2.05V and a test
current of 4.89mA.
The details of a second operating point can be analysed
by touching the graph along the right-hand axis. If the
graph is touched in the first quadrant (top right), then the
current level is selected according to the vertical position
of the touch.
A second info box is displayed, showing conditions at
the new operating point.
17
With more screen space available, the statistics are
shown in a larger font and they include voltage, current
and power at the instant of measurement, as well as the
ratio of voltage to current. This will not correspond to the
zener impedance, but will be a fair measurement of the
resistance of a fixed resistor.
Screen4: in the LED test mode, where the forward voltage,
current, power and zener impedance are continuously
updated. You can adjust the maximum voltage and current
applied to the LED directly with the arrows below.
Screen5: in the Settings screen, where you can select the type
of device being tested, the maximum power and the target
(nominal) power. The four buttons at the bottom change these
values, then you press the Back button when finished.
Screen6: the Calibration screen reads out one of seven
parameters, as measured by the Arduino, allowing you to
compare them to readings made with a DMM and calculate
coefficients to provide more accurate measurements.
Similarly, touching the graph in the fourth quadrant
(bottom right) sets the voltage according to the horizontal
touch position and displays a similar box.
The LED test page is much simpler, and in this mode
tests are run continuously. The current is modulated to the
limit set on that page, and the voltage is maintained within
these limits by controlling the boost circuit.
18
Construction
All of the components mount on a shield PCB, which
measures 99mm × 60mm, and is available from the PE
PCB Service (coded 04112181). Use the overlay diagram in
Fig.2 as a guide while building the board. Start by fitting
the small (1/4W or 1/2W) resistors where shown. It’s a good
idea to measure the value of each one before fitting, as the
colour bands can sometimes be ambiguous.
Solder diodes D1 and D2 in place next. They are different types and also oriented differently. Make sure that you
don’t mix them up and that the cathode stripes face in the
directions shown in Fig.2. You can then fit the larger 1Ω
1W resistor.
Now install the seven capacitors, making sure that for
the electrolytic types, the longer (+) lead goes into the pad
marked with a ‘+’ sign on the PCB overlay diagram and the
PCB silkscreen printing.
Since the LCD stacks above this board, all components
must project less than 12mm above the top surface of the
PCB. If any of your electrolytic capacitors are 12mm high
or taller, you will need to lay them over on their side when
you fit them.
Note that we give two options for the 1µF capacitor, a
polyester ‘greencap’ and an electrolytic type. While both
should work, we prefer using the greencap, despite the fact
that it needs to be installed with its leads bent over to keep
it under 12mm high. Greencaps have better performance
than electrolytics. But either should work, so it’s up to you.
Fit the two ICs next. They are different types but come in
the same package – don’t get them mixed up. Fig.2 shows
where they go and the correct orientation of each. Make sure
the pin 1 notch or dot is facing as shown before soldering
the pins. Then fit the two optoisolators, again taking care
that their orientation is as shown.
Now mount MOSFET Q1. You will need to bend its legs
90° to allow the body of the MOSFET to sit flat. Before attaching to the board with a 6mm machine screw and nut,
check whether that screw will foul the USB socket on your
Mega board once the two are plugged together. If so, you
will need to omit the mounting screw.
Once you’ve sorted that out, ensure the writing on the tab
is facing upwards and then solder its leads. Telecom-style
relay RLY1 is installed next, with its pin 1 stripe to the left
as shown. Then fit inductor L1, which is not polarised, so
its orientation is not critical. Ensure that it is not too tall
when installed; it may need to be laid on its side to keep it
under the 12mm limit. Then solder pin header JP1 in place.
The four SIL pin headers for connection to the Arduino
can all be snapped from a single 40-pin header. The easiest
way to mount them to the board is to plug them into the
Mega board, then slot the shield PCB over the top to ensure
that everything is square and flush before soldering them
in place. Note that they are inserted through the bottom of
the PCB and soldered on the top side.
Use the same technique to solder the 2×3 female header
to the board; again, it is mounted on the underside.
Note that you could use a stackable header set, such as
Jaycar’s HM3208, rather than the standard pin headers
specified. But that is likely to change the overall height
of the unit, and it may no longer fit in the specified case.
Use a similar technique to fit the 14-way female header
which connects the LCD to this PCB. It goes on top of the
Practical Electronics | March | 2020
board. Plug it onto the LCD header, then mount the
LCD on the shield board using three 12mm tapped
spacers and six 6mm-long M3 machine screws –
don’t attach it in the upper-right corner; there is no
spacer mounted near IC2. Then solder the header
in place.
The 2-way female header is used for CON1, which
connects to the device under test. We found this type
of header ideal for this purpose, as most smaller
component leads simply plug into the sockets.
However, you could chassis-mount banana sockets
instead, and wire them back to the pads for CON1.
You may wish to solder extension leads to the
pins of CON1 before fitting it, to make the top of the
socket level with the top of the LCD once assembly
is complete. That allows it to project through the
hole provided in the laser-cut lid. But if you do so,
insulate the wires with short pieces of heatshrink
tubing or similar, keeping in mind that there can
be around 100V between them during operation.
That completes the assembly of the shield board.
Once this is done, double check your soldering.
Given that the board can generate over 100V, you
don’t want a small error on the PCB to feed that back
into your computer. You may wish to use the USB
Port Protector we described in May 2019.
Unplug the shield/LCD assembly from the Arduino Mega now, as it’s best to keep the boards separate
until the Mega has been programmed, especially
if the Mega has previously been programmed for
another project.
Connect the Mega to a computer using an appropriate USB cable; most Megas have USB TypeB full-size sockets so you will need a Type-A to
Type-B cable.
Fig.2: this component overlay echoes the silk-screen printing on
the PCB surface shown below – between the two you should have
no problems constructing the shield.
Installing the software
To install the software on the Mega, you need the Arduino
IDE (integrated development environment) installed on
your computer. The IDE includes a compiler and serial
programming software, allowing the source code to be compiled and sent to the Arduino. The IDE can be downloaded
from www.arduino.cc/en/Main/Software
We are using Arduino IDE version 1.8.5, but a newer version
may be available by the time you check the download page.
Since we have written many of the libraries for this
project ourselves, we have included all the necessary files
in the sketch folder. Download the zip file from the March
2020 page of the PE website and extract the contents to a
suitable location such as your ‘Documents’ or home folder.
Open the Zener_Diode_Tester.ino sketch file using the
IDE. From the Tools menu, under Board, select ‘Arduino/
Genuino Mega or Mega 2560’. Then choose the appropriate
serial port from the Tools -> Port menu. Click Upload or
press Ctrl-U to start the compile and upload process. This
may take a minute or two.
Unplug the USB cable and place the jumper shunt over
the two pins of JP1 so that it is closed. Plug your shield
PCB onto the Arduino Mega and then attach the LCD to the
top of the PCB (if it isn’t already attached). You are then
ready for testing.
Testing and touchscreen calibration
Plug the USB cable back into the computer or if you have
a 12V DC plugpack handy, use it instead. Ensure that the
screen illuminates and displays the main menu page with
the SILICON CHIP logo. The Mega can have a start-up delay,
so don’t be alarmed if nothing happens for a few seconds.
The sketch is written with a default touch panel calibration.
Practical Electronics | March | 2020
Try pressing some buttons on the touchscreen and check
that they respond as expected. If you find that they don’t,
or the touchscreen calibration seems inaccurate, or it is
not responding to touch at all, you will need to use our
provided calibration sketch to calculate new touch panel
calibration parameters.
By the way, we’ve seen some 2.8-inch touchscreens
which look more or less identical to others but the touch
panel axes are reversed. If you have one of those, you will
definitely need to go through the calibration process.
To do this, open the AVR_LCD_BackPack_Touch_
Calibration.ino sketch and upload it to the Mega using
the instructions above. Open the Serial Monitor from the
Tools menu (or by pressing Ctrl-Shift-M) and set the baud
rate to 115,200.
Following the instructions on the screen, use ‘1’ (followed
by Enter to send the command) to perform the calibrations.
Then use ‘2’ to test that the new calibration is accurate.
Copy the new calibration constants from the Serial Monitor
to the clipboard, as shown in Fig.3.
Now re-open the original Zener_Diode_Tester.ino sketch
and open the backpack.h tab. Find the lines in the code
which are shown in Fig.4. Replace the existing calibration
constants with the new values you copied earlier, save the
updated sketch and then upload it to the Mega. You are
now ready for final testing.
Checking voltages and currents
Note as you read the following, that if you are using a
computer USB port to power the unit during testing and
calibration, some of the voltages mentioned below may
not reach 100V and the unit may reset, due to the limited
current capabilities of that port.
19
This photo, along with the one opposite,
shows how the three boards are
‘sandwiched’ together – the Arduino
Mega board on the bottom; the new
shield board in the middle (green) and
the 2.8-inch LCD touchscreen on top.
It is designed to fit in a UB3 Jiffy box
with a new laser-cut Acrylic lid. Note
the connectors on the Mega board in the
photo opposite – the USB on the left,
and the DC power input at right.
Start by clicking the Calibration button and use the Previous and Next buttons to scroll through the various items.
In the top-right corner, the display shows where to connect your multimeter test leads to read the appropriate
voltage. The second line indicates the name of the value
being tested. The third line indicates whether the test terminals should be open or short-circuited.
They should be short-circuited for the current test (eg,
using your DMM in current measurement mode); otherwise,
there is no path for the current to flow.
The first item to be checked is the output of the highvoltage generator, and this should be up around 100V, with
an ADC value in the 900s. If this is the case, the high-voltage
system is working. If not, check (after powering off the unit)
for wiring faults around the right-hand edge of the board,
particularly around Q1 and L1.
The next three items measure the voltage at the positive
test terminal with various gain settings. Using a DMM,
measure the voltage at the positive terminal of CON1
(shown in Fig.2 and on the PCB) relative to TP3 (GND)
and check that you get a reading that’s close to the one
shown on the screen.
The three following items are the negative test terminal
voltage at its three different gain settings. Use the same
technique as above to compare your readings to those shown
on-screen. Any significant deviation in these voltages from
reality indicates a problem in the vicinity of IC1.
The final item to check is the current reading, and as noted,
it will only work if there is a path for the current between
the test terminals. Switch your DMM to current (mA) mode
and connect it across CON1. The displayed current should
be around 30mA, with an ADC reading around 900. Compare
this to the reading on your DMM. It should be close. If you
don’t get any current reading or it is wildly off, then you may
have a problem with the circuit around the optoisolators.
To calibrate the unit, step through each reading and record the ADC value shown and an accurate measurement
of the voltage (or current) using your DMM. Then divide
the voltage or current value by the ADC reading, and write
this value down.
The unit is then calibrated by modifying the scaling
values in the sketch itself. This part of the code is shown
in Fig.5. It’s near the top of the file. Find those lines and
change the values to those you wrote down.
If the values you have are significantly different from
the defaults, you may have a problem with your board, or
you might have made a mistake in calculating these values.
Performing this calibration adjusts the software to be
accurate with the particular components on your board
(eg, the exact resistor values).
After the values have been edited, the sketch will need to
be uploaded again, as per the earlier instructions, to allow
the new values to take effect.
Completing assembly
Once you are satisfied that the unit is calibrated and working correctly, it can be fitted in its case. Start by removing
the screws holding the LCD screen onto the tapped spacers,
then temporarily unplug the screen.
Now plug the shield into the Arduino Mega and secure
the two together using the specified nylon machine screws
and nuts, through the mounting holes near Q1 (adjacent to
the Arduino SCL pin) and near the Arduino A5 pin.
Next, plug the LCD back into the shield but don’t attach
it using screws just yet. Slot the laser-cut lid panel over
the LCD screen, then feed 10mm machine screws through
Parts list – Arduino-based Multi Diode Tester
1 double-sided PCB coded 04112181, 99mm x 60mm (available from the PE
PCB Service)
1 Arduino Mega R3 board or equivalent [eg, Jaycar XC4420, Altronics Z6241]
1 2.8-inch LCD touchscreen [ILI9341-based touchscreen LCD panel, 320 x 240]
1 UB3 Jiffy box (included lid not required)
1 3mm laser cut Acrylic lid [SILICON CHIP ONLINE SHOP Cat SC4927]
1 2-pin female header (CON1)
1 14-way female header (CON2)
1 2-pin header with jumper shunt (JP1)
1 6-pin, 2 8-pin and 1 10-pin header (to connect to Arduino)
1 2x3-pin female header (to connect to Arduino ICSP header)
1 DPDT relay with 5V DC coil and 250VAC-rated contacts, DIP-10 (RLY1)
1 12V 1A (or higher) plugpack with centre positive 2.1mm tip
1 100µH bobbin type inductor (L1)
2 M3 x 20mm nylon panhead machine screws
3 M3 x 12mm tapped nylon spacers
Do not touch any component
4 M3 x 10mm panhead machine screws
leads while the unit is
7 M3 x 6mm panhead machine screws
operating. 100V is enough
2 M3 nylon hex nuts
to give you a bite!
2 M3 hex nuts
WARNING
20
Semiconductors
1 1N4004 400V 1A diode (D1)
1 1N5819 schottky diode (D2)
1 LM358 op amp, DIP-8 (IC1)
1 LM311N high-speed comparator, DIP-8 (IC2)
2 PC817 optoisolators, DIP-4 (OPTO1,OPTO2)
1 IPA60R520E6 700V N-Channel MOSFET (Q1)
[mouser.co.uk / digikey.co.uk]
Capacitors
1 100µF 10V electrolytic
1 1µF 450V electrolytic or
250V polyester ‘greencap’
3 100nF MKT or ceramic
2 10nF MKT or ceramic
Resistors (all 1/4W 1% unless otherwise stated)
2 100kΩ
2 36kΩ
2 30kΩ
2 1MΩ
1 13k
6 10kΩ
2 4.7kΩ
1 3kΩ
9 1kΩ
6 470Ω
1 100Ω
2 62Ω
1 1Ω 1W 5%
Practical Electronics | March | 2020
the panel and LCD, into the three tapped spacers below.
Use the fourth 10mm machine screw and single nut to hold
the lid onto the LCD screen using the remaining mounting
hole, in the upper-right corner.
If you aren’t planning to read measurement data out to a
computer via the serial port and you are using a plugpack
supply, then you only need to make a hole in the box base
for the DC power jack. Otherwise, you will also need to
make a cut-out to access the USB socket.
Make the holes in the lower half of the UB3 case using
the drilling diagram (downloadable from March 2020 page
of the PE website) as a guide. Finally, attach the lid to the
top of the box using the supplied self-tapping screws.
Using it
This device will test just about any type of diode, including
standard silicon diodes, schottky diodes, LEDs and unidirectional or bidirectional transient voltage suppressors.
Having connected the device to both of the test terminals,
press the I/V Test button on the screen.
You should hear two clicks and the graph will be displayed. If you have inserted the component backwards,
press Reverse to swap the plot around.
You can also touch the graph on the touchscreen to display
figures for various voltages and currents. Cursors appear to
show the point being touched and the relevant information
is displayed in a second box on the bottom left of the screen.
Pressing Back returns to the main menu page. From there,
press the LED Test button to start the LED test.
The voltage and current limits are set using arrow buttons
at the bottom of the screen. These are soft limits which are
controlled by the microcontroller, so the readings may occasionally drift above these settings. If this occurs, a small
red asterisk is shown to alert you to that fact.
The high-voltage rail value is shown at the bottom of the
screen, and the current device operating conditions are
shown along the right-hand side of the screen.
Press Back again and then press Settings to go to the
settings page. This sets the various parameters for the I/V
Test mode (the LED test mode has its settings shown on
that screen, as explained above). The Previous and Next
buttons scroll between various items, while the Up and
Down buttons change the values of those items.
There are seven settings available. The first allows you to
select either a 400mW or 1W zener; it automatically sets the
maximum and target power settings. If this is set to ‘Manual’
instead, the next two items can be used to set the maximum
and target power manually.
The following two items allow you to manually set a
conservative current and voltage limit for I/V tests. When
running I/V tests, the test is stopped if either of these limits
is exceeded.
The final two items set the scale of the graph. If, for example, the voltage scale is set to 10V, then the horizontal
axis of the graph will span −10V to 10V.
Any time the ‘Back’ button is pressed from the Settings
page, the settings are saved to EEPROM. The program uses
a clever update method so that EEPROM is not rewritten
Practical Electronics | March | 2020
Fig.3: after running the touch calibration sketch and
following the instructions, the highlighted text appears on
the serial console.
Fig.4: you then replace this portion of the main sketch
with the text copied from Fig.3 above so that it uses the
new touchscreen calibration.
Fig.5: this is the section of the main sketch where you can
change the calibration parameters, just below the comment
reading ‘//Calibration constants’
unless necessary, so going into the Settings menu and then
exiting without making any changes will not cause any
wear on the EEPROM.
In any case, the EEPROM is rated for at least one million
rewrites per cell, so you would have to spend a very long
time making changes before you’re likely to run into any
problems with the EEPROM!
Reproduced by arrangement with
SILICON CHIP magazine 2020.
www.siliconchip.com.au
21
|