Projects

Consuming Power - DC Load Part 1

A DC Electronic Load

Peter Stewart

Issue 70, May 2023

This article includes additional downloadable resources.
Please log in to access.

Log in

Provides Constant Current Load, Constant Voltage Load, Constant Power Load, can determine Battery Capacity and also determine the MPPT Voltage of Solar panels. It also has WiFi capability which enables Battery capacity and Solar Panel data to be sent via MQTT to a Home Automation System for plotting and analysis.

The broad overview

The “DC Electronic Load” uses an ESP8266 to control various sensors and a MOSFET to place a Constant Current or Constant Resistance or Constant Power load on the connected device being tested. The DC Electronic Load also can be used to measure Battery Capacity and Solar Panel performance characteristics and send this data via WiFi to a Home Automation System for analysis.

INTRODUCTION

Why would you want a DC Electronic Load, you ask? DC Electronic Loads tend to be used in Electronic Laboratories when testing things like Power Supplies, Chargers and Batteries. A DC Electronic Load has four common modes of operation:

  1. Constant Current – the Electronic Load maintains a constant current load irrespective of the Device Under Test (DUT) output voltage.
  2. Constant Voltage - the Electronic Load maintains a constant voltage load irrespective of the DUT output current.
  3. Constant Resistance - the Electronic Load maintains a constant resistance load irrespective of the DUT output voltage.
  4. Constant Power - the Electronic Load maintains a constant power load irrespective of the DUT output voltage.

I quite often buy batteries and power supplies online from various sources. Most of the time these items seem to work okay. However, sometimes you want to know if they work over their full specification. I have had cases where a processor operation has been unreliable. This has usually been due to an inadequate specification of the power supply or the power supply not meeting specification.

For example, I bought some AC/DC 5Volt Power Supplies, as I use these on some of my projects. I always try to buy from suppliers I know or have a high review score. I did a quick check to make sure they provide 5V output.

Testing their current ratings was a little more difficult. I had to get many resistors with the correct power ratings and measure the voltage across the resistor and then calculate the current.

A DC Electronic Load makes this much easier. With a DC Electronic Load, you just connect it directly to the output of the AC/DC Power Supply (DC side only!). Using the “Constant Current” mode, you adjust the current and the DC Load measures the output voltage. You then can determine whether the Power Supply meets the desired specification.

DC Electronic Loads can also, quite often, measure battery capacity. How many times have you seen a Li-Ion battery advertised as having a 4000 or greater mAhr capacity. Then bought some and found the advertisement has grossly overstated the capacity. I have incorporated this feature into my DC Electronic Load.

Another useful feature I have incorporated into my DC Electronic Load is the capability to test low voltage Solar Panels (up to 26 Volts maximum output). For most projects, this limitation is not an issue. I will explain later, why there is this limitation.

So why build a DC Electronic Load? Besides it being a fun and interesting project (to me at least!). The cost of purchasing a good basic DC Electronic Load starts at around $250 for Chinese manufactured equipment and goes up from there.

Many have specifications way in excess of my and most hobbyist’s requirements. So what were my requirements?

  1. Handle Voltages up to 25V. This was limited by my choice of current sensor.
  2. Handle currents up to 3 Amps. Again, this was limited by my choice of current sensor.
  3. Provide Constant Current, Constant Resistance and Constant Power Modes. I could not see the need for a Constant Voltage mode.
  4. Provide a Battery Capacity mode.
  5. Provide a Solar Panel mode which automatically determines Maximum Power Point Tracking (MPPT) voltage. The MPPT voltage is the Solar Panel output voltage at which the maximum power is produced. This is useful when designing Solar Chargers.
  6. Allow setup of WiFi and MQTT to allow sending of data on Battery Capacity and Solar Panels to my Home Automation System (HAS) for data analysis.

THE DESIGN

Figure 1

When I decided I needed a DC Electronic Load, as usual, I looked around on the Web to see if any other makers had already designed one that I could adapt. In 2016 Louis Scully of Scullcom Hobby Electronics designed his “Electronic DC Load” and produced a 9 Part Youtube video series. I used many of his ideas, but he went into a lot more detail than I needed. His videos are well worth watching. I upgraded some of his design to remove some of the need for calibration and also keep the design relatively simple.

