IntroductionA USB voltage and current meter based on STM32 can easily see whether the charger is working in fast charging mode, and can also easily test the power consumption of USB devices or the output power of USB chargers.Version update instructionsv1.1-2020/4/15Add the auto screen function, after 20 seconds of detecting no current output, the screen will automatically turn off to protect the OLED screen. After the screen is turned off, when the current output is detected or the button is manually pressed, the screen will automatically light up.characteristicBased on STM32F030K6, the code is written using HAL library, GCC compiler0.91 inch white OLED display, the display effect is clearUse low-resistance sampling resistor (5mΩ) to prevent excessively high internal resistance from affecting USB power supply efficiencySupport wide voltage range of 4.7 ~ 24V, 0 ~ 5A current measurementIt can measure Vbus, D +, D- voltage and Vbus current. Support power display and energy calculationCan choose to use internal voltage reference source (Vref) or external voltage reference source (AZ431)Software calibration function can guarantee a certain accuracy after calibration.Fully open source, you can add functions yourself-Calibration instructionsThis USB voltage and current meter is designed with software calibration function, which can compensate for hardware deviation. Press and hold the button during power-on until “Prepare to calibrate ~~~~” appears on the screen, then release the button to enter the calibration mode. Please provide standard voltage and current according to the screen prompts to complete the calibration.Code descriptionThe code is the trueStudio project generated by STM32CubeMX, it is recommended to use trueStudio 9.3.0 to import.PrecautionsThere are two types of USB sockets, one with the internal contacts facing down (facing the pad) and the other with the internal contacts facing up (backing to the pad). The two PCBs can use the same PCB package. If you have used a USB socket with a lower contact, the socket should be soldered to the front of the board, otherwise it should be soldered to the back of the board. The example picture uses the USB socket of the lower contact, and the schematic diagram and PCB design is the female socket of the upper contact. Please pay attention to this when making.Recommended female seat:Upper contact (weld back): C265460Lower contact (welded front): C464564 (used in the example picture)