Part #/ Keyword
All Products

DIY USB Voltage & Current Meter for Chargers

2025-09-15 13:55:28Mr.Ming
twitter photos
twitter photos
twitter photos
DIY USB Voltage & Current Meter for Chargers

If you often DIY things like CNC power supplies or electronic loads, and you've got some spare parts lying around—like microcontrollers and small screens—then you can follow along with this guide to build a USB voltage and current meter. It's mainly for testing the voltage and current from a USB port, but it can also measure energy in mAh and Wh. Perfect for checking your phone's charging parameters. If that sounds interesting, keep reading.

Let's say your phone charger outputs up to 21V at 5A. In that case, you can set the meter's measuring range to 30V and 6A.

For the main controller, you can use an STM8L151. The display is a 0.96-inch OLED screen. For current detection, use the MAX471. Since one MAX471 can handle up to 3A, you'll need two of them.

Here's the basic flow: the MAX471 handles current-to-voltage conversion, and you add a resistor divider for voltage measurement. These two voltage signals go into the microcontroller's ADC. After calibration, the values are displayed. The microcontroller also runs a timer for precise timing, which adds up the total output energy in seconds and converts it into mAh and Wh for display.

The finished product looks like this (in the picture below). Here, it's plugged into a computer USB port without a load connected, so it only shows the USB port voltage.

image.png

The circuit diagram is shown below.

image.png

And here's the PCB layout.

image.png

Next step: get the PCB fabricated. If you use panelized boards, you'll need to cut them apart.

image.png

Once you have the boards, solder on all the components. The assembled board looks like this:

image.png

image.png

After soldering, you can start testing. For example, here are the charging parameters when a Huawei P20 had 80% battery left:

image.png

The P20 charger supports 5V at 4A and 4.5V at 5A. 

And here are the charging parameters for a Huawei Mate 20 Pro at 40% battery:

image.png

The Mate 20 Pro charger supports up to 10V at 4A.

Done!

* Solemnly declare: The copyright of this article belongs to the original author. The reprinted article is only for the purpose of disseminating more information. If the author's information is marked incorrectly, please contact us to modify or delete it as soon as possible. Thank you for your attention!