Figure 1, shows the fundamental building blocks of the DC Electronic Load. The DC Electronic Load is fundamentally a programmable current sink. All modules in the DC Electronic Load, Light Sensor, LCD Display, Keypad, Digital to Analog Converter (DAC) and Current/Voltage Sensor are connected via an Inter-Intergrated Circuit (I2C) Bus which is controlled by the Processor (with WiFi). The Processor writes a number to the DAC. The DAC converts this to an Analog Voltage. The Amplifier then drives the MOSFET to turn it on in its linear region. The current that passes through the MOSFET generates a voltage across the Feedback Resistor, which is fed back to the Amplifier forming a closed loop control to ensure that roughly, the correct current is flowing through the MOSFET.

The Current/Voltage Sensor accurately reads the current flowing through the MOSFET. The Processor reads this value and compares it to the value that was set and adjusts the number sent to the DAC to ensure a very accurate current is passing through the MOSFET. The Set current is input via the Keypad with values displayed on the LCD Display. The Light Sensor is used to read light levels when performing tests on Solar Panels. It is now worth looking at each of the Blocks in the DC Electronic Load.

Amplifier and MOSFET

Figure 2

Figure 2 shows in detail the Amplifier and MOSFET circuitry. The Amplifier actually consists of two Operational Amplifiers (U1A and U1B). Both U1A and U1B are contained in a single 8-Pin DIP package. The part number is MCP6002, Dual Operational Amplifier. The MCP6002 was selected as it is a rail to rail operational amplifier. That means the output voltage can swing very close to Ground and +5V.

This is necessary to be able use the full range of the DAC with its output voltage swinging from zero to 5V (a 12-Bit DAC is used). U1A in a non-inverting unity gain buffer with a high impedance input, thus not loading the output of the DAC. R3 and R4 are a voltage divider giving divide by 10 ratio into U1B. C4 is a bypass capacitor removing any high frequency noise. R5, R7 and C5 form a filter to stop any ringing on the input to the MOSFET. R8 is the feedback

resistor. The value of R8 is important and should be at worst be of 1% tolerance.

Now to consider how this circuit operates, consider the output of the DAC is 3V. This is equivalent to a desired current of 3 Amps through the MOSFET. The Voltage going into U1B will be 0.3V due to R3/R4 voltage divider. The output from U1B will initially be high (possibly up to 5V). This will cause current to flow through the MOSFET and through R8.

When the voltage across R8 reaches 0.3V (i.e. 3 Amps), this voltage is fed back to U1B causing the output to decrease to maintain the 3 Amps through the MOSFET and R8. Note R6 is provided to protect the input of U1B. It limits the current into U1B. If for example, the MOSFET went short circuit, and assuming the maximum input voltage is 25V, this could result in a current of 1.67 mAmps going into U1B.

The input protection diodes of the MCP6002 are rated at 2.5 mAmps. So R6 prevents the input protection diodes being destroyed if the MOSFET goes short circuit. There is further protection on the chance of a MOSFET short circuit. This is explained further in the Build section. D2 has also been added to help in the situation of the MOSFET going short circuit as it will limit the voltage across R8 to 1.7 Volts.

The MOSFET chosen for the
DC Electronic Load is the IRF540N. This is a readily available N-MOSFET from Jaycar and Altronics. If you look at the Datasheet for the IRF540N, you will see that the Breakdown Voltage across the Drain and Source V(BR)DS is a minimum of 100 Volts, well within the requirement of 25V maximum input. Also, the maximum current ID is 33 Amps, again well within the 3 Amps requirement. The only parameter which is of concern and this would apply to any MOSFET is Thermal Resistance of the MOSFET.

