Introduction
Based on the USB ammeter made by N32G430C8L7+INA199, the accuracy is 1%. You can check the current, voltage and power of USB when it is working.
Project description
: Since the LDO model used in this project is XC6220B331MR-G, the maximum input voltage of this chip is 6V, so it can only measure a maximum voltage of 6V!
In terms of current, the maximum current can be calculated according to the formula to be 6.6A (VERF is connected to 3.3V, the resistance of the sampling resistor is 0.01Ω, and the gain multiple of ina199B1 is 50, so (I=3.3V/50/0.01Ω=6.6 A) If you want to carry a current of 6.6A, the line width needs to be at least 3.3mm (the tentative copper thickness is 1oz, and a 0.5mm line width often passes 1A current. You can also calculate it according to the Easy EDA gadget), but The line width in the project is only 30mil (0.762mm), and the limit is 2A current, so it is best not to exceed 1.5A to avoid accidents.
Features:
0.91-inch OLED screen, clear and compact display;
low resistance sampling resistor is used. , to prevent excessive internal resistance from affecting USB power supply efficiency;
Maximum voltage measurement support: 6V
Maximum measurement current: 1.5A
Support power display
hardware design
Power supply: A 6V to 3.3V LDO is used to power the chip. In the case of unstable power supply The MCU can also work normally.

Main control: N32G430C8L7 microcontroller product uses a high-performance 32-bit ARM Cortex™-M4F core, integrates a floating-point unit (FPU) and digital signal processing (DSP), and supports parallel computing instructions. The operating frequency is 128MHz, integrates up to 64KB of on-chip encrypted storage Flash, and supports multi-user partition permission management. It supports 16KB of embedded SRAM and has a built-in internal high-speed AHB bus, two low-speed peripheral clock buses APB and bus matrix, supporting 40. reusable I/Os, providing rich high-performance analog interfaces, including a 12-bit 4.7Msps ADC, supporting 16 external input channels and 3 internal channels, and providing a variety of digital communication interfaces, including 4 U( S)ART, 2 I2C, 2 SPI/I2S, 1 CAN 2.0B communication interface. The N32G430C8L7 microcontroller product can stably operate in the temperature range of -40°C to +105°C, and the power supply voltage is 2.4V to 3.6 V, providing a variety of power consumption modes.
D Power indicator: observe the working status of the power supply module after powering on.
0.91-inch OLED display: used to display the collected current, voltage and power.
Reset circuit: can reset the system. , except for the plug-in operation of the device.
Voltage and current sampling circuit: resistor voltage division, and ina199 collects the voltage at both ends of the sampling resistor. After processing, the calculated voltage is output to the ADC pin, and the microcontroller completes the operation.
Start-up mode: Internal. The flash is started and connected to the expansion pins, which can solve problems such as programming exceptions.
Burning the serial port and expanding the pins:
This project was originally done in the previous training camp. Because the first version failed to verify, things at that time were also different. A lot of it was shelved. Now I have free time to work on it. I found that the previous project was no longer operable, so I came up with this project. And I was too careless when drawing this board and changed the CLK pin of the IIC. The drawing was wrong, so the cause could not be found for a long time during debugging, and a lot of time was wasted. In the end, I had no choice but to use my welding method and use enameled wire flying wires to get the board to run.

The ginkgo tree is still very beautiful!