Projects / USB charger tester and cable checker

USB charger tester and cable checker

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANOINA2190.60 A

    Wire the INA219

    In series on the 5 V line.

  2. NANOIRLZ44

    Wire the switched load

    Resistor and MOSFET.

  3. NANOIRLZ44

    Test the MOSFET

    Gate high turns the load on.

  4. NANO

    Test the display

    Show the voltage.

  5. NANO

    Run the sketch

    Note a short cable.

  6. NANO

    Swap in a long, thin cable

    Compare the voltage.

  7. NANO

    Compare chargers

    Same cable, two chargers.

In short

How do you build an USB charger tester and cable checker?

An INA219 measures how much current a USB charger and cable really deliver, showing which cables cause slow charging. You need Arduino Nano, INA219 Current Monitor, USB-A female breakout, MOSFET IRLZ44N, Power resistor 10 Ω 5 W (cement), SSD1306 OLED Display, Resistor 10 kΩ and Resistor 220 Ω. It takes 7 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
USB breakout VBUSINA219 VIN+Charger 5 V in
INA219 VIN-10 ohm resistor, then MOSFET drainLoad side
MOSFET sourceUSB breakout GNDSwitched return
MOSFET gateNano D4 through 220 ohm; 10 k to GNDSwitch control
INA219 and OLED SDA, SCLNano A4, A5I2C (both share the bus)
INA219 and OLED VCC, GNDNano 5V, GNDPower
USB breakout GNDNano GNDCommon ground
Nano USBSeparate cable to a laptopPower for the Nano

Code

A charger says 5 V, but what matters is what reaches the load when current flows. A thin or long cable acts like a small extra resistor, so under load the voltage sags, and a phone may then charge slowly or stop. This tester applies a known load of about half an ampere for three seconds and reads the voltage at the load end with the INA219, so you can compare cables and chargers fairly; a good one stays above 4.75 V. The resistor gets warm at 2.5 W, so the load is on only briefly, and the resistor should sit clear of anything that melts. Test only normal 5 V chargers; do not connect a fast-charging power adapter that negotiates higher voltages, because this tester does not request them and it should stay a 5 V device. The Nano is powered from its own USB cable, so a broken test cable will not harm it. Keep it supervised while running, and do not use it on damaged or hot cables. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// USB charger tester: every 10 seconds switches a 10 ohm load (about 0.5 A at 5 V) for 3 seconds and shows the voltage and current.
// Libraries: Adafruit INA219, Adafruit SSD1306, Adafruit GFX. Board: Arduino Nano.
#include <Wire.h>
#include <Adafruit_INA219.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_INA219 ina;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const byte LOAD = 4;
void setup() {
  pinMode(LOAD, OUTPUT); digitalWrite(LOAD, LOW);
  ina.begin();
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextColor(SSD1306_WHITE);
}
void show(const char* title, float v, float i) {
  oled.clearDisplay(); oled.setTextSize(1); oled.setCursor(0, 0); oled.print(title);
  oled.setTextSize(2); oled.setCursor(0, 16); oled.print(v, 2); oled.print(" V");
  oled.setCursor(0, 40); oled.print(i, 0); oled.print(" mA");
  oled.display();
}
void loop() {
  show("No load", ina.getBusVoltage_V(), ina.getCurrent_mA());
  delay(7000);
  digitalWrite(LOAD, HIGH);
  delay(1500);                                   // let the reading settle
  float v = ina.getBusVoltage_V(), i = ina.getCurrent_mA();
  show(v >= 4.75 ? "Under load: GOOD" : "Under load: LOW", v, i);
  delay(1500);
  digitalWrite(LOAD, LOW);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
No loadAbout 5 V, near 0 mA
Under loadAbout 0.5 A and slightly lower volts
Long thin cableLower volts under load
Load off after the testResistor cools

If it does not work

No readings

Check the I2C wiring and the common ground.

Load never switches

Check the gate resistor and the logic-level MOSFET.

Resistor very hot

Shorten the on-time or add a heatsink.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the USB charger tester and cable checker?

Arduino Nano, INA219 Current Monitor, USB-A female breakout, MOSFET IRLZ44N, Power resistor 10 Ω 5 W (cement), SSD1306 OLED Display, Resistor 10 kΩ and Resistor 220 Ω.

How long does the USB charger tester and cable checker take to build?

About 90 minutes for a beginner maker, in 7 steps.

How do I know the USB charger tester and cable checker works?

No load: About 5 V, near 0 mA. Under load: About 0.5 A and slightly lower volts. Long thin cable: Lower volts under load.

No readings: what should I check?

Check the I2C wiring and the common ground.

Load never switches: what should I check?

Check the gate resistor and the logic-level MOSFET.

Resistor very hot: what should I check?

Shorten the on-time or add a heatsink.