1. Introduction to project functions
#The 7th LiChuang Electric Competition# Summer training camp ammeter can detect the current, voltage and power when USB2.0 is working.
USB ammeter based on N32G430C8L7+INA199, with an accuracy of 1%. It is mainly a reproduction of the functions in the summer training camp example, and the functions have not been changed much!
2. Project properties
The project is mainly a reproduction of the functions in the summer training camp example, and the functions have not been changed much! Relevant valuable components have been replaced, and they have been replaced according to the components I currently have.
3. Open source agreement
GPL3.0
4. Hardware part
MCU part
N32G430C8L7 related pin configuration, related capacitors should be placed reasonably according to the design manual! You can also open the pcb reference placement method of this project.

Pay attention to the position of pin 1 in actual welding, as shown in the figure below.

The reset circuit and BOOT circuit
refer to the live broadcast of Mo Gong operation. H1 and H2 use two pairs of top pads as contacts

for burning and 0.91-inch oled interface.
This time, PWLINK2 and keil mdk of Chuangxin Workshop are used for download and debugging through swclk and swdio. Current

sampling
INA199A1 gain: 50V/V voltage output, current shunt monitor (also known as current sensing amplifier) is often used for overcurrent protection, precision current measurement or closed-loop feedback circuit for system optimization. This series of devices can sense the voltage drop across the shunt resistor at a common-mode voltage of –0.3V to 26V independent of the power supply voltage. This series of devices uses a zero-drift architecture with low offset, so the maximum voltage drop across the shunt resistor can be kept at a minimum of 10mV full scale when current sensing is performed. These devices are powered by a single power supply of 2.7V to 26V and consume a maximum power supply current of 100µA. All versions are rated for –40°C to 125°C.
When laying out the PCB, pay attention to the placement and routing of the sampling resistors. Refer to the Kelvin routing in the manual.
When purchasing original parts, pay attention to the difference in gain (this program uses x1: 50V/V)
INA199x1: 50V/V
INA199x2: 100V/V
INA199x3: 200V/V.

Also pay attention to the position of pin 1 when soldering.

3.3V power supply conversion.
Due to the limitations of this circuit layout and cost, C2 and C3 directly use the 4.7uf capacitor in the MCU decoupling capacitor. Voltage

sampling
directly uses the MCU internal voltage conversion part and resistor voltage division collection.
Since only 90.9k resistors were purchased for this project boom, the program must be adjusted appropriately to ensure the accuracy of the display.

External crystal oscillator .
Considering that the circuit may be upgraded and iterated later, this project adds an 8MHz external crystal oscillator circuit.
If the engineering program is used directly, non-soldering measures can be taken for the crystal oscillator circuit.

Note: For
boot and reset, refer to the placement of this project. Convenient for debugging and inspection.

If the relevant useless pins interfere with the routing, you can edit the components appropriately to facilitate routing and welding.

5.
Notes on the software part
. If the sampled voltage or current is inaccurate, you can modify the values of VOLTAGE_FACTOR and CURRENT_FACTOR in the main.c file according to the actual value.
6. BOM list

7. Competition LOGO verification

8. Effect demonstration
LiChuang Electric Competition: "Summer Training Camp Amperemeter"-Effect display
Picture display (Since the mother row was not purchased and there was no extra screen, the DuPont line connection method was adopted)

Video demonstration
See attachment
Note: For related programs, refer to the officially released summer training camp case
[Training Camp Official Case] USB Amperemeter-Jialichuang EDA Open Source Hardware Platform (oshwhub.com)
Clear demonstration video link: Jialichuang 2022 Summer Training Camp USB Amperemeter_Bilibili_bilibili
The program in the attachment is used to test whether there is a problem with welding (light up the LED alone)