1. Project function introduction
The USB ammeter can display the power, voltage and power of the USB output in real time. The minimum voltage is 1mV, the minimum current is 1mA, and the minimum power consumption is 1mW. The theoretical maximum input voltage is 30V and the maximum input current is 16A. When the current is 0, it will enter the sleep state after 15 seconds. When the current is not 0, it will immediately exit the sleep mode.
2. Project attributes
This project is an open source project of the LiChuang Electronic Design Competition.
3. Open source agreement
GPL 3.0
4. Design principle
(1) Reset button
SW1 is a button, R1 is a pull-up resistor, and C1 is a filter capacitor. The reset button is rarely used in practice and can be deleted. When downloading the program, you can directly check the reset option in Keil.
(2) BOOT
reserves the BOOT interface. In normal use, you do not need to solder the pin header.
(3) The 3.3V
power supply solution uses an LDO chip. The LDO in the schematic diagram is from UMW Semiconductor, with a maximum input voltage of 30V. Since the Vin and Vout pins were drawn in reverse in the first version, the actual product uses AMS117-3.3, with a maximum input voltage of only 18V.
The schematic diagram has been updated to the chip from UMW (UMW Semiconductor). If you use AMS117-3.3, you need to change the schematic diagram and PCB.
(3) Burning interface
The N32G430 chip can be burned using ST-Link. The official burning interface adds a serial port, which is not added here.
(4) Current measurement
The chip used for current measurement is INA199A3, which collects the voltage drop across a 1mΩ resistor. The voltage amplification factor is 200, and the theoretical maximum measurement current is 16A.
In the PCB, the VCC line and GND line are thickened to 50mil.
(5) Voltage measurement
The voltage measurement uses a 100K resistor and a 10K voltage divider.
(6) 0.96' TFTLCD color screen
The TFTLCD color screen uses SPI communication and software SPI communication (hardware SPI communication transplantation failed). The backlight pin is connected to the PWM output pin of the microcontroller. The brightness of the LCD can be adjusted by changing the PWM pulse width (this part is not written in the software).
TFTLCD only costs 6 RMB on Taobao, which is still very cost-effective.
(7) The RGB
schematic diagram designs a 3-color RGB colored light. Because the device package of the RGB light was not purchased correctly, two LEDs were used instead of RGB in the actual product.
(8) The MCU
voltage and current measurement pins must be connected to the IO port with ADC function.
5.
See the attachment for software design!
6. Actual display
(1) Front photo
(2) Back photo
(3) Startup photo
(4) Running photo
(5) Sleep photo
(6) Demonstration video