For example, the maximum allowable Junction Temperature of an IRF540N is 175°C. The Junction-to-Ambient (RθJA) Thermal Resistance parameter is 62°C/W. This means the maximum power which an IRF540N can dissipate in open air is 175/62 = 2.8 Watts. This falls well short of the 25 (Volt) x 3 (Amp) = 75 Watts requirement. For this reason, the IRF540N must be mounted on a heatsink. I have also added a fan to help cool the IRF540N. Using this combination of heatsink and fan reduces the Thermal Resistance substantially.

Here the Thermal Resistance parameters Junction-to-Case (RθJC) and Case-to-Sink, Flat, Greased Surface (RθCS) come into play. With RθJC being 1.15°C/W and RθJC being 0.5°C/W, for 75 Watts, the temperature will rise by 75 x 1.15 + 0.5 x 75 plus add in 25°C for Ambient Temperature giving a total of 148.75°C rise in Junction Temperature.

This would seem to be okay as the Junction Temperature allowable maximum is 175°C. Unfortunately, this is only true if the heatsink is infinite size. What this means is that the heatsink/fan must have a thermal resistance of (175 – 148.75)/75 = 0.35°C/W. This is a very large heatsink and fan (for example see Jaycar HH8530). However, as most of my projects usually operate at around 5V and draw less than 1 Amp, I have opted for a smaller heatsink and fan arrangement.

At some time in the future, if my real requirements change, I will consider upgrading my heatsink. With the smaller heatsink and fan (see Parts List) I have used, I have calculated that my DC Electronic Load can safely handle up to 20W. So I can still have up to 25V input, but at a maximum of 0.8 Amps or up to 3 Amps at a maximum of 6.7 Volts input.

Note, I verified my calculations using my bench power supply and found that the DC Electronic Load could handle just over 20 Watts without any issue.

Heatsink and Temperature Sensor

As mentioned in the previous section, I attached a heatsink and fan to cool the IRF540N MOSFET. As I did not want the fan running continuously, I also attached a Temperature Sensor to the heatsink. The processor regularly reads the Temperature Sensor and turns on the fan when a certain temperature is reached. I chose 45°C as the temperature to switch the fan on. I also set a shutdown temperature of 55°C.

Why 55°C, you ask? Well from above, at 75 Watt load, the temperature margin was 175-148.75=26.25°C. Add on the ambient temperature of 25°C gives 51.25°C. This is a few degrees short of the 55°C shutdown temperature, but not far off. The 175°C could most probably be exceeded for a short time giving the fan a little extra time to cool the heatsink. However, we don’t want to wait too long, as we may be approaching thermal runaway. At this point, we definitely need to shutdown. If the shutdown temperature is exceeded, there is a chance of damage being caused to the MOSFET, so at this temperature, the MOSFET is turned off. The Temperature Sensor I selected was the DHT11.

The main reason was that I had several in my parts box and it is very simple to use. Also, it was easy to glue to the heatsink.

It all worked very well. However, after looking at a datasheet for the DHT11, I discovered that the DHT11 only operated up to 50°C. This was strange, I thought, as I was reading temperatures up to 55°C. Then after searching the various suppliers, I found some were quoting operational temperatures up to 60°C.

Apparently, there is a later version of the DHT11, which has a wider operating temperature range. If you don’t have a DHT11, I would suggest using a DHT22. It has a wider operational temperature range (-40 to +80°C). It works exactly the same as the DHT11. The only difference is in the Arduino code, where the “DHT Type” is declared, ie change from “DHT11” to “DHT22”. Another option is to use the Dallas Semiconductor DS18B20. I have used this sensor on many occasions. It is in a TO92 transistor package and would be easy to mount onto the heatsink with a blob of glue.

Digital to Analog Converter (DAC)

To generate the voltage that goes into the Amplifier/MOSFET section of the design, a Digital to Analog Converter (DAC) has been used. The Processor writes a number to the DAC, which converts it to an analog voltage. I have chosen the MCP4725 DAC module. The MCP4725 is a 12-Bit DAC, which means it can generate 4096 voltage levels, between 0 and 5V. The original design by Louis Scully was for a maximum current capability of 5 Amps. Therefore, the DAC provides approximately 1.22mA per bit. Or another way of looking at it is a count of 819 should provide a current sink of 1 Amp. As the maximum current sink for this DC Electronic Load is 3 Amps, the full range of the DAC is not used.

