Advertisement
Intermediate Time: 4–6 weeks Electronics Engineering

Programmable Lab Power Supply

Build a professional 30V/5A programmable bench power supply with constant voltage/current modes, digital readout, and OVP/OCP protection.

Power SupplyLinear RegulatorBuck ConverterLM723Current LimitBench Supply
DifficultyIntermediate
Duration4–6 weeks
Components10 items
Steps5 steps

Introduction

Build a professional 30V/5A programmable bench power supply with constant voltage/current modes, digital readout, and OVP/OCP protection. This comprehensive guide covers everything from design through implementation, testing, and deployment.

Theory & Background

Linear (series pass) regulator: transform AC → DC → regulate by dissipating excess voltage across pass transistor as heat. Extremely quiet (no switching noise), good for sensitive analog circuits. Efficiency: V_out/V_in — at 5V out from 35V in: 14% efficiency (86% wasted as heat). SMPS (Switching): buck converter switches at 100–500 kHz, duty cycle controls output voltage. Efficiency 85–95%. Some switching noise on output. For lab power supply: linear post-regulator reduces switching noise. This project: linear (toroidal + LT3080 parallel regulators) — clean output for analog/RF testing.

Advertisement

Components & Requirements

10 components required for this project.

#ComponentPurposeQty
1Toroidal transformer (35V, 10A secondary)Mains isolation and step-downx1
2LT3080 parallel linear regulator ICsLow-dropout parallel regulationx3
316-bit ADS1115 ADCPrecision voltage/current readoutx1
4STM32F103 MCUControl loop, UI, calibrationx1
5Digital encoder × 2Voltage and current setpoint adjustmentx2
62.4" TFT display (SPI)V/A/W readout displayx1
7Fan + temperature sensor (LM35)Thermal managementx1
8Current sense resistor (0.01Ω, 10W)Output current measurementx1
9INA226 power monitor ICPrecision power measurementx1
10Aluminum heatsink + chassisPass element thermal dissipationx1

Step-by-Step Implementation

Follow these 5 steps carefully.

1
Power Supply Topology Choice

Linear (series pass) regulator: transform AC → DC → regulate by dissipating excess voltage across pass transistor as heat. Extremely quiet (no switching noise), good for sensitive analog circuits. Efficiency: V_out/V_in — at 5V out from 35V in: 14% efficiency (86% wasted as heat). SMPS (Switching): buck converter switches at 100–500 kHz, duty cycle controls output voltage. Efficiency 85–95%. Some switching noise on output. For lab power supply: linear post-regulator reduces switching noise. This project: linear (toroidal + LT3080 parallel regulators) — clean output for analog/RF testing.

2
CV/CC (Constant Voltage / Constant Current) Modes

CV mode: output voltage is regulated to setpoint, current varies with load (up to current limit). Used for most electronics testing. CC mode: when load tries to draw more current than setpoint → supply limits current, voltage drops. Used for: battery charging (constant current phase), LED testing, motor startup limiting. CV/CC transition: automatic. When in CC mode, LED indicator changes color. Setpoint: dual loop control — voltage control loop adjusts pass transistor base current to maintain V_set. Current sense resistor + INA226 measures output current. When I_out > I_limit: CC loop takes over.

3
LT3080 Parallel Operation

LT3080 is a linear regulator designed for parallel operation. Each LT3080 has a SET pin that programs output voltage. Connect all SET pins together through equal resistors (10kΩ) → output voltage equals (single SET current) × R_total. Each LT3080 has an ILIM pin for current sharing: connect all ILIM pins together → automatic current sharing among all paralleled devices. Three LT3080 in parallel: 3 × 1.5A = 4.5A total output capability. Heat dissipation: spread across all three devices + heatsink. Benefit over single transistor: no matching required, inherent current sharing.

4
Digital Control and Calibration

STM32 controls output voltage via DAC (16-bit, MCP4922) driving the LT3080 SET pin through a precision op-amp. Voltage setpoint: SET_current = V_desired / R_set. Read actual voltage/current via INA226 (I2C, 16-bit precision). PID control loop corrects for DAC nonlinearity. Calibration: apply known voltages (measured with calibrated DMM), record DAC codes, fit linear calibration equation (gain + offset). Store in internal flash. Temperature derating: reduce current limit as heatsink temperature rises (LM35 sensor + lookup table).

5
Protection Circuits

