DIY STM32 Controlled Electronic Load Project Share

If you don’t want to miss my updates, remember to check the public account in the upper right corner and mark it as a star, take down the star and give it to me.

DIY STM32 Controlled Electronic Load Project Share
DIY STM32 Controlled Electronic Load Project Share

The project I am sharing today is a simple electronic load designed by Yu Hao based on STM32 control, featuring constant current, constant voltage, constant resistance, and constant power functions, with a maximum input voltage of 100V, thermal design power of 100W, and a maximum load current of 12A.

Interested students can follow Yu Hao on Bilibili – Dumpling Electronics Studio.

System Structure Diagram

The electronic load is powered by a 3.7V lithium battery, eliminating the need for a separate auxiliary power supply or drawing power from the tested power source, which greatly facilitates user operation.

DIY STM32 Controlled Electronic Load Project Share

System Structure Block Diagram

Below is the hardware solution share, and the software code can be downloaded at the end of the article.

Hardware Design

Load Transistor and Current Detection

This module uses two IRFP250 field-effect transistors as the load transistors for the electronic load. P1 is the power input interface of the tested power source, R3 and R4 are the current detection sampling resistors, and the current detection amplifier uses the INA180A3 device, which has a voltage gain of 100V/V and an input offset voltage of 25uV.

DIY STM32 Controlled Electronic Load Project Share

Load and Current Detection Schematic

Design considerations:

1) R1 and R2 are necessary and their resistance values cannot be too small; if the resistance is too small, it may cause the operational amplifier output voltage to oscillate at high frequencies, affecting circuit operation. The resistance values should be selected based on the output characteristics of the operational amplifier.

2) The input offset voltage of the current detection amplifier will directly determine the accuracy of current sampling, and the offset current is calculated as follows:

DIY STM32 Controlled Electronic Load Project Share

Using INA180A3 as the current detection amplifier, the offset current is about 5mA, while using LM358 to form a non-inverting proportional amplifier would yield an offset current of 100mA. To further reduce the offset current, the voltage gain can be reduced and the sampling resistance increased.

3) The accuracy and stability of the current detection resistor also directly affect the measurement accuracy. It is best to use a high-stability metal film resistor or constantan wire as the current sampling resistor.

4) As a high-power device, the ground of the power section should be isolated from the ground of the measurement and control section. The two grounds can be connected through a 0-ohm resistor point to reduce measurement noise interference caused by voltage drops or noise.

DIY STM32 Controlled Electronic Load Project Share

Load Transistor and Current Detection

This part of the circuit is responsible for hardware constant current control, using the feedback control of operational amplifier LM358 to control the conduction of the field-effect transistor to achieve hardware constant current control.

DIY STM32 Controlled Electronic Load Project Share

Constant Current Control Circuit

1) C3, C8, R16, and R20 form an inverting proportional integrator to limit the rise and fall rate of the operational amplifier output, suppressing overshoot or oscillation. If the current overshoot is too large, the capacitance of the integrator can be appropriately increased, but this will reduce the response speed of the circuit.

2) Due to the influence of the amplifier’s offset voltage and the offset of the DAC’s zero point, it may cause the load current not to be zero (about several milliamps of leakage current) when the DAC outputs a voltage of 0, making it impossible to turn off the electronic load by only outputting 0 voltage from the DAC. Therefore, a simple voltage raising circuit is added using D3, D1, R13, and R18; when the electronic load needs to be turned off, a high level can be output through the “OFF” network while the DAC outputs 0 voltage to completely turn off the field-effect transistor.

Current issues and improvement methods:

When the current supplied by the power source cannot reach the set current value, LM358 will output a high level (about 11V), and the field-effect transistor enters the variable resistor region. Excessive gate charge accumulation can cause the transistor to switch back to the constant current region too slowly. This can be improved by lowering the supply voltage of LM358 (to about 7V) to limit its output voltage amplitude.

Input Voltage Detection Circuit

This module is responsible for detecting the input voltage of the tested power source.

DIY STM32 Controlled Electronic Load Project Share

Voltage Detection Circuit

1) Due to the small input resistance of the integrated ADC of STM32 (the manual data is 50kΩ, and the shorter the sampling time, the smaller the input impedance), directly using the resistor divider method to sample the input voltage will lead to significant measurement errors. Therefore, an operational amplifier is used as the input buffer for the ADC.

2) The instantaneous input resistance of STM32’s ADC is very small, so it is recommended to add a buffer capacitor at the ADC pin. R22 and R23 serve to prevent oscillation of the operational amplifier.

