8QqsT1

Mini USB voltage and current meter

 
Overview
 
 
 
 
Hardware Introduction:
Power Supply:
Image includes illustration<br />Description automatically generatedAn AP63203 DC-DC converter is used, with a fixed 3.3V output. However, this power supply design had a slight mishap. The AP63203 DC-DC datasheet states a 3.3V output, but the actual output is about 0.1-0.3V higher, causing the ST7735 screen to display incorrectly when the input voltage is high. Fortunately, the solution is simple: short-circuit the 3.3V and 5V on the development board. Testing showed that after short-circuiting, the output was 3.4V with a 20V input, but this did not affect operation.
Note: After short-circuiting, never use the development board's built-in Type-C
power supply. Voltage and Current Sampling:
TI's INA226 is used for sampling. It has a built-in 16-bit ADC, built-in op-amps, and can automatically average. It uses an IIC to connect to the host. The communication
Illustration, diagram<br />Description automatically generatedmain control MCU
is the LCSC-Diwenxing development board, built using the CW32F030C8T6 from Wuhan Xinyuan Semiconductor and a LCSC development board.
It's worth mentioning that the CW32F030C8T6 boasts a 32Mbits SPI refresh rate of 0.96, handling a 160*80 resolution screen with virtually no issues, significantly faster than the STM32F103's SPI. Thanks to the CW32F030C8T6's wide voltage range, it can operate normally even with slight power supply design issues. Additionally, the CW32F030C8T6 includes an advanced timer. Four general-purpose timers and three basic timers perfectly meet the requirements of this project
. The display screen
is a 0.96-inch, 160*80 resolution IPS display, communicating with the MCU via an SPI interface; this screen is very common
. Software components:
Overall software block diagram:
Map screenshot<br />Description automatically generatedSee source code: https://gitee.com/xmqor/cw32f030-mini-usb-voltage-ammeter
Function introduction:
Voltage and current display: Resolution 0.25mV, 0.25mA, power is the product of voltage and current.
The graphical user interface description has been automatically generated.Coulomb meter: The coulomb meter samples power 100 times per second via a timer and calculates the integral.
Computer host<br />Medium credibility description has been automatically generatedUI menu:
Text is displayed on the screen<br />Description automatically generatedText is displayed on the screen<br />Description automatically generatedUI operation instructions:
Main interface:
Press both buttons simultaneously to enter the function menu
; right-click to switch between coulomb meter interfaces
. In the coulomb meter interface, press the left button to clear the time and coulomb value
(pressing both buttons simultaneously will not trigger the left and right button functions).
UI Menu:
Left and right buttons switch menus;
pressing both buttons simultaneously confirms (back in the brightness adjustment interface).
When the screen flips, the buttons will flip accordingly,
returning to the main interface and saving the state to flash.
A flash equalization loss algorithm is used, theoretically with a lifespan of 1000 cycles, two bytes per cycle, and one sector (512 bytes) can save for 250,000 cycles.
Possible bug: One error may occur every 255 cycles (this bug is unverified and may not exist).
A key point about LCDConfig:
Due to differences in screen batches, some may have negative colors, while
others may have BGR. Use the "OK" button on this interface to switch until the screen icon colors are normal.
There are four configurations in total.
As for different XY offsets, this can only be resolved by modifying the program offset.
Function demonstration video: [Mini USB Voltage and Current Meter - Bilibili] https://b23.tv/0eSmw3u
Important Notes: When soldering headers
for 5A or higher interfaces
, ensure they are aligned correctly. Otherwise, they will not be level.
After soldering the headers, first test the functionality by attaching the development board to the headers, then solder them securely
. To ensure a smooth solder joint, see the image below. Solder two headers to empty I/O pins, using
screws and nuts as spacers. Buy the size shown below.
The printed panel is semi-transparent, and the text is very unclear. If you don't like it, adjust the transparency control layer yourself.
As for the 8A and 16A markings on the panel, just take it as a joke; those are the maximum register values.
16A requires replacing the sampling resistor, modifying the program, and also requires a 10A connector.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 01:39:31

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号