* 1. Project function introduction
Based on CH224K and National Technology N32G430C8, it can monitor the output voltage and current in real time, and can also adjust the decoy voltage to 9V/12V/15V/20V at any time. The device also has an anti-false touch function to avoid sudden changes in voltage caused by false touch.

*2. Project attributes
are disclosed for the first time
* 3. Open source agreement
GPL 3.0
*4. The main control of the hardware part
adopts National Technology's N32G430C8. The N32G430 series uses a 32-bit ARM Cortex-M4F core with a maximum operating frequency of 128MHz, supports floating-point operations and DSP instructions, integrates up to 64KB embedded encrypted Flash, 16KB SRAM, integrates a wealth of high-performance analog devices, built-in 1 12bit 4.7Msps ADC, 3 high-speed comparators, and integrates multiple U(S)ART, I2C, SPI, CAN and other digital communication interfaces.
The PD decoy chip uses CH224K. The CH224 single chip integrates multiple fast charging protocols such as USB PD, supports PD3.0/2.0, BC1.2 and other boost fast charging protocols, automatically detects VCONN and simulates E-Mark chips, supports up to 100W power, built-in PD communication module, high integration, and streamlined peripherals. It integrates output voltage detection function and provides over-temperature and over-voltage protection functions.
This chip can switch between different decoy voltages through the high and low levels of 3 pins:
after issuing the decoy command, the main control MCU realizes real-time monitoring through the ADC function pin combined with the voltage divider resistor. If the decoy is successful, the corresponding indicator light will be lit, and the OLED will display the current voltage and output current.
The buck
chip uses LP2950ACDT-3.3RG, the maximum input voltage can reach 30V, the output voltage is 3.3V, the minimum voltage difference is 450mV@(100mA) Output current: 100mA 3.3V
anti-mistaken touch
button can set the deceptive voltage. After pressing it, the buzzer will prompt that the output voltage is about to be switched, and the OLED display will display the voltage value to be switched. The button needs to be pressed for 3 seconds until the OLED displays CONFIG (Confirm!), and the output voltage will be switched to the set value. If the button is pressed for less than 3 seconds, the OLED will display CANCEL (Cancel), and the operation of changing the voltage will not be executed. This design can prevent mis-touch and avoid damage to electrical equipment caused by sudden voltage switching.
Actual machine demonstration:
After pressing the button, the screen displays the voltage to be changed:

Press the program for 3 seconds, the screen displays confirmation, and the voltage adjustment command is about to be executed:

Release the button halfway, the display is canceled, and the output voltage will not change:

The adjustment is completed, and the real-time voltage, current and power are displayed:
*5. The software part of the
programming software uses KEIL. The relevant hardware support package and code can be downloaded in the attachment. The main code is in the main.c file. Some external libraries are referenced as needed. bsp_delay.h is used to support delay functions; bsp_key.h is used to process key input; bsp_led.h is used to process pin output, which is mainly used here to drive the voltage indication LED and control the 3 pins of the decoy chip; MonoScreen.h is used to drive the OLED display. The specific configuration can be found in the inc folder and the corresponding files can be changed.
The burning program uses the SDW interface: 3.3V, GND, SWCLK, SWDIO, and uses PWLINK of Chuangxin Workshop. This burner supports a variety of mainstream chips, KEIL online debugging, and serial communication. The configuration interface is as shown in the figure:

It should be noted that the level setting needs to be 3.3V to avoid damaging the OLED.
Note: If your project involves software development, please upload the corresponding engineering source code in the attachment. Here you can explain in detail your software flow chart, functional module block diagram, explanation or popular science of related algorithms, source code structure, compilation environment construction and configuration, source code compilation method, program burning method, etc. It is recommended to introduce your ideas to others in the form of pictures and texts.
*6. The 3D shell
shell is being modeled and produced, and may not be submitted before the deadline... ...
*7. BOM list
BOM has been automatically generated at the bottom of the page
Note: The BOM list involved in the project. Please upload a screenshot of the BOM in this position. Please upload the list details in PDF format to the attachment. It is recommended to include model, brand, name, package, procurement channel, purpose, etc. The specific content and form should be based on the clear expression of the project composition.
*8. Competition LOGO verification
* 8. Demonstrate your project and record it into a video and upload
the video title: Lichuang Electric Competition: {Project Name}-{Video Module Name}; such as Lichuang Electric Competition: "Autonomous Driving"-Team Introduction.