3) Two different voltage ranges can be set separately to improve the voltage measurement accuracy at low voltages.

DAC Circuit
The DAC is responsible for converting the digital signals sent by the microcontroller into analog quantities to control the current of the electronic load. The DAC used is the 16-bit DAC8562, which has two output channels, corresponding to the control of the currents of two field-effect transistors.

DIY STM32 Controlled Electronic Load Project Share

DAC8562 Schematic

1) It is recommended to configure the device for external reference voltage input with a voltage gain of 1 to ensure that it is the same as the reference voltage of the ADC, maximizing the use of the ADC range and the DAC voltage output range. The DAC configuration table is as follows:

DIY STM32 Controlled Electronic Load Project Share

DAC8562 Command Format Table (Excerpt from Datasheet)

DAC related programs:

DAC initialization program: Includes IO port initialization and DAC8562 initialization configuration.

DIY STM32 Controlled Electronic Load Project Share

DAC8562 Initialization Configuration

Temperature Detection and Heat Dissipation

Temperature detection uses a thermistor and a fixed resistor to form a voltage divider circuit, with C2 as the filter capacitor. The thermistor is closely attached to the field-effect transistor using thermal adhesive to ensure accurate measurement of the transistor’s temperature.

DIY STM32 Controlled Electronic Load Project Share

Temperature Detection Schematic

To measure the temperature of the thermistor, it is necessary to understand the temperature-resistance relationship of NTC, expressed as follows:
DIY STM32 Controlled Electronic Load Project Share

NTC Thermistor Resistance as a Function of Temperature

Here, T1 and T2 refer to the Kelvin temperature, Rt is the resistance of the thermistor at temperature T1, R is the nominal resistance of the thermistor at temperature T2, and B is the material constant of the thermistor.

By transforming this formula, the function relationship between temperature and the ADC port voltage can be solved. The program to calculate the temperature is as follows (the math.h header file needs to be included):
DIY STM32 Controlled Electronic Load Project Share

Temperature Calculation Program

ADC_Filter[2] is the calculated temperature result, in Kelvin; ADC_Sum[2] is the accumulation of 1000 samples from the 12-bit ADC.

DIY STM32 Controlled Electronic Load Project Share

Heat Dissipation Fan Control Circuit Schematic

The heat dissipation fan control circuit is essentially a low-side Buck converter circuit. The microcontroller generates PWM to drive the field-effect transistor. By adjusting the PWM duty cycle, the voltage across the fan can be controlled, thus regulating the fan speed. The fan speed is determined by the temperature measured by the thermistor, achieving automatic on/off and automatic speed regulation based on temperature.

Overview of the Schematic:

DIY STM32 Controlled Electronic Load Project Share

Complete Schematic of the Project

The schematic does not show the microcontroller-related circuits, only the key IO interfaces. Readers can freely develop based on their needs regarding microcontroller selection and other expansion functions.

Physical Images:
DIY STM32 Controlled Electronic Load Project Share

DIY STM32 Controlled Electronic Load Project Share

DIY STM32 Controlled Electronic Load Project Share

Electronic Load Code Download:

Reply “STM32 Electronic Load” on WeChat for the download link.

END
DIY STM32 Controlled Electronic Load Project Share
More Practical Project Recommendations:

<<< STM32 Project Collection >>>

<<< Raspberry Pi Project Collection >>>

<<< ESP32 Project Collection >>>

<<< ESP8266 Project Collection >>>

<<< Arduino Project Collection >>>

<<< Darwin Project Share Series >>>

Recommended Reading:
Project Share | Electronic Competition Series | Artificial Intelligence | Postgraduate Entrance Examination
Must-Know Knowledge Points | Graduation Project | Switching Power Supply | Job Seeking
We are Nimo, the founder of Darwin, who only talks about technology without flirting. The Darwin online education platform aims to serve professionals in the electronics industry, providing skill training videos covering hot topics in various sub-fields such as embedded systems, FPGA, artificial intelligence, etc. It tailors layered learning content for different groups, such as commonly used knowledge points, disassembly assessments, electronic competition/smart car/postgraduate entrance examination, etc. Welcome to follow us.
Official Website: www.darwinlearns.com
Bilibili: Darwin
QQ Group: Group 1: 786258064 (Full)
Group 2: 1057755357 (Full)
Group 3: 871373286
DIY STM32 Controlled Electronic Load Project Share

Leave a Comment