RepositoryCCNChina
AzidoPP

AzidoPP/HVCCPS

2200V 200mA 400W High voltage power supply

86stars
16forks
0issues
0views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: high-voltage

#1 Repository of the week

1
TINIX TRENDING·Topic: stm32g4

#1 Repository of the week

1
TINIX TRENDING·Topic: easyeda

#1 Repository of the week

HVCCPS V1.4

English | 简体中文

Bilibili followers YouTube GitHub last commit Star History Chart

📺 Project overview video: Watch on Bilibili

QQ group: 582594264

[!CAUTION] This project generates lethal high voltage. The output and capacitors may retain substantial energy after power is removed. Provide adequate insulation before testing or operation. Do not use this device without high-voltage experience or without another person present.

HVCCPS V1.4 cover

Project Popularity and Support

If you find this project helpful, please consider giving it a Star ⭐

1. Introduction

1.1 Overview

HVCCPS V1.4 is a digitally controlled high-voltage DC-DC power supply based on the STM32G474CBT6. Its power stage uses a PSFB (Phase-Shifted Full Bridge) topology. It is designed for charging high-voltage capacitors and for general laboratory high-voltage use. The public firmware supports CV (constant voltage), CC (constant current), and CP (constant power) control.

Under the recommended operating conditions, the input range is 18–28 V DC. The public firmware limits the output to 0–2200 V, 0–200 mA, and 0–400 W. The power density is approximately 40 W/in³.

The PCB was designed in EasyEDA Pro. This repository includes the complete EasyEDA project, Gerber files, and BOM for replication and further development.

1.2 Firmware and license

To discourage closed-source commercial use and closed-source copying, the public repository currently provides compiled firmware only; the firmware source is not included directly in the public branch. The source code is available free of charge by joining QQ group 582594264 or emailing Lanyyontop@gmail.com.

The public contents of this repository are licensed under GPL-3.0. When obtaining, modifying, or redistributing the source or derivative works, comply with the license terms.

2. Specifications

2.1 Electrical specifications

ParameterMinimumTypicalMaximumUnitNotes
Input voltage (DC)182428VRated input-voltage range
Input current (DC)——20ARated input current
Output voltage (DC)0Adjustable2200V—
Output current (DC)0Adjustable200mA—
Output power (DC)0Adjustable400W—
Switching frequency113545kHzAutomatic frequency control by default; 35 kHz reference frequency
Gate-driver dead time—200—ns—
Conversion efficiency——96%Measured peak; see the efficiency test data
Output-voltage step—1—V—
Output-current step—1—mA—
Output-voltage accuracy——±0.5%—
Output-current accuracy——±1%—
Power density—40—W/in³Based on the effective assembled volume
Total weight—292—g—

[!NOTE] The 28 V value is the upper limit of the recommended operating range. The bus capacitors are rated for 35 V; never exceed 35 V.

2.2 Control and protection

ItemParameterDescription
Control modesCV / CC / CPAutomatic arbitration among three PI loops
Fixed-duty mode0–100%For debugging only; still constrained by soft start
Soft startDuty may increase by at most 10% per control cycleDefault value; adjustable in the host configuration manager
Run timerContinuous or 1–65534 sAutomatically disables the output when the timer expires
Supply UVLO / OVPBus >32 V; window protection for 12 V, 5 V, and 3.3 V railsInternally suppresses the physical output while preserving software enable state and communications
Hardware overcurrent protection (OCP)Approximately 60 A AC peak at the primary-side SW nodeCOMP1 → HRTIM FAULT4 asynchronous shutdown; this is not a 60 A rated input current
Software overtemperature protection (OTP)70 °CShuts down if either the MOSFET NTC or the MCU internal temperature exceeds the threshold
Independent watchdog (IWDG)Approximately 200 msResets the controller if the main loop or control ISR stalls
ButtonsTwo A/B presetsStores CV, CC, CP, and run time; supports offline operation and shutdown

OCP and OTP both latch the shutdown state. Starting again clears the latch; if the fault condition is still present, protection trips immediately again.

2.3 Controller and communications

