The problem requires
referencing
the official documentation for the LCSC Diwenxing-CW32F030C8T6 voltage and current meter
(https://wiki.lckfb.com/zh-hans/
). The problem analysis
involves voltage acquisition using an ADC (Analog-to-Digital Converter) with a 12-bit ADC and a reference voltage of -2.5V to reduce the voltage range from 0 to 30V. The resulting analog signal is then converted to the actual voltage value using code.
For current acquisition, a high-side sampling resistor is used. The voltage drop across the sampling resistor is amplified to the mV level by an operational amplifier, allowing the ADC to acquire the analog signal, which is then converted to the actual current value.
Schematic Design Description

I. MCU Selection This project uses the LCSC CW32F030C8Tx development board (core board) as the main controller.
The CW32's key advantages in this project include
: Wide operating temperature range: -40 to 105℃;
Wide operating voltage: 1.65V~5.5V;
Strong anti-interference: HBM ESD 8KV; All ESD reliability reaches the highest international standard level (STM32 ESD 2KV); A key feature of
this project is its superior ADC: 12-bit high-speed ADC achieving ±1.0LSB INL 11.3ENOB; Multiple Vref reference voltages (internal 1.5V, 2.5V reference voltage can be selected) or an external reference voltage can be selected. This allows for measurements with varying accuracy at different voltages;
Stable and reliable eFLASH technology.
II. Voltage Sampling Circuit:
This project designs a two-group voltage divider with precision low-temperature drift resistors of 200K+10K/100K+10K,
with voltage division ratios of 20:1 (ADC_IN11) and 10:1 (ADC_IN6). This proportionally reduces the input voltage, which is then measured by the ADC to obtain a digital value, which is then converted into a voltage value. The use of low-temperature drift and high precision ensures more accurate measurement values.

III. Current Sampling Circuit :
This project uses a 5mR sampling resistor for current detection. When current flows through the sampling resistor, a voltage value is generated. This voltage value is very small, so it is amplified by an operational amplifier, and then sampled by the ADC to obtain the specific value.

IV. Expansion Circuit:
a. A monochrome OLED is used for data display. The purpose of using a plug-in screen is to save learning costs and make the OLED expandable.
b. A passive buzzer is used for indication. Since it's a passive buzzer, it requires a specific frequency to drive, thus utilizing the CW32's PWM output.

c. It addresses the inconvenience of not having a power source when traveling, allowing for switching between lithium battery operation and power supply via the development board's TYPC. It also features lithium battery level detection, using a buzzer to indicate low voltage. The charging circuit uses the development board's built-in TYPC for simultaneous charging during operation. The TP4O56 charging chip used is a classic, inexpensive, and reliable chip, offering charging detection and completion indicators for added convenience.



d. LEDs are the most prominent indicator signals. My circuit has three LEDs: a green LED displays the normal 3.3V power supply; a red LED indicates low battery and charging; and a blue LED indicates a fully charged battery.
PCB Design Notes
: 1. When designing the board, first consider the required shape, size, and intended use.
II. Due to the need for excessively high voltage and current, copper reinforcement should be used as much as possible, and signal lines should not be bent too much.


Software Description:
ADC (Analog-to-Digital Converter) is an indispensable key component in electronic systems. It converts continuous analog signals into digital signals, enabling digital processing and analysis. ADCs play an important role in signal conversion, measurement and data acquisition, control system input, and communication and signal processing. Their widespread application promotes the intelligent and precise control of electronic equipment in various industries and is one of the key factors driving modern technological progress.
Therefore, to achieve simultaneous voltage and current sampling, an ADC sequence channel is used for acquisition. The CW32 has 4 sequence channels. Both voltage and current are averaged to obtain stable values.

I. Voltage Sampling


II. Current Sampling


Physical Demonstration

Notes:
Simultaneous voltage and current measurement is possible without interference. A 3.3V power supply is used during testing, and three power supply methods are available: 1. Type PC. 2. Lithium battery power. 3. 3.3V wired power.