Electronic Load Tester V1
As a long time hobbyist and electronics scrounger, I have accumulated a substantial collection of small power supplies in various forms. I like to re-use them whenever possible, but the basic specs on the label (if any), do not tell much of a story. I usually pick several that look promising for a particular project, and test them.
Testing involves going to my junk power resistor box and selecting several of different values, adding some alligator jumpers and a couple of meters to the collection, grabbing a piece of paper and a pencil, and starting the laborious process of measuring voltage and current at different currents (being careful not to pick up any really hot resistors!). It works, but it can take a while.
I note that Aliexpress and eBay offer a number of electronic modules to help with this process. They usually have a small MCU, a display and a few buttons, a small heatsink and a fan. Add your own power supply, case and connectors... They generally start at $20 and go way up from there. Reviews suggest they do work, but may not be capable of the power ratings advertised. As a hobbyist and EE, with a good junk parts collection, I should be able to do at least as well as the bottom end of this selection. And so it begins....
|Electronic Load Tester V1|
I try to reuse what I have on hand, as well as meet a general set of goals, for any project, so specifications tend to be iterative, depending on what I find. In general, I want to test DC output supplies, including batteries, up to a few 10's of Volts, and out to several Amps. I'd like the process to be easy, and it should collect data, and send them to a PC for further use and analysis. I'd like the measurements to be fairly accurate, and I'd like the device to have reasonable ability to keep from destroying itself. I'd like it to look nice, so it should be in a case of some type. So, off to the junk pile!!
|Rear View (Note fan and USB Connector)|
I have collected a number of old Cable TV Convertor boxes. These are a nice size and reasonably robust. They have small certified power supplies built in, fed from 110Vac, that typically provide useful regulated voltages like +5 and +12.. They include a small number of Pushbuttons, that sometimes can be reused, and a small 7-segment LED display. They are modular inside, and fairly easy to remove the un-needed parts (the RF mod / demod boxes, the control MCU, etc.) They have a built in IR remote control receiver, but let's not get carried away; it's just an Electronic Load, folks!
|Inside: Original PCB, added Arduino Nano, Heatsink, Protoboard|
A salvaged power supply provides a couple of nice Darlington NPN power transistors, , 6A. One is perfect to use as a load device. An old desktop computer motherboard provides a nice heat sink and 12V fan.
I like Arduino devices, and keep a bunch around, so a 5V Nano, with a small carrier board that provides easy connection to I/O pins, is added to the BOM. Similarly a 16x2 LCD with an I2C backpack is added. I also keep a bunch of these around; very cheap and easy to work with, if a little dated these days...
The Load is best provided in the form of a Current Regulator. Past experience says this is best done in hardware, but needs the Nano to provide the Current Reference for the Regulator. So some form of D to A and a good OpAmp are next. In my samples collection is a MAX5354 in an 8 pin DIP package. Easy to work with, and provides a serial input dual registered 10b DAC, and a partially committed opamp, more than suitable for a current regulator. In fact, the datasheet has a reference design for exactly this purpose! Add a small 0.7V Reference voltage source for the regulator, based on a 1N4148 and some filtering, and that part is ready.
I wanted to keep the 7-segment display, but there aren't quite enough output pins on the Nano. But I2C expanders work very well, so I added a PCF8574 to act as the switched ground connection for the segments. The displays are common anode, and the digit switches on the hi side are already on the CATV PCB, and designed to be run from a MCU. PCF8574 ICs are also very inexpensive, and I keep a bunch around for jobs like this...
Add a 2N2222A to provide Nano control of the 12V cooling fan, and hook up the 12V transistor switch already on the CPU, to the Nano, so I can control the existing Relay that provides power to the 110V switched outlet on the back of the CATV box. Not sure what I will use it for, but seems to be a no-brainer...
|Heatsink Bottom: NPN Darlington, LM35|
I am worried about power, and overheating of the load device. Reviews warn of this problem with the purchased units, so I added a LM35 temperature sensor to the bottom of the heat sink, next to the power transistor. Easy to do, and seems like cheap insurance. And now I have something to display on that 2 digit LED display!
It doesn't take long to remove the parts I don't want from inside the CATV box, and find reasonable places to add the Nano and it's carrier board, the heat sink, and a protoboard to hold the several extra components I am adding. Making a cutout in the plastic case for the LCD is easy, and the front panel has room for a couple of banana jacks. The hardest part is checking all the mechanical clearances as I add items! The CATV box worked before I took it apart, so I work through just enough reverse engineering of the built in PCB to identify the places I need to add wiring: the power supply voltages, the LED connections, the logic level inputs and outputs that get connected to the Nano for control purposes. I layout and build the protoboard with sockets for the ICs, and small connectors for the off-board wiring (yes, I have a big box of salvaged small connectors and wiring harnesses!). I want to be able to test the added components incrementally, just in case something goes wrong...
Of course most of this stuff is useless without the software! I am still a fan of the original Arduino IDE, and have not looked at all the alternative IDEs that have appeared. So everything is in Arduino's version of C++, and makes extensive use of libraries I have experience with, or modules I have written myself, and can easily re-use.
This is not a very complex or time critical application, so a simple time-sliced round robin execution control design is fine. I use the SimpleTimer library for time based execution, with 2 instances, one running at 20mS for most functions, and a second running at 1 Sec, to handle periodic CSV data output via the USB port. I also use the printf library for somewhat easier formatting of data, for use with the USB port, and the LCD display (be aware that printf does not handle floating point data!).
I like the Bounce2 library for PB debounce; sufficient for my purposes, and not overly complicated. works well with the SimpleTimer function.
A 20mS loop works well for PB debounce and for LED display updates, which are multiplexed. The other functions do not need this speed, so the 20mS loop contains logic to produce 5 equal time slices, which repeat every 100mS. The other functions are distributed across these slices. One handles updates to the LCD display, a second handles data collection from the sensors, another handles fan control based on temperature (ON at 40 Deg C, OFF at 30 Deg C), along with overtemp checks, which will shut down the Current Regulator if necessary. A third handles the automated load test function, called the Ramp Test. The 5th slice is spare.
Several of the devices (the LCD, the LED I/O Expander, and the hi-side Voltage and Current sensor) are I2C devices, so the Wire library is included, along with the hd44780 Library, for the LCD interface.
Additional modules I wrote for this application include:
A - data and control bit packing and outputting of the serial data stream to the MAX5354.
B - data collection and calibration of temperature from the LM35, and current and voltage from the INA219 hi side sensor. Temperature readings can be jittery, so they are filtered using a simple Moving Average filter. 8 stages did a good job. the MovingAverage.h library is used for this. Also, the Voltage readings from the INA219 sensor are combined according to the spec sheet to provide a total voltage reading. Since I also include a reverse polarity protection diode on the high side of the Electronic Load, this voltage is further modified to account for the voltage drop, using the diode datasheet specs, along with a logarithmic curve fit, a function of the measured current, to correct further for the forward diode voltage drop as a function of current. That provides a very accurate measure of the applied test voltage, at the connection terminals. The INA219 current measurement is checked with an external meter, and is shown to be very accurate also.
C - 7-segment data conversion, output via I2C, and digit selection multiplexing
The Static Test Function:
In addition to having an OFF Mode which displays the device Title screen and shuts off the current regulator, the device has a Static Test Mode that simply allows the current regulator reference to be incremented and decremented via the PBs, while the relevant data (Reference Current, Actual Current, Actual terminal volts, and Temperature) is displayed on the LCD screen.
|Static Test Screen Mode|
The Ramp Test Function:
Of more interest is the automation of the Load Test process. This involves a Data Entry screen, that lets the user enter:
- the starting current (mA, 0 to 3200)
- the ending current (mA, 0 to 3200)
- the current increment amount (mA, 0 to 1000)
- the time increment (units of 1/10 Second, 0 to 100)
Once this data is entered, the user can move to the Ramp Test screen, which automatically starts the Ramp Test, and displays the test data as for the Static Test, updated 10x per Second. Data is also sent out the USB port, in CSV format, at a rate of 1x per Second. The Ramp Test will begin at the starting current reference, and increment the actual current reference by the current increment amount, every time increment amount, until the ending current reference is reached. The Ramp Test will continue, repeating itself as necessary, until the user leaves the Ramp Test screen.
|Ramp Test Data Entry Screen|
|Ramp Test Screen|
The LCD Display logic:
I have used LCDs in other small projects, and have had a need to easily configure and operate them with multiple display screen datasets, and multiple screens of input data. I have previously surveyed some of the available libraries for this purpose, and eventually developed my own module set, that is sufficient for my needs, easy to configure, and not an overly large amount of code. Control is intended to use only 3 input PBs: a SELECT, an UP, and a DN button. When changing the input data fields, the amount of change of the field data is a function of the data field's current value:
- Range 0-10, change by 1;
- Range 10-100, change by 10;
- Range 100-500, change by 50;
- Range >500, change by 100
In this application, I have done the following:
- Screens selected with "SELECT" PB (1->2->3->4->1):
- Screen 1 = Title Screen, output is 0 mA
- Screen 2 = Simple Test. UP and DN increment or decrement the static load current (mA)
- Screen 3 = Load Ramp Test monitor. Also outputs CSV data 1/Second to USB
- Ramp Test turned ON / OFF when entering / leaving this Screen
- - Screen 4 = Input Ramp Test Config choices
On Input Screen 4:
- Use UP to select 1st input field,
- use SELECT to move across the 4 input fields, then back to screen select mode
- for each input field, use UP and DN PBs to change input field value
- Terminal Program that saves received data to a file
- Arduino IDE Graphic Monitor (only supports 1 auto-scaled axis)
- Gobetwino PC tool (Win). OK, but needs special code in Arduino
- PLX-DAQ V2.11 (Win; Excel). Needs special Code in Arduino. Not tested.
- OpenDAQCalc V1.f (Win, Linux, Excel, Calc). Looks good; small code bugs...
- MatLab (>R2014). $$$, Not tested.
- Aggsoft’s Advanced Serial Data Logger (Win). $$$, Not tested.
- Max 24V dc, 3.2 A Load. H/W OpAmp Current Regulator (MAX5354)
- Minimum Voltage: 1.4V @ 100mA, 1.8V @ 1Amp
- Arduino Nano Controller, 16x2 LCD display
- provide both Static testing, and Ramp Test
- Re-use most CATV Box parts (power, relay, LEDs, IR Rcvr, PBs)
- add I2C I/O Exp to drive LED digits, display Heatsink Temperature
- add cooling fan (ON @ 40 Deg C), LM35 Temperature sensor
- INA219 I2C hi-side V & A sensor, input protection diode
- add MAX5354 10b serial DAC, 2SD1276 Darlington Transistor, heat sink
- add fan transistor switch, connect relay and fan transistors to Nano
- connect LED digit transistors, IR receiver output, to Nano
- send measured data out USB in CSV form, for capture on PC
- Source Code: Request from the Author as above by email.
- Compiler - Arduino IDE V1.8.16 running on Win10
- SimpleTimer Library: included in Arduino IDE, no Version, Mods by Bill Knight March 2017
- Bounce2 Library: V2.60.0, by Thomas O Fredericks
- MovingAverage Library, V1.0.3 by Pavel Slama 2018
- hd44780 Library: V1.3.2 by Bill Perry, Nov 2020, with I2C extensions
- Adafruit_INA219 Library: V1.1.1, by Bryan Siepert & Kevin Townsend, Adafruit
- MAX5354 Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX5354-MAX5355.pdf
- INA219 Adafruit Guide: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-ina219-current-sensor-breakout.pdf?timestamp=1633997149
- PCF8574 Datasheet: https://www.ti.com/lit/gpn/pcf8574
- 2SD1276 PNP Darlington Datasheet: https://www.micro-semiconductor.sg/datasheet/ae-2SD1276AP.pdf
- LM35 Datasheet: https://www.ti.com/lit/ds/symlink/lm35.pdf