ItemSpecification
MCUSTM32G474CBT6
External crystal8 MHz HSE
System clock170 MHz
Communication interfaceUSART3, PB10 (TX) / PB11 (RX)
Serial format115200 baud, 8N1
Host interfaceWebSerial
Input connectorXT30
High-voltage output connectorM3

2.4 High-voltage-side design notes

All PCB clearances on the high-voltage secondary side are ≥ 9.5 mm. The design may be modified to support a higher output voltage when required.

For a higher output voltage, recalculate and validate the transformer turns ratio, rectifier diodes, output capacitors, and feedback network, and update the firmware parameters accordingly.

3. Architecture

3.1 PCB layout

The PCB uses 4 layers, a 1.6 mm board thickness, and 1 oz copper. Common resistors and capacitors use 0805 packages for easier assembly. The main power transformer is primarily on the top side; the gate-drive, control, and sensing circuits are primarily on the bottom side.

TopBottom
PCB topPCB bottom

3.2 Power architecture

The power stage uses a PSFB topology and regulates transferred power by varying the phase shift between the two bridge-leg pairs.

Power architecture

3.3 Hardware architecture

The controller samples voltage, current, temperature, and auxiliary supplies. HRTIM generates the four full-bridge drive signals with fixed dead time. An independent comparator and HRTIM Fault path provide hardware overcurrent shutdown.

Hardware architecture

3.4 Control-strategy architecture

%%{init: {"flowchart": {"htmlLabels": true, "nodeSpacing": 70, "rankSpacing": 95}, "themeVariables": {"fontSize": "18px"}} }%%
flowchart LR
  Host["Host UI / A-B buttons<br/>CV, CC, CP, run time"] --> Cmd["Run targets and active configuration<br/>PI parameters, soft start, frequency strategy"]
  ADC["Synchronous ADC sampling<br/>VSEC / ISEC / VPRI / IPRI_DC<br/>AUX12 / AUX5 / VCC / temperature"] --> Filter["Full-cycle aggregation and filtering<br/>24-point high-speed mean/peak<br/>Moving average for auxiliary supplies"]
  Filter --> Protect{"Protection evaluation"}
  Protect -->|"UVLO/OVP or OTP"| GateOff["Physical output disabled<br/>duty = 0"]
  Protect -->|"OCP"| Fault["HRTIM FAULT4<br/>Asynchronous hardware shutdown"]
  Protect -->|"Normal"| Fb["Feedback<br/>Vout, Iout, Pin/Pout"]
  Cmd --> PI["Three parallel PI loops<br/>CV: voltage error<br/>CC: secondary-current error<br/>CP: power error"]
  Fb --> PI
  PI --> Min["min(CC, CV, CP)<br/>Lowest duty takes control"]
  Min --> Slew["Soft-start slew limit<br/>Limits duty increase only"]
  Slew --> Duty["Phase-shift duty → HRTIM CMP3"]
  Duty --> PSFB["PSFB power stage<br/>Fixed dead time ≈ 200 ns"]
  PSFB --> ADC
  Duty --> Freq["TIM7 automatic-frequency supervisor<br/>Duty-based scoring and feed-forward"]
  Freq --> Duty

The controller is effectively a three-loop parallel duty limiter: the CV, CC, and CP PI controllers each produce an allowed phase-shift duty, and the firmware selects the smallest value. The result passes through the soft-start slew limiter before being written to HRTIM.

4. Fabrication and assembly

4.1 PCB fabrication

Order the PCB using the Gerber files in this repository. Recommended parameters:

  • Layers: 4
  • Board thickness: 1.6 mm
  • Outer-layer copper: 1 oz
  • Inner-layer copper: 0.5 oz

4.2 Transformer

Transformer manufacturing parameters

ItemSpecification
CoreEC49, material 40
Turns9 primary, 900 secondary
Turns ratio1:100
Primary winding pins2–3
Secondary winding pins5–8
Secondary wire diameter0.3 mm
Air gapNone required
Other requirementsMinimize leakage inductance; pot and seal after winding

Use the thickest practical wire for the primary winding, with a current capacity of ≥ 30 A. Before potting, remove pins 1, 4, 6, and 7 plus the two unused center pins. Either winding direction is acceptable.

