Portable Digital Adjustable Power Supply
Introduction
This project is an entry in the National Embedded Chip and System Design Competition. It's a PD protocol digital adjustable power supply with the following functions and features:
CV/CC mode output, 0-18V 0-5A
analog loop with a bandwidth of up to 40kHz,
integrated battery power supply with a 10000mAh capacity
, low output ripple (less than 10mVpp under no-load and less than 20mVpp under load),
integrated over-temperature, over-current, and surge protection
, and a serial port with touchscreen operation for added convenience. The power supply topology
uses a BUCK motherboard, directly receiving a PD 20V input or a 20V input boosted from a battery BOOST. Regarding why BUCKBOOST wasn't used, initially, a PL5501 BUCKBOOST solution was considered, but multiple soldering attempts failed due to my lack of expertise with QFNs.

In loop implementation
, when building an error amplifier externally to the integrated BUCK chip, the FB pin is pulled low, and a signal is injected from COMP to disable the internal error amplifier. However, this effectively turns the chip's internal error amplifier into a low-impedance pull-up source, which draws power from the chip's internal LDO, resulting in less current available for high-side drive.
To address this, the power supply directly injects the signal from the FB pin. Due to the change in circuit structure, the requirements for the external error amplifier also change; high gain is needed at low frequencies, while maintaining the phase margin of the entire system at high frequencies. Therefore, type 2 compensation is no longer used; instead, a pure integrator is employed.
However, this integrator introduces a problem: the BUCK circuit, after compensation, can be considered a single-pole system with its pole at 0 frequency. Now, the integrator introduces a very low-frequency pole, making the phase of the entire system closer to 180° at low frequencies. This manifests as a small overshoot in the step response in the time domain. If this is a major concern, a capacitor can be added to the voltage and current sampling circuit to create a zero.

Battery management
uses the IP2368
microcontroller program
. The STM32G431 microcontroller was chosen primarily because of its peripherals such as UCPD and OPAMP. The microcontroller is responsible for collecting data such as voltage, current, and temperature, providing a reference voltage to the power supply, handling the PD protocol handshake, and communicating with the serial screen.
Due to the low input impedance of the STM32's ADC, the G431's built-in OPAMP is used as a follower to obtain more accurate values when collecting voltage and current data. The
reference voltage is provided using a DAC. Theoretically, the actual output voltage is 10 times the reference voltage; however, due to various errors, some calibration is required.
The advantage of the UCPD peripheral compared to readily available PD protocol chips is that it can obtain the charging head's load capacity and finely adjust the output voltage and current. The disadvantage is that the middleware is not open source and is difficult to debug. Therefore, a CH224K soldering pin is added in this design, allowing selection of either the CH224K or UCPD peripheral via a jumper.
The serial
screen model is TJC4832T135; a serial screen was chosen because it is easier to write the UI. In reality, since the power loop is analog, the microcontroller's timing requirements are not high, and the microcontroller's screen-scrolling performance is sufficient.
Purchase link: https://m.tb.cn/h.gj7WWFEagqxhSPr?tk=skKH32a4ulq
The outer shell
is made of acrylic, and the detachable battery compartment is 3D printed.
Known issues:
The power loop is missing a zero point, causing overshoot in the step response.
The battery power estimation algorithm is incomplete and inaccurate.
The battery charging board and motherboard each have a Type-C interface, which can be combined into one.
The battery power supply to the motherboard uses a separate boost chip; in practice, the IP2368 PD protocol output can be used to eliminate this chip. Attachments:
STM32 source code
digitalPower.HMI, serial port screen source code,
shell-related files
digPWR.mlx, MATLAB simulation files.