Project: Active load with microcontroller – Part 2: Hardware design details

This is a follow-up post to my previous project page Part 1 (Requirements).

In the last part I laid out the requirements and specifications of my active load without going too much into detail. This is about to change while I write about the different implementation details.

The main task of the active load is – of course – to dissipate power. This can be done by any device which has resistance. The simplest load is just a resistor but the problem is that a resistor usually has a fixed resistance which makes no sense in an active load. So we need a device which can dissipate (a lot of) power and has a controllable resistance. This can be done with a power transistor or in this particular case with a power FET. The idea is to control the gate-source voltage in order to influence the drain-source resistance. The device under test is just connected to drain and source.

Power transistor

As I wrote earlier this project is inspired by the Re:load 2 project by Arachnid Labs. In this project Infineon’s BTS117 is used as the load transistor which dissipates the power. This FET has input protection, thermal shutdown, overload and overvoltage protection, fulfilling the requirement of robustness. It can sink up to 3.5A and endures 60V drain-source voltage.

This device has very good features so I will use it too. It comes in a TO-220 package and has to be mounted on a (big) heatsink. I will use a heatsink with the dimensions 50.8x42x25 mm (5.3 K/W) which can be soldered directly on the PCB.

Note: Definitely use thermal paste between transistor and heatsink!

Control loop and feedback

In order to change the current that the dummy load should sink, a simple controller is needed. The FET gate is driven by an opamp (in this case by Microchip’s MCP6002). The load current flows through a shunt resistor and the resulting voltage is fed back to the inverting input of the opamp. The non-inverting input is connected to a voltage source that corresponds to the setpoint current (see: Microcontroller). This scheme is a closed-loop control system. The following extract of the schematic depicts this control system and also shows the connection of the power transistor. R13 and C21 are used for frequency compensation in order to stabilize the control loop. As a side note: There are multiple shunt resistors in the schematic with different footprints (THT and SMD). The resistors can be placed/not placed as desired.

Voltage regulator

There are several components that require a regulated voltage of 3.3V. The input source can be selected between USB (5V) and the device under test itself (up to 40V). I decided to include two different voltage regulators in my design: The low-dropout voltage regulator LM9036 and the “good old” LM317 which has a very good availability. Of course only one device must be placed on the PCB. A slide switch allows me to select between the two power sources.

Keep in mind that the LM317 does not have a reverse polarity protection as opposed to the LM9036!


In this design a cheap but powerful STM32F072C8 is used. This device has native USB support and comes with a ADC and DAC. The DAC subsystem is used to control the setpoint current while the ADC measures the actual current flowing through the load and the voltage of the device under test. In order to flash the microcontroller, a space saving Tag-Connect footprint is used on the PCB. As an alternative the firmware can be flashed using the STM32 internal USB bootloader.


I decided to include Electronic Assembly’s DOGS104N-A display in my design. This is a 36×28 mm small module which comes in a DIP package and can be soldered directly on the PCB. The display does not need additional voltages except for 3.3V and is connected to the microcontroller via SPI. The implementation in software should be quite simple because the display already includes a 4×10 (or 2×10 or 3×10) font which should suffice.

Temperature sensing

I want to be able to measure the temperature at the power transistor or at the heatsink. That’s why I decided to include a DS18B20 one-wire sensor in a TO-92 package which should be thermally connected to the heatsink. The sensor has a good accuracy and has a simple interface. No further calibration is needed.

Operating control

In order to change the setpoint current conveniently, a rotary encoder with a button (ALPS STEC12E08) is added to the design. Both outputs A and B are directly connected to timer inputs of the microcontroller. There is nearly no effort in software to be done in order to interface an encoder because STM32 microcontrollers support a special encoder input mode. The decoding and (noise-)filtering is done inside the peripheral unit of the microcontroller.

This solution is much better than designs with potentiometers because it allows me to change the current with a high precision and the rotary encoder is not so prone to wear like the potentiometers. It is also quite cheap because I don’t need any components around the device.


Read further on as I present the final hardware design with schematic, PCB layout and some pictures in part 3.

By André Heßling

I am an electronic engineer living in Voerde, Germany.


Leave a comment

Your email address will not be published. Required fields are marked *