OVP (Over Voltage Protection): hardware comparator monitors output voltage — if > setpoint + 5%, instantly disconnects output relay (< 1µs response — protects DUT before MCU can react). OCP (Over Current Protection): CC mode inherently limits current. Hard OCP: if current > absolute maximum (5.5A), crowbar SCR clamp or disconnect relay. OTP (Over Temperature Protection): if heatsink > 70°C, reduce current limit or shut down. Reverse polarity protection: P-channel MOSFET or ideal diode controller protects from reverse connection. Soft-start: ramp voltage from 0 to setpoint on enable — prevents current surges into capacitive loads.

Code & Implementation

Core code for power_supply_ctrl.c:

power_supply_ctrl.c C
// Programmable Lab Power Supply Controller // STM32F103, LT3080 parallel, INA226 measurement  #include "stm32f1xx_hal.h" #include "ina226.h"  #define DAC_MAX    65535 #define VOUT_MAX   30.0f   // 30V max #define IOUT_MAX    5.0f   // 5A max  float v_setpoint = 5.0f;   // V float i_setpoint = 1.0f;   // A bool  cc_mode = false;  // INA226 readings float v_actual, i_actual, p_actual;  // DAC output to LT3080 SET pin (via op-amp scaling) void set_voltage_dac(float voltage) {     voltage = fmaxf(0, fminf(voltage, VOUT_MAX));     uint16_t dac_code = (uint16_t)(voltage / VOUT_MAX * DAC_MAX);     // Write to MCP4922 SPI DAC     MCP4922_Write(DAC_CHANNEL_A, dac_code); }  void set_current_limit_dac(float current) {     current = fmaxf(0, fminf(current, IOUT_MAX));     uint16_t dac_code = (uint16_t)(current / IOUT_MAX * DAC_MAX);     MCP4922_Write(DAC_CHANNEL_B, dac_code); }  void power_supply_update(void) {     // Read measurements     INA226_Read(&v_actual, &i_actual, &p_actual);      // Determine CV or CC mode     if (i_actual >= i_setpoint * 0.98f) {         cc_mode = true;         HAL_GPIO_WritePin(CC_LED_GPIO, CC_LED_PIN, GPIO_PIN_SET);     } else {         cc_mode = false;         HAL_GPIO_WritePin(CC_LED_GPIO, CC_LED_PIN, GPIO_PIN_RESET);     }      // Over-temperature protection     float heatsink_temp = read_lm35();     if (heatsink_temp > 75.0f) {         float derating = 1.0f - (heatsink_temp - 75.0f) / 25.0f;         set_current_limit_dac(i_setpoint * fmaxf(0.2f, derating));         if (heatsink_temp > 90.0f) {             HAL_GPIO_WritePin(OUTPUT_RELAY_GPIO, OUTPUT_RELAY_PIN, GPIO_PIN_RESET);         }     } else {         set_current_limit_dac(i_setpoint);     }      // Update display     display_update(v_actual, i_actual, p_actual, v_setpoint, i_setpoint, cc_mode); }

Testing & Troubleshooting

Test Programmable Lab Power Supply by verifying each subsystem individually before full integration.

!
Troubleshooting Tips

Verify power voltages, check ground connections, use serial monitor for debug.

Real-World Applications

*Electronics laboratory bench power
*PCB prototype testing
*Battery charging experiments
*LED testing and characterization
*Sensor and transducer excitation
*Audio amplifier development
*Embedded system power testing
*Component characterization

Extensions & Next Steps

  • Add remote sensing terminals to compensate for cable voltage drop
  • Implement USB-C Power Delivery output
  • Build a tracking pre-regulator SMPS to improve efficiency
  • Add data logging capability over USB to PC
  • Implement a waveform output mode for testing dynamic loads

Interactive Playground

Coming Soon

An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.

Frequently Asked Questions

What is load regulation and line regulation in a power supply?
Load regulation: change in output voltage when load current changes from no-load to full-load. Formula: ((V_noload - V_fullload) / V_noload) × 100%. Good linear supply: < 0.1%. SMPS: typically 0.5–2%. Important for: circuits whose supply voltage must remain constant despite varying current draw. Line regulation: change in output voltage when input mains voltage changes (typically ±10% from nominal). Good supply: < 0.1% change for 10% input variation. Regulated supplies maintain output within specification across both load and line variations.
Advertisement