The transformer used in this project was custom-made by the Xiangrun Electronic Core & Bobbin Taobao store.

[!NOTE] After manufacturing, the transformer should have less than 10 µH leakage inductance and more than 300 µH magnetizing inductance.

4.3 BOM and key components

The complete bill of materials is available at Docs/BOM.xlsx. Pay particular attention to the following parts when purchasing:

[!IMPORTANT] Use the Docs/BOM.xlsx file provided with this documentation and the key-component notes in this section as the source of truth. Do not use the BOM exported from the Lichuang EDA project.

ReferencePart / recommendationNotes
L1Reference link—
R810 kΩ NTC, B = 3450 K (reference link)Check the B value
Q1–Q4CSD18540 or CSD19531Verify the source of the MOSFETs
R24–R28Viking high-voltage resistors, 2 MΩ, 2512, 3000 V (reference link)—
U7, U8UCC27211; SLM27211 is a substituteCounterfeit UCC27211 devices are common; SLM27211 is a pin-to-pin replacement
U9EE8.3 1:200 current transformer (reference link)Ensure it is 1:200, not 1:100
U6ACS712-20AUse the 20 A-range version, not the 30 A version

Purchase all remaining components according to the BOM.

4.4 Soldering and inspection

Solder paste with a hot plate or reflow oven is recommended for SMD assembly. This project assumes the builder is experienced with electronic assembly.

Completed assembly, front

Completed assembly, back

After soldering, verify the orientation of every IC—especially the gate drivers—using the package markings. Incorrect orientation can destroy the main controller.

IC orientation check

4.5 Output capacitor

For use as a general high-voltage supply, an external 4000 V, 0.2 µF film capacitor may be connected as the output filter (purchase link). The capacitor may be omitted when the device is used as a high-voltage capacitor charger.

Solder terminals to the capacitor leads first, then fasten them to the output using screws.

Output capacitor connection

5. Firmware flashing and IAP updates

5.1 Firmware components

The released firmware consists of two Intel HEX files, available from GitHub Releases:

FirmwareStart addressPurpose
Bootloader HEX0x08000000Startup checks and serial IAP updates
App HEX0x08004000Power control, protection, telemetry, and host communication

5.2 Preparation

Required equipment:

  • ST-Link V2
  • USB-to-TTL adapter
  • SH1.0-to-2.54 mm adapter board
  • SH1.0 cable

Required flashing equipment

Install STM32 ST-LINK Utility. It is also recommended to download the current project as a ZIP, or use the online flasher and online control interface.

See the complete procedure in the firmware flashing video tutorial.

5.3 Flashing procedure

The board communication header exposes SWCLK, SWDIO, TX, RX, GND, 3.3 V, SDA, and SCL, in that order. Flashing is performed in two stages:

StageRequired pinsInterface
Initial Bootloader flashingSWCLK, SWDIO, GND, 3.3 VST-Link V2
App flashing via IAPTX, RX, GND, 3.3 VUSB-to-TTL adapter, with TX/RX crossed

[!WARNING] Disconnect the high-voltage output load before beginning. Make the system safe.

  1. Connect the board's SWCLK, SWDIO, GND, and 3.3 V pins to the corresponding ST-Link V2 pins.

  2. Open STM32 ST-LINK Utility, select the Bootloader HEX file, and program it.

    Programming the Bootloader with STM32 ST-LINK Utility

  3. Reset the board after programming. If LED_A lights, the Bootloader has started successfully.

  4. Disconnect the ST-Link. Connect the USB-to-TTL adapter to TX, RX, GND, and 3.3 V; cross TX and RX.

  5. Open BootLoaderHostUI/index.html from the downloaded project, or use the online IAP flasher. Use the latest Chrome or Edge.

  6. Connect the serial port in the page, select the App HEX file, click the flash button, and press the board's RST button.

    Flashing the App through the IAP page

  7. Wait for transfer and verification to finish. Reset the board again. If LED_A flashes continuously, the App has started successfully.

6. Host interfaces

6.1 Power-control interface

For offline use, download the project and open AppHostUI/index.html. You may also use the online power-control interface. The WebSerial page provides:

