element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Frank Milburn's Blog Programmable DC Electronic Load - Followup
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fmilburn
  • Date Created: 10 Aug 2019 12:33 AM Date Created
  • Views 2110 views
  • Likes 9 likes
  • Comments 8 comments
  • adafruit feather
  • 240x320_display_arduino
  • dc electronic load
  • adafruit m4 express
  • arduino
  • opa 192
  • electronic load
Related
Recommended

Programmable DC Electronic Load - Followup

fmilburn
fmilburn
10 Aug 2019

Introduction

 

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.

image

 

Schematic

 

image

 

BOM - Major Components

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

Infineon N-Ch MOSFET     IRLZ34NPBFIRLZ34NPBF

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.

image

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.

image

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.

image

 

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.

image

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.begin();
  tft.fillScreen(ILI9341_BLACK);
  tft.setRotation(3);
  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.println(pi,6);
  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.

image

 

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

  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 5 years ago +5
    Design the UI - look at implementing SCPI Yay! It helps if you do the two together. It drives you to separate instrument logic from interface logic. If you design so that the user interface talks to the…
  • fmilburn
    fmilburn over 5 years ago +5
    There is an interesting discussion on Hackaday about how Arduino code for reading ADC is incorrect for the SAMD21. Basically it attempts to read the ADC before it is finished and ready. I am using the…
  • genebren
    genebren over 5 years ago +4
    Great idea to collect all of your thoughts before you shelf a project for a while, as it is much easier to restart when the time is available. It looks like you did improve a lot of the things that you…
  • fmilburn
    fmilburn over 5 years ago

    There is an interesting discussion on Hackaday about how Arduino code for reading ADC is incorrect for the SAMD21.  Basically it attempts to read the ADC before it is finished and ready.  I am using the SAMD51 above but need to check if the same error exists there as well.

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • three-phase
    three-phase over 5 years ago

    Nice summary of your project, I am very guilty of just leaving things and then taking two weeks to try and figure out what I was doing when I go back to the project.

     

    Kind regards.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 5 years ago

    Good progress.

    I look forward to the next post to see your progress.

     

    DAB

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 5 years ago in reply to Jan Cumps

    Thanks Jan,

     

    I plan to go back and study how you implemented it on your project.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 5 years ago in reply to jc2048

    Thanks Jon,

     

    RE OPA192: I had a brain lapse when I put the schematic and circuit together.  The idea originally was to use the 5V rail and maybe a 4.6V LDO since I have one left from another project to power the op amp. I will find a few minutes and go back and see if that fixes it.  Fully agree on the compensation suggestions that MK suggested. 

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube