Skip to content

Digitally regulated CCCV flyback power supply for 230V AC. Implements cascaded PI control, ADC-based feedback, and PWM regulation via STM32L011 MCU. Features UART communication, galvanic isolation, and production-grade PCB design with full EMC compliance.

License

Notifications You must be signed in to change notification settings

Ans1S/Digital-Flyback-Converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ 15W Digital Flyback Converter
Fully Automated CCCV Power Supply with STM32 Control


15W Flyback PSU Final Design

A sophisticated power electronics project combining digital control, embedded firmware, and precision PCB design


πŸ“‹ Project Overview

This project demonstrates the complete design and implementation of a 15W Constant Current / Constant Voltage (CCCV) Flyback Converter with full digital control via STM32L011 microcontroller. The system demonstrates expertise in power electronics, embedded systems, firmware development, and industrial automation.

🎯 Core Challenge

Development of a production-grade power supply capable of:

  • Wide Input Range: 230V AC compatibility (multi-national)
  • Dual Output Modes: Automatic CCβ†’CV switching for LED applications
  • Digital Control: MCU-based regulation with Β±2% accuracy
  • User Interface: Computer software for real-time output configuration and monitoring
  • Industrial Features: Relay feedback contact, 4-stage dimming, external control, comprehensive protection
  • Reliability: Production-ready firmware with error handling and EMC compliance

βœ… Solution Delivered

A complete power supply system consisting of:

  • STM32L011 MCU: ARM Cortex-M0+ with integrated ADC and PWM capabilities
  • Flyback Topology: Galvanically isolated 230V AC to variable DC output
  • Digital Regulation: PWM-based feedback via digital isolator
  • Communication: Serial UART interface for computer control
  • Precise Measurement: ADC measurements for voltage and current
  • KiCad PCB Design: 6 iterative versions from prototype to production (V1-V6)
  • Comprehensive Testing: EMC compliance (CISPR 32 Class A), efficiency measurements, thermal characterization

πŸ› οΈ Technical Architecture

Hardware Stack

  • MCU: STM32L011 (ARM Cortex-M0+, 32KB Flash, 8KB RAM)
  • Power Topology: Galvanically isolated Flyback Converter
  • Input Stage: 230V AC rectification with EMI filter
  • Output Control: PWM switching (MOSFET) with frequencies from 22-120kHz
  • Measurement: 12-bit ADC (base resolution)
  • Communication: UART interface
  • Feedback Elements: Digital isolator, relay output for status indication

Software Stack

Layer Technology Purpose
Application C (STM32CubeIDE) Digital control algorithm (PI/Cascade), state machine, command processing
Driver LL-Driver (Low-Level) Direct register access for GPIO, ADC, PWM, UART, DMA
Control Algorithm PI / Cascaded Control Loop Maintains stable CC/CV setpoints
Memory EEPROM Persistent configuration storage
Monitoring MCU Tracer Real-time debugging and performance metrics logging
Communication Protocol Serial UART Command interface for PC software integration

System Architecture Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            PC Control Software (Serial Interface)           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Configuration β”‚ Real-Time Monitoring β”‚ Logging        β”‚ β”‚
β”‚  β”‚  β€’ Output V/I  β”‚ β€’ Voltage/Current    β”‚ β€’ Data Export  β”‚ β”‚
β”‚  β”‚  β€’ Dimming     β”‚ β€’ Temperature        β”‚ β€’ Waveforms    β”‚ β”‚
β”‚  β”‚  β€’ Limits      β”‚ β€’ Power Efficiency   β”‚ β€’ Events       β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ UART
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                         β”‚
    β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  STM32L011   β”‚      β”‚  Power Stage  β”‚
    β”‚  MCU         β”‚      β”‚  & Sensing    β”‚
    β”‚              β”‚      β”‚               β”‚
    β”‚ β€’ ADC Sampl. β”‚      β”‚ β€’ PWM Driver  β”‚
    β”‚ β€’ PI Control β”‚      β”‚ β€’ MOSFET Gate β”‚
    β”‚ β€’ PWM Gen.   β”‚      β”‚ β€’ Voltage FB  β”‚
    β”‚ β€’ UART Comm. β”‚      β”‚ β€’ Current FB  β”‚
    β”‚ β€’ Protection β”‚      β”‚ β€’ Temp Sense  β”‚
    β””β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                 β”‚
    β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                 β”‚             β”‚
β”Œβ”€β”€β”€β–Όβ”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β–Όβ”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”
β”‚Relayβ”‚  β”‚Dimming β”‚ β”‚Gate β”‚  β”‚Feedback β”‚
β”‚Out  β”‚  β”‚Input   β”‚ β”‚Drv  β”‚  β”‚Digital  β”‚
β””β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜  β”” Isolatorβ”˜

230V AC Input β†’ Rectification β†’ Flyback Transformer
β†’ Secondary Output β†’ Measurement β†’ MCU Feedback β†’ PWM Adjustment

πŸŽ“ Key Technical Achievements

πŸš€ From Prototype to Production

First Prototype V1-P

V1-P: First Prototype

Final Production V5

V5: Final Production

The evolution from initial concept to market-ready product, demonstrating continuous refinement through 6 design iterations.


1️⃣ Digital Power Conversion with Precision Feedback

15W Flyback PSU

Challenge: Maintain voltage/current stability across the entire load range.

  • Solution: Cascaded/PI control loop with 16kHz (62.5Β΅s) cycle time.
  • Innovation: Software-based regulation enables dynamic adjustments and protection functions.

2️⃣ Multi-Mode Power Supply with Automatic Switching

15W Flyback Converter Side

Challenge: Seamless CC/CV operation for diverse loads (LEDs, laboratory applications).

Constant Current Mode (CC):

  • Fixed current output (programmable 0A - 1.2A)
  • Automatic voltage limiting
  • Ideal for LED strings

Constant Voltage Mode (CV):

  • Fixed voltage output (programmable 10V - 60V)
  • Current limiting for protection
  • Standard laboratory power supply functionality

Technical Implementation:

  • Software regulation automatically selects the most restrictive controller (voltage or current).
  • Seamless transition without overshoot.

3️⃣ Comprehensive Hardware Integration & Protection

Final PCB Design V5

Challenge: Integration of analog control, digital MCU, high-voltage power stage, and protection circuits.

Solution: Integrated multi-layer PCB design with:

  • Isolated Feedback: PWM transmission via digital isolator for safe control.
  • Measurement Acquisition: Voltage and current measurement via shunt and differential amplifier.
  • Relay Feedback: Status output for relay contact.
  • Dimming Input: 4-stage external dimming.

4️⃣ Robust Firmware Architecture for Production Readiness

Regulation System

Challenge: Creation of reliable, maintainable firmware for embedded power control.

Solution: Structured C codebase with:

  • State Machine: Manages boot, regulation, fault detection, and shutdown.
  • Safety Features: Overvoltage (OVP) and overcurrent protection (OCP), brownout detection, and watchdog.
  • Monitoring System: "MCU Tracer" logs performance metrics for debugging and validation.

5️⃣ PCB Evolution & Design Iteration

Six Production Iterations:

Version Focus Status
V1-P IC voltage supply prototype βœ… Learning phase
V1 First Flyback LED converter βœ… Validated
V2-P Enhanced design iteration βœ… Refined
V3-P Further optimization βœ… Tested
V4-Release Production candidate βœ… Manufacturing ready
V5 Final Production βœ… Active
V6 Next-generation planning βœ… In Production

Design Improvements:

  • Thermal management optimization (V1β†’V5)
  • PCB layout for EMC compliance
  • Component placement for manufacturing efficiency
  • High-voltage isolation routing

πŸ“Š Project Specifications

Category Details
Input Voltage 230V AC, RMS
Output Power 15W
Output Modes Constant Current (0A - 1.2A) / Constant Voltage (10V - 60V)
Accuracy Β±2% (design target)
Isolation Galvanic isolation via Flyback transformer
Communication Serial UART
MCU STM32L011
ADC Resolution 12-bit base, 14-bit with oversampling
PWM Frequency 22kHz - 120kHz (depending on load)
Protection Features OVP, OCP, OTP, UVP, short-circuit protection, no-load protection
Relay Output Status contact
Dimming Control 4-stage via external contacts
Efficiency > 80% (typical)
Development Time Bachelor thesis
Team Size Dr. Michael Heidinger and Ans1S

πŸ”§ Technical Implementation Highlights

Real-Time Digital Control

  • Control cycle at 16kHz (62.5Β΅s cycle time)
  • DMA-based data transfer from ADC
  • PWM resolution optimized via Farey sequence
  • Multi-mode operation with automatic CC/CV transition

Precision Measurement & Feedback

  • Current measurement via shunt resistor and differential amplifier
  • Voltage measurement via voltage divider and differential amplifier
  • ADC calibration and offset correction in firmware
  • Thermal management

Embedded Communication Protocol

  • ASCII-based UART commands
  • Real-time telemetry streaming (voltage, current)
  • Error reporting

Power Electronics Design

  • Storage transformer dimensioning
  • MOSFET selection and snubber design
  • EMC compliance (CISPR 32) via EMI filtering
  • Longevity through elimination of electrolytic capacitors

Why This Matters: The system demonstrates understanding of complete power supply designβ€”from AC mains to regulated DC outputβ€”combining digital control with analog power electronics.


πŸ“ˆ Simulation & Analysis

Comprehensive Design Validation

SPICE Simulation (LTspice):

  • Flyback converter operation modeling
  • Transient response analysis (load steps)
  • Efficiency calculations

Power Flow Analysis (Plecs):

  • System-level power distribution modeling
  • Harmonic analysis for EMC prediction
  • Thermal loss estimation

Results:

  • βœ… Output current ripple below 133mApp
  • βœ… Transient settling within design specification
  • βœ… EMC compliance validated

πŸ“Š Measurement Results & Characterization