Current/Voltage Sensor

In Louis Scully’s original design, he used a couple of Operational Amplifiers to measure current through his Electronic DC Load and another couple of Operational Amplifies to measure the Voltage into the Electronic DC Load. The analog voltages were then converted to digital using a two channel Analog to Digital Converter (ADC). I have used an INA219 Current Sensor Module. The advantage of the INA219 is that it has an inbuilt 12-Bit ADC that reads current through the device and voltage (Bus Voltage) to the device. It also communicates with the Processor via the I2C Bus. The only downsides of the INA219 is that the Module is limited to currents of 3.2 Amps and Bus Voltages of 26V. This is the main reason for limitations mentioned earlier.

Light Sensor

The Light Sensor is used to measure light levels when testing Solar Panels. By recording the light level, voltage and current outputs of a solar panel, analysis can be performed to determine the performance of the solar panel. I have used the popular BH1750 Light Sensor Module. As with all the other modules I have used in this design, it communicates with the processor via the I2C Bus.

The BH1750 can measure light levels from 1 to 65535 lx. This should be adequate for just about any light environment. The only thing I have done is attach the Light Sensor to the inside of the case with a hole through the case to allow the light measurement to take place. This means the DC Electronic Load has to be located very near the Solar Panel to ensure a proper light level measurement can be taken. You could use a long cable using the STEMMA QT/Qwiic connectors on the BH1750 Module to allow the Light Sensor to be more remote.

I suspect the length of the cable will be limited due to the signals passing across the cable operating at 100kHz being attenuated. When I built my first DC Electronic Load I used components from different suppliers to those in the Parts List below. The BH1750 Module from Pakronics has an I2C address of 0x62. The BH1750 Module I originally used had an I2C address 0f 0x60.

Apparently, the BH1750 chip can be ordered from the manufacturer with slightly different addresses. So if you do not purchase the BH1750 Module from Pakronics, you may have to determine the I2C address and adjust the address in the DC Electronic Load program accordingly. There is an I2C scanner program available through the Arduino IDE.

LCD Display

I chose a 20 character by 4 line LCD display (LCD2004) to display all the necessary data. Initially, this is what Louis Scully used, but I also had one in my Parts Box. Also, the LCD2004 is available relatively cheaply and from many suppliers. The display is also very clear and can be seen in wide ranging light levels. The LCD2004 is available in two forms.

The first and most common is the display which requires an interface with a processor with six Input/Output (I/O) connections. For me this was not feasible as the processor I would be using did not have that many spare I/O connections. The second and also a popular option is to solder an I2C Display Interface Adapter to the back of the LCD2004 as shown above with an Adapter example from Jaycar shown below it. This resulted in no extra pins being required as there are already several modules using the I2C bus to interface to the Processor.

Keypad

To be able to input setup
data into the DC Electronic Load, I chose to use a simple 4x4 matrix Keypad. These are fairly easy to find at a reasonable price. As with the LCD2004 Display, there are two ways to interface the Keypad to the Processor. The simplest way is to use 8 I/O pins on the Processor. As with the LCD2004 Display, my selected Processor does not have that many spare I/O pins, so again I have used an I2C Adapter.

The example I have used on this occasion is from Pakronics. There are several other providers of this type of adapter, all use the same PCF8574 I/O to I2C integrated circuit.

The Processor

The Processor, I have used in this project, is the WeMos(Lolin) D1 Mini. I have used this processor on many projects. While it does not have a great number of I/O pins, it does come with WiFi and supports the I2C bus natively, i.e. it has all the support hardware on board. The D1 Mini also has a USB interface allowing easy software development using the Arduino IDE. The D1 Mini is also, for its capability, relatively cheap and available from many suppliers.

NEXT MONTH: Part 2

Consuming Power - DC Load - Part 1
Consuming Power - DC Load - Part 2

Peter Stewart

Peter Stewart

Retired Engineer