This is only a preview of the June 2022 issue of Silicon Chip. You can view 41 of the 112 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. Articles in this series:
Items relevant to "Spectral Sound MIDI Synthesiser":
Items relevant to "Buck-Boost LED Driver":
Items relevant to "Arduino Programmable Load":
Items relevant to "500W Power Amplifier, Part 3":
Items relevant to "MOS Air Quality Sensors":
Items relevant to "Revised Battery Charge Controller":
Purchase a printed copy of this issue for $11.50. |
Arduino Programmable Load
Project by Tim Blythman
To test devices like power supplies,
driver circuits and current
sources, you often need a
particular or variable load
resistance that can handle
a bit of power. This
Programmable Load is
based on an Arduino
shield that is easy
to understand, build
and use. It can be
controlled manually or
automated in a way that
suits your application.
D
uring the design & testing
of our High Power Buck-Boost
LED Driver (starting on page
40), we wanted to check how it handled various loads to test the robustness and versatility of the design. To do
that, we came up with this design, and
it was so handy that we have turned it
into a standalone project.
Unlike the 50W DC Electronic Load
(September 2002; siliconchip.com.au/
Article/4029), the Programmable Load
is not infinitely adjustable and is not
intended to sink a constant current.
Instead, it uses switched resistance
elements that apply discrete load resistance steps.
But being connected to an Arduino
microcontroller means that it’s possible to add some smarts. The circuit
also includes components to allow the
applied voltage and sunk current to
be measured. This means that it can
calculate the power dissipated in the
Load (P = V × I) too.
Thus, you can program the Load
to behave differently depending on
the application. Its functions include
fixed resistance or current tracking
modes. It can even be programmed to
provide a dynamic load so that you
can test equipment under changing
conditions.
A typical test for a power supply
Features & Specifications
∎ Handles up to 70W continuous, at up to 15V and 4.7A
∎ Presents a load resistance between 3.1W and 47W in 15 steps, or 43kW
when ‘off’
∎ Sinks 255mA to 3.83A in 255mA steps from a perfectly-regulated 12V
source
∎ Manual control of unit loads or resistance
∎ Software provides an approximately constant-current mode
∎ Measures voltage up to 20V
∎ Measures current up to 6.5A
∎ Calculates power up to 130W
48
Silicon Chip
Australia's electronics magazine
or regulator is to see how it responds
to sudden changes in load resistance,
and it is capable of doing that.
Our sample code provides just the
basic features, including manual resistance and current tracking modes, but
it’s easy to modify the code to add custom features. Our sample code also
displays all the data that is collected.
Circuit details
The 50W DC Electronic Load from
2002 uses a single Mosfet bolted to
a large heatsink as the load element.
That requires some careful circuit
design so that the Load can respond
to dynamic conditions.
On the other hand, our Programmable Load consists of 15 high-power
resistors which have no trouble dealing with rapidly changing conditions.
Crucially, there is no chance of them
presenting a short circuit as long as the
circuit is operated within its working
voltage range.
The concept is simple. There are
four groups of 5W 47W power resistors.
The groups consist of one, two, four
and eight resistors respectively, which
can be switched into any combination
from none to 15 resistors in parallel.
The Load is optimised for use with
siliconchip.com.au
Fig.1: four Mosfets, Q1-Q4, are used to switch up to fifteen
47W resistors, applying a varying load resistance across
CON1. IC1 and the 15mW shunt allow the load current to
be measured, while the 33kW/10kW divider measures the
voltage, allowing the dissipation to be calculated.
voltage sources up to 12V nominal. But
we’ve kept in mind that there can be
some variation in voltage; for example, a 12V battery could put out up to
14.4V during charging, and a 12V LED
might require 13V or more to produce
full power. So we’ve selected components that will handle up to 15V continuously (more on a pulsed or intermittent basis).
47W is the lowest E24 series resistor value that produces less than 5W
of dissipation with 15V applied across
it, hence our use of 47W resistors.
siliconchip.com.au
Fig.1 shows the circuit we came up
with. Four N-channel Mosfets, Q1-Q4,
switch the resistors in and out of circuit. Their sources are connected to
circuit ground, and their drains go to
the groups of one, two, four or eight
resistors, respectively. Their gates are
held low by 10kW resistors, so they
usually are off.
The gates also connect to four digital I/O pins (D3, D4, D5 and D6) of
an attached Arduino board via 470W
resistors. The resistors provide a
degree of protection in the event of
Australia's electronics magazine
a catastrophic failure. Otherwise, the
circuits are entirely separate, apart
from their common grounds.
The other end of the load resistors
connects to a 15mW current-measuring
shunt and then to the Load’s positive
terminal. The connection to the external circuitry is via the screw terminals
at CON1.
Also connected to the top of the load
resistors is a 33kW/10kW divider with a
100nF capacitor across the lower resistor. This allows the attached Arduino
board to measure up to 21.5V, assuming
June 2022 49
it has a 5V analog-to-digital converter
(ADC) reference voltage.
The divided and smoothed voltage
is fed to the attached Arduino board’s
A0 analog input pin. This divider
means that the Arduino Programmable Load always presents a minimum
load of 43kW.
The voltage across the shunt is measured by IC1, an INA282 current shunt
monitor with a gain of 50. A current
of 1A results in a 15mV drop across
the 15mW shunt resistor, and thus an
output of 750mV at IC1’s pin 5. The
maximum measurable current with a
5V reference is therefore 6.67A.
This voltage goes to another ADC
channel at the Arduino A1 pin via a
10kW resistor, and it is filtered by a
100nF capacitor. The output voltage
of IC1 is set to be referred to circuit
ground by its pins 3 and 7 being connected to ground.
IC1 is fed with a 5V supply to its pin
6 with a 100nF bypass capacitor from
the attached Arduino board, and its
power ground connection is at pin 2.
By changing which of Arduino
pins D3-D6 are high or low, the load
presented can be varied between the
value of 1-15 parallel 47W resistances,
or even disconnected completely. The
Arduino monitors the voltage and current and reports them along with calculated power dissipation.
Depending on its programmed
mode, the Load can provide a fixed
resistance or attempt to emulate constant current, or even a changing load
to check the response of the supply.
Arduino board selection
We’ve specified an Arduino Uno
in the parts list, but any 5V Arduino
board, including other AVR-based
R3 shield-compatible boards like the
Leonardo or Mega, should work fine.
The sample code doesn’t use any
pin-specific peripherals, so it isn’t tied
to a particular board. But 5V digital I/O
levels are necessary to ensure that the
Mosfets turn on fully.
If you really want to use a 3.3V
board, you could do so with some
changes, but note that many are not
compatible with the R3 shield form
factor (they typically use the MKR
form factor instead). One exception is
the Due. We have not tested the design
with a 3.3V Arduino board, but we
believe it will work with the following changes.
Firstly, ensure you use the
50
Silicon Chip
IPP80N06S4L-07 or similar Mosfets
as the CSD18534KCS are not suitable
for 3.3V gate drive.
Secondly, change the 33kW resistor
to 56kW and change the 15mW shunt
to 10mW. This is to avoid overloading
the ADC pins with voltages above 3.3V
and assumes a default ADC reference
of 3.3V (as per the Due).
In the sketch, change the V_CONST
define to 0.0212695 and the I_CONST
define to 0.0064453 to account for the
different component values.
Construction
The Load is presented as a bare
shield PCB with external screw terminals. It’s expected to be used similarly
to the Arduino PSU (February 2021;
siliconchip.com.au/Article/14741),
as a bare board on top of an Arduino-
compatible microcontroller board.
The lack of enclosure actually
helps us somewhat. With up to 70W
of dissipation, a good amount of free
air convection is necessary to avoid
overheating. Ideally, a fan should
be pointed at the module when it is
used at or approaching its maximum
power rating.
The Load is built on a double-sided
PCB coded 04105221 that measures 89
x 54mm, and Fig.2 shows where all the
components go.
Start by fitting the small components. IC1 is an SMD part in a SOIC-8
package and is best soldered with
the aid of flux paste and tweezers,
although you might get by without
them.
Apply flux to the pads and tack one
lead in place with a clean iron tip,
ensuring pin 1 is aligned with the dot
on the PCB. If the part is still correctly
aligned, solder the remaining pins;
otherwise, adjust it using tweezers
until you can do so. The 15mW shunt
resistor adjacent to CON1 can also be
handled similarly, although it is not
as fiddly to mount.
Clean up any excess flux at this
point as the remaining parts are all
through-hole. Note that the PCB will
also accept a through-hole resistor
for the shunt if that suits you better.
You will have to tweak the calibration
in the software if changing its value,
though.
Next, fit the remaining small axial
resistors, as marked on the PCB silkscreen. Check the resistors with a
multimeter if you are unsure of their
values.
Follow with the three 100nF capacitors, all of which are near IC1. These
are not polarised. Trim all leads close
on the underside of the PCB. Screw
terminal CON1 can be soldered next.
Ensure that the lead entries face out
of the board.
The next tallest components are
Mosfets Q1-Q4, all of which are the
same type. Make sure to orientate
them correctly, with the tabs aligning to the silkscreen markings. You
can also refer to the photos and Fig.2
to confirm the mounting arrangement
for these Mosfets.
The Mosfets are mounted freestanding and vertically. They do not drop
much voltage when on and do not handle much current relative to their ratings, so they do not need heatsinking.
Prepare the 5W ceramic resistors by
bending one lead 180° down one side
so that they can be slotted vertically
onto the PCB. Bending the lead down
the side opposite the markings gives
the neatest result.
When fitting the 5W resistors, it will
We suggest that the Load is used
without a case, although you
should ideally add some tapped
spacers to stand it off your work
surface. There isn’t any point in
using stackable headers,
as there is no room
for a shield above,
and it would limit
convection cooling of
the resistors.
Australia's electronics magazine
siliconchip.com.au
also help to stand them slightly above
the PCB to allow more room for air to
circulate; you can see this in our photos. We’ve made a 3mm gap, although
the length of their leads might limit
you in this.
Start with the resistors near the centre of the PCB and work outwards, trying to keep the tops level for uniformity and square up the parts within
their pads. Note that some parts are
not on the ‘grid’ to provide clearance
from the DC socket and USB socket.
Trim the leads neatly and flush
against the rear of the PCB.
The only remaining parts are the
pin headers. First, plug them into the
Arduino board so that they are correctly aligned, then slot the shield
on top.
Before soldering them, check for any
conflicts below. The in-circuit serial
programming (ICSP) headers on the
Uno board are exposed high points
and are the most likely to foul any pins
on the Load PCB that are not trimmed
short enough. Also ensure that the PCB
is down firmly against the pin headers,
then solder them together from above.
Programming it
Our fundamental control sketch
(program) for the Load is controlled
through the Arduino Serial Monitor
for simplicity. The voltage, current
and power are also reported this way.
Screen 1 shows a typical display on the
Arduino Serial Monitor during use.
If you don’t have the Arduino IDE
(integrated development environment), start by downloading it from
siliconchip.com.au/link/aatq and then
install it.
Now open the sketch file (download
from siliconchip.com.au/Shop/6/6330)
Parts List – Arduino Programmable Load
1 double-sided PCB coded 04105221, 89 x 54mm
1 5V Arduino-compatible board (eg, Uno, Leonardo or Mega)
1 10-way 2.54mm-pitch pin header
2 8-way 2.54mm-pitch pin headers
1 6-way 2.54mm-pitch pin header
1 2-way 5/5.08mm pitch screw terminal block (CON1)
Semiconductors
1 INA282 current shunt monitor, SOIC-8 (IC1)
4 CSD18534KCS, IPP80N06S4L-07 or similar N-channel logic-level Mosfets,
TO-220 (Q1-Q4) [2 x Cat SC4177 or 4 x Cat SC6184]
Capacitors
3 100nF MKT capacitors
Resistors (all 1% 1/4W axial unless otherwise stated)
1 33kW
6 10kW
4 470W
1 15mW 1-3W M6332/2512-size SMD
[Cat SC3943]
15 47W 5W 10% wirewound
Q1-Q4 could be just about any logic-level (ie, suitable for 5V drive) N-channel
Mosfets in TO-220 packages with sufficient voltage and current ratings.
and select your board (eg Uno, Leonardo or Mega) and serial port from the
Tools menu. Upload the sketch and
then open the Serial Monitor from
the Tools menu. Set the baud rate to
115200.
You should start to see an output
similar to Screen 1, with updates
occurring several times per second.
Note that the measured voltage is
across the Load itself, so the power
shown is what is being dissipated in
the Load.
Testing and usage
A good way to test the Load is to connect a multimeter to CON1 to measure
the resistance between its terminals.
Fig.2: the board is
easy to assemble,
but it’s best to
take some care
to line up the 5W
resistors neatly or
it will look messy.
Watch out for
the orientation of
the Mosfets and
IC1. Also, check
the underside of
the PCB when
it is fitted to the
Arduino board to
ensure that none of
the shield component leads short against anything on the Arduino. The 15mW
shunt can be fitted as an SMD or through-hole resistor.
siliconchip.com.au
Australia's electronics magazine
The positive multimeter lead should
connect to the ‘+’ terminal and the negative to ‘-’. Note that if a reverse current
is applied, it will be conducted by the
Mosfet body diodes (and thus all the
resistors) and will appear as a 3W load.
There are three modes that our software can operate in. The first is manual mode, selected by typing the letter
‘m’ into the Serial Monitor, followed
by a number from 0 to 15. This is simply the number of resistors that will be
paralleled and presented as the load.
So for “1”, Q1 is switched on, while
“2” means that Q2 is on, “3” results
in both Q1 and Q2 being on etc. This
continues up to “15”, when all the
Mosfets are switched on.
For example, typing “m1” and pressing Enter (ensuring the ‘CR’ line ending is selected) will cause a 47W load
to be presented on CON1. Entering
“m2” will choose a 23.5W load. You
can check these with your multimeter, although you might see slightly
higher values than expected due to
lead resistance.
At any time, the “m0” command
will disconnect all resistors, so that’s
a good one to remember if something
goes wrong.
The second mode is where a resistance is entered using the “r” command. The software finds the nearest
possible resistance value to the entered
value. Of course, there are only 15
June 2022 51
discrete steps, so it will hardly ever be
exact. But it is a good way to approximate resistive loads of a known value.
The emulated constant-current
mode is started with the “i” command,
and it attempts to match the measured
current to the setpoint by ramping up
and down the number of unit loads.
With the limited number of steps, it
too can only approximate the set current, and will not respond to rapidly
changing conditions. In practically all
cases, it will jump between two adjacent load levels, and the current will
zigzag around the setpoint. Screen 1
shows this, with the Load switching
between 3 & 4 resistors to maintain a
current near 70mA. This was set using
the “i0.07” command.
If the voltage rises above 15V or the
power goes over 70W for an extended
period, shut the Load down with the
“m0” command to avoid damage to
the resistors. There should not be any
damage to the Mosfets as long as the
voltage stays below the Mosfets’ rated
drain-source voltage, which is 60V for
the recommended types.
Remember that the displayed voltage cannot go above 21.5V, so it might
be much higher than shown if it is
above 20V.
More usage tips
Connect the Arduino Programmable
Load’s negative terminal to your circuit ground (remember that it is also
commoned with the computer controlling it) and the “+” terminal to a
positive output.
For example, a power supply should
simply be connected “+” to “+” and
“-” to “-”. If other loads need to be
52
Silicon Chip
Screen 1: the Serial Monitor (or another serial terminal program of your choice)
is used to control the unit and show its status. It has current, voltage and power
read-outs, and the applied load is displayed as both ohms and the number
of 47W units. In the ‘constant current’ mode used here, the load resistance is
controlled to keep the current near a setpoint.
inserted in series, they should be connected between the PSU “+” and Load
“+” to ensure that the Load “-” stays
at ground potential.
The Load is well suited to testing
solar panels, with the proviso that
the Mosfet drain-source voltage is
respected, especially under open-
circuit conditions when panels produce their highest voltages. This limits
it primarily to solar panels with a nominal 24V output; these can produce up
to 44V under open-circuit conditions.
A manual scan of the sixteen different load levels will create sixteen data
points that can be plotted on an I/V or
P/V curve. But note that we are also
designing a Solar Panel Tester which
will have more features than the Load
Australia's electronics magazine
can offer, so stay tuned for that in the
near future.
Making modifications
The software is written with most
parameters set by #define statements
near the start.
If you wish to modify the load resistors, all must remain the same resistance (unless you make significant
changes to the software). The unit
load resistance is specified by the R_
CONST value.
A higher test voltage might require
a different divider to change the range
(although you will need to check that
the Mosfets can also handle a higher
voltage). A different divider will mean
that the V_CONST multiplier will
need to change.
To calculate the new value for V_
CONST, work out what applied voltage will deliver 5V to the A0 pin of
the Arduino, then divide that higher
voltage by 1024. The default value of
0.0209961 is simply 21.5V divided
by 1024.
We have used (as much as possible)
PWM-capable pins so that it is possible to emulate intermediate resistance
values by applying PWM signals to the
Mosfets. We have not tried this technique, but you could experiment with
it if you need finer resistance controls
than the discrete steps presented here.
Note that this will present a pulsed
load to the current/voltage source, and
depending on what it is, it might react
in an unexpected manner.
SC
siliconchip.com.au
|