Performance Validation

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     15W Flyback Converter Performance Data              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Constant Current Accuracy   β”‚ Β±1.8% @ 1.2A setpoint     β”‚
β”‚ Constant Voltage Accuracy   β”‚ Β±2.1% @ 48V setpoint      β”‚
β”‚ Load Transient Response     β”‚ 45ms (design target)      β”‚
β”‚ Output Voltage Ripple       β”‚ 85mV peak @ 1.2A CC       β”‚
β”‚ Output Current Ripple       β”‚ < 133mA peak-to-peak @ 24Vβ”‚
β”‚ Full-Load Efficiency        β”‚ 82.5% @ 15W (target)      β”‚
β”‚ Thermal Steady-State (25Β°C) β”‚ +22.9Β°C (MOSFET @ 47.7Β°C) β”‚
β”‚ Protection Response Time    β”‚ < 2ms (software)          β”‚
β”‚ UART Command Latency        β”‚ < 10ms (design target)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

EMC Testing (Electromagnetic Compatibility)

  • βœ… CISPR 32 Class A (conducted emissions)
  • βœ… EN 55015 Radiated Emissions (below limits)
  • βœ… EN 61000-4-2 ESD Immunity (Β±8kV contact)
  • βœ… EN 61000-4-4 Burst Immunity (2kV)
  • βœ… EN 61000-6-2 Industrial Immunity

πŸ› οΈ Created With

  • KiCad - PCB design and schematic capture (all 6 iterations)
  • STM32CubeIDE - Embedded firmware development
  • LTspice - Power electronics simulation
  • Plecs - Energy system modeling
  • STM32CubeMX - MCU peripheral configuration
  • J-Link - SWD debugger for firmware upload & debugging

πŸš€ Key Learning Outcomes

This project demonstrates comprehensive competencies in:

Competency Implementation
Power Electronics Design Flyback topology, transformer dimensioning, MOSFET selection, thermal analysis
Digital Control Systems PI/cascaded control loops, ADC sampling, PWM modulation
Embedded Firmware STM32 LL drivers, interrupt handling, UART communication, DMA
PCB Design & Manufacturing KiCad schematic & layout, layer stackup, EMC-compliant routing, 6+ design iterations
Testing & Validation EMC compliance (CISPR 32), efficiency measurement, thermal characterization
System Integration Combination of analog power, digital control, and communication
Problem Solving Iterative refinement, simulation-driven design, experimental validation

🎯 Why This Project Stands Out

  1. Complete System Design: Not just firmware or just hardwareβ€”full integration from AC mains to regulated DC output.
  2. Production-Grade Quality: 6+ design iterations demonstrate mature engineering approach.
  3. Real-World Complexity: Mastery of galvanically isolated power conversion with digital feedback.
  4. Comprehensive Validation: Simulation, measurement, and EMC testing all documented.
  5. Scalability: Architecture supports future enhancements.
  6. Documentation: Mathematical models, technical datasheets, and detailed measurements included.

πŸ’‘ Technical Insights & Design Decisions

Challenge 1: Stability in Flyback Converter Operation

  • Problem: Flyback converters tend to exhibit ripple and load-dependent variations.
  • Solution: Tight digital PI control loop and careful hardware design (snubber).
  • Learning: Digital control can effectively compensate for analog non-idealities.

Challenge 2: PCB Layout for High-Voltage Isolation & EMC

  • Problem: AC mains and isolated secondary side require careful routing.
  • Solution: Proper creepage/clearance, separate ground planes, EMI filtering.
  • Learning: EMC compliance must be designed in from the start.

Challenge 3: Firmware Reliability in a Power Supply

  • Problem: Watchdog timeouts or firmware crashes could damage the load.
  • Solution: Redundant protection mechanisms (hardware OCP/OVP + software OVP/UVP), safe-state defaults.
  • Learning: Mission-critical embedded systems require defensive programming.

Challenge 4: Thermal Management at 15W in Compact Package

  • Problem: Limited PCB area with high power dissipation.
  • Solution: Thermal measurements, optimal placement of power components (MOSFET, diode).
  • Learning: Thermal design is integral to electrical design (hottest spot 47.7Β°C).

πŸ“ž Project Collaboration

This project was developed in collaboration with:

  • Dr. Michael Heidinger - Digital Power Systems (Project supervision and technical guidance)
  • Prof. Dr. rer. nat. Uli Lemmer - Lichttechnisches Institut (LTI), Karlsruhe Institute of Technology (KIT) (Academic supervision and institutional support)

πŸ“„ Additional Resources

  • Product Datasheet: Datasheet/DIG-CCCV-15W_datasheet.pdf - Official technical specifications and operating guidelines

Engineered with precision. Tested for reliability. Built to production standards.



↑ Back to Top

About

Digitally regulated CCCV flyback power supply for 230V AC. Implements cascaded PI control, ADC-based feedback, and PWM regulation via STM32L011 MCU. Features UART communication, galvanic isolation, and production-grade PCB design with full EMC compliance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published