First-time users should watch the host connection and control video tutorial.

  • Start/stop control and CV, CC, and CP target settings
  • Fixed-duty debugging
  • Voltage, current, power, temperature, and protection-state telemetry
  • Real-time plots and single-cycle sampled waveforms
  • Configuration of PI parameters, switching frequency, automatic frequency control, and soft start
  • Management of front-panel A/B button presets

Power-control host interface

The connection uses 115200 baud, 8N1. Use the latest Chrome or Edge, and open only one page that accesses the serial port at a time.

6.2 Output calibration

Output V/I calibration requires App firmware V0.0.3 or later. The calibration table is stored in a flash area reserved independently of the App and is not erased by IAP App updates. Writing the table and enabling calibration both modify flash and must be performed while the output is off.

[!CAUTION] Calibration still involves the high-voltage output. Turn the output off and confirm it has fully discharged before rewiring, measuring, changing meter ranges, or changing the load. Do not calibrate without supervision or adequate insulation.

  1. Flash or update to App firmware V0.0.3, connect the power-control host interface, and confirm that serial communication works.
  2. Open the Calibrate panel in the top bar. Initially leave Apply calibration to the control loop disabled.
  3. Run the supply at the target voltage, current, and load point. Record the actual output using an external multimeter or high-voltage meter.
  4. Stop the output and discharge it, then enter the samples in the calibration panel:
    • For a voltage point, enter the RAW VSEC shown by the host interface and the voltage measured by the external meter.
    • If the point corresponds to a fixed load current, also enter the externally measured current for load-dependent two-dimensional voltage correction.
    • For a current point, enter the displayed RAW ISEC and the externally measured current.
  5. Start with 2–5 voltage points covering the normal operating region. A single point is acceptable if only one operating point matters. Add 1–3 current points across the normal load-current range as needed.
  6. Click Compile & Preview and verify that the corrections are reasonable. Firmware clamps voltage correction to ±50 V and current correction to ±50 mA. Values beyond these limits indicate a likely sampling or external-measurement error.
  7. Confirm that the output is still off, click Write Table to Flash, and wait for the upload to finish.
  8. Enable Apply calibration to the control loop. The host interface writes the enable state to configuration flash.
  9. Restart at low power and verify the output with the external meter. If the remaining error is too large, disable calibration and collect new RAW points, or add samples before writing the table again.

Always use RAW readings collected while calibration is disabled. Do not enter ordinary VSEC/ISEC values that already include calibration into the RAW columns, or the correction will be applied twice.

6.3 Bootloader interface

Both the local BootLoaderHostUI/index.html page and the online IAP flasher support Intel HEX parsing, address-range validation, serial handshaking, chunked transfer, progress display, and error logs. They are intended only for updating the App firmware.

Bootloader host interface

7. Testing

Project tutorials and test videos are collected in the HVCCPS V1.4 video tutorials and tests release.

Test instruments:

  • SDS804X oscilloscope
  • VC980D multimeter

7.1 ZVS turn-on

Measurements confirm zero-voltage switching of the main power MOSFETs: the switch-node voltage falls close to 0 V before the gate-drive signal turns the MOSFET on. The phase-shifted full bridge uses transformer leakage-inductance current for soft switching, reducing high-frequency switching loss.

Oscilloscope probe connections:

ZVS test probe connections

The measurement focuses on the lower MOSFET of the lagging bridge leg, where ZVS is harder to achieve. When the lagging leg meets the ZVS condition, the leading leg will usually achieve ZVS as well.

ZVS waveform 1ZVS waveform 2ZVS waveform 3
ZVS waveform 1ZVS waveform 2ZVS waveform 3

The blue traces are the lagging-leg SW node, the red traces are the leading-leg SW node, and the yellow traces are the lower gate-drive signal of the lagging leg.

[!NOTE] This is a step-up supply, so primary current is substantially greater than secondary current. It can therefore achieve ZVS across a wide input range instead of only under heavy load.

7.2 Current waveforms

Primary current

Waveform 1Waveform 2
Primary-current waveform 1Primary-current waveform 2

