This is the follow-up to a post about a simple programmable DC electronic load.  Progress has not been as good as hoped and the project needs to be set aside for the time being so other priorities (like a RoadTest and life in general) can be pursued.  Hopefully this documentation will allow it to be picked  up at a later time and completed.


In the first post a design was built and tested on a breadboard, followed by perfboard.  Opportunities for improvement were identified and incorporated into this build.  Improvements from the first build include:

  • Movement from Arduino MKR1000 to Adafruit M4 Feather Express (12 bit DAC and ADC)
  • Precision Shunt Resistor
  • Low on-resistance power MOSFET
  • Soldered connections on protoboard
  • Addition of 240x320 TFT display with ILI9341 controller


The new build is shown below.

Prototype with Display




Prototype Schematic


BOM - Major Components

TO-220 style 1% 1ohm resistor     Bourns PWR220T-35-1R00FBourns PWR220T-35-1R00F


Texas Instruments Op Amp     OPA192IDBVROPA192IDBVR

Bourns 2 Ch encoder     10C035410C0354

Adafruit Feather M4 Express

Generic 240*320 TFT with ILI9341 controller


DAC Tests


The Feather M4 Express has two 12 bit DACs which are accessed on pins A0 and A1.  The datasheet gives the effective number of bits (ENOB) as 10.7 and the minimum output voltage to be 0.15 V (max value) in table 54.28 but it appears to be much better than that.  The electronic load uses A1 to set the voltage on the noninverting input of the OPA129 op amp.  To test the general operation of the DAC a simple Arduino sketch was written which ramps the DAC up from 0 to maximum and then starts over again without delay.

 * Test DAC on Adafruit Feather M4 Express
 * FHM
 * August 2019
const int DAC_RES = 12;
void setup() 
  analogWriteResolution(DAC_RES);        // DAC output resolution
void loop()
  int i = 0;
  for (i=0; i< 4096; i++){
    analogWrite(A1, i);


The screenshot below from the oscilloscope shows the resulting output.

DAC producing a ramp

The output is a ramp to about 3.4 V consisting of 4096 steps of about 0.83 mV per step which is of sufficient resolution.  Whether the accuracy is sufficient remains to be seen but it is possible to use the external analog reference voltage (VDDADC) for both the DAC and ADC.  VDDADC is exposed on the of the pins but is connected to VDD by default on the feather and a bridge must be broken.  The ramp is running as fast as it can and gets from bottom to top in a little over 5.1 ms.  The next screenshot zooms in on the fall time.

Fall Time

Fall time is around 7.2 us.


In the next screenshot the output of the ADC is held steady to get an idea of the noise of the output.  It is expected that the majority of the time the instrument will be set to output 1 amp or less.  Here it is outputting about 820 mV with the scope oversampling and in "High Res" mode.



ADC Tests


A simple sketch was written to read input values on two different analog pins while simultaneously reading on a DMM.  The analog readings from the Feather M4 Express were then plotted on a log-log scale against the DMM readings.

ADC Tests

Everything is quite linear above about 30 mV.  Below that there is increasing deviation.  ADC readings cluster tightly as shown by the following where 1000 readings were taken with 66 mV input using different analog references with and without added capacitance:


Default analog reference, no capacitance

Raw Avg:  90.3

Median: 90

Std Dev: 1.3


Default analog reference, Capacitance added

Raw Avg:  90.0

Raw Median: 90

Std Dev: 0.9


Internal 2V23 analog reference, no capacitance

Raw Avg: 90

Raw Median: 90.0

Std Dev: 1.3


Internal 2V23 analog reference, with capacitance

Raw Avg: 90.1

Raw Median: 90

Std Dev: 1.0


Slightly better results are obtained by adding a 0.1 uF MLCC and  low ESD10 uF Polymer Aluminum capacitor.


Constant Current Tests


The constant current tests were not successful and the op amp is unstable.


Display Test


A 240 x 320 TFT color display was selected to display output that uses the ILI9341 controller.  Adafruit has a library with graphics and text example code for these displays.  The simple sketch that follows outputs text and numbers in different colors and shows how the display can be easily rotated.

 * Modified Adafruit example for ILI9341_240x320_Color for Feather M4 Express
 * Connections
 * Feather M4       ILI9341_240x320
 * ----------       ---------------
 * MISO             SDO(MISO)           Black
 * 3V3              LED                 White
 * SCK              SCK                 Grey
 * MOSI             SDI(MOSI)           Brown
 * D9               D/C                 Blue
 * RESET            RESET               Green
 * D10              CS                  Yellow
 * GND              GND                 Orange
 * V3               VCC                 Red
 * FHM 
 * August 2019
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
const int DC       = 9;
const int CS       = 10;
Adafruit_ILI9341 tft = Adafruit_ILI9341(CS, DC);  
void setup() {
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(5);
  tft.println("\nHello e14\n");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(4);
  float pi = 3.14159265358979;
  tft.print("Pi= ");
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println("Small Text");
  tft.setTextColor(ILI9341_GREEN);  tft.setTextSize(2);
  tft.println("Smaller Text");
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Still Smaller Text");
void loop(void) {
  // do nothing


In the photo below the display demonstrates the output from the sketch.

240 x 320 TFT Display Demonstration


Thoughts for Future Self



While the project is not currently in a working state is the status:

  • The Feather M4 Express DAC seems up to the job.
  • The ADC is linear above 30 mV and a simple linear correction could be easily developed.
  • Below 30 mV the ADC is nonlinear.
  • The ADC was left unconnected - reconnect A2 and A4
  • The display works as intended
  • Need an encoder with pushbutton for the UI
  • Try getting the op amp / MOSFET working with a potentiometer before reconnecting the microcontroller


Other things that need to be done:

  • Decide on a case
  • Do the thermal calculations and select heat sinks / cooling
  • Design a board(s) - preferably separate the stuff generating heat
  • Design the UI - look at implementing SCPI


Useful Links

Programmable DC Electroic Load - First Look:  First post in this series

A Simple DC Electronic Load by John Wiltrout

Programmable Electronic Load by Jan Cumps