The blue traces are the lagging-leg SW node, the red traces are the leading-leg SW node, and the yellow traces are the voltage signal obtained after rectifying and sampling the current-transformer signal.

Secondary current

Waveform 1Waveform 2
Secondary-current waveform 1Secondary-current waveform 2

The blue traces are the lagging-leg SW node, the red traces are the leading-leg SW node, and the yellow traces are the AMC1301 sampling signal fed back to the primary side after differential amplification.

7.3 Voltage waveforms

Secondary-voltage waveform 1Secondary-voltage waveform 2
Secondary-voltage waveform 1Secondary-voltage waveform 2

The blue traces are the lagging-leg SW node, the red traces are the leading-leg SW node, and the yellow traces are the AMC1311B sampling signal fed back to the primary side after differential amplification.

[!NOTE] The voltage-divider sampling loop has a relatively large area and is directly below the transformer, so the feedback signal is subject to interference. The firmware includes targeted digital filtering to improve the measurement.

7.4 Startup waveforms

The startup waveforms were measured with a 3 kΩ resistive load. Load current was approximately 50 mA at 150 V output and 77 mA at 230 V output. These tests show the output-voltage buildup during closed-loop startup.

150 V / 50 mA230 V / 77 mA
150 V startup waveform230 V startup waveform

7.5 Output-voltage ripple

Output-voltage ripple was also measured with a 3 kΩ resistive load. The images show the 150 V / 50 mA and 230 V / 77 mA operating points.

150 V / 50 mA230 V / 77 mA
150 V output-voltage ripple230 V output-voltage ripple

[!NOTE] A high-voltage probe was not available, so ripple was first tested at lower output voltages.

7.6 Constant-current capacitor-charging test

Watch the complete test video

The test used two 1100 µF capacitors in series, for an equivalent capacitance of approximately 550 µF. The host interface was set to 2000 V with a 200 mA current limit. Charging took approximately 5.6 s; capacitor voltage rose nearly linearly, and peak output power was approximately 390 W. Based on the capacitor energy equation, the average charging power was approximately 195 W.

Constant-current capacitor-charging test at 6 seconds

7.7 Constant-voltage resistive-load test

Watch the complete test video

A 5 kΩ aluminum-housed resistor was connected to the output and the target voltage was set to 800 V. The output remained stable throughout the test, validating the constant-voltage loop and continuous-output capability.

Constant-voltage resistive-load test at 9 seconds

7.8 Arc test

Watch the complete test video

The arc test visually demonstrates the high-voltage output. Arc testing is extremely dangerous and requires reliable insulation, grounding, current limiting, discharge provisions, and an external emergency stop. Do not attempt it without supervision.

Arc test at 10 seconds

8. License and changelog

This repository is licensed under GPL-3.0. See log.md for version history and detailed changes.

MCU vendor manuals are linked rather than copied into this repository. See MCU reference documentation for the official sources used by the project.

Similar Projects

Discover other similar projects and AI models.

RepositoryC++
ckormanyos/real-time-cpp

Source code for the book Real-Time C++, by Christopher Kormanyos

825
Nov 26, 2026
RepositoryMATLAB
mohammadrezwankhan/matlab-simulink-energy-lab

Run reduced-order battery, thermal, converter and BESS control models with transparent equations and repeatable testing.

383
Nov 23, 2026
RepositoryHTML
Rootthecause/DCDC

An open source credit card sized DC/DC converter to convert up to 600 V to 24 V in a energy-, cost- and space efficient way.

167
Dec 1, 2026
RepositoryTypeScript
nilbuild/developer-roadmap

Interactive roadmaps, guides and other educational content to help developers grow in their careers.

373.1k
Dec 1, 2026
RepositoryTypeScript
n8n-io/n8n

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

212.9k
Dec 2, 2026
RepositoryPython
microsoft/markitdown

Python tool for converting files and office documents to Markdown.

199.5k
Dec 2, 2026
RepositoryTypeScript
microsoft/vscode

Visual Studio Code

195.9k
Nov 30, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026
RepositoryC
flipperdevices/flipperzero-firmware

Flipper Zero firmware source code

17.1k
Nov 27, 2026