4

It has been asked how much power a port can deliver, but I do not need that. I need to get the power consumption of a plugged-in device in real time. This question was left unanswered on Stack Overflow in 2009 - at least for Linux.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
  • Sounds like the wrong place to ask this....I think that this question would be more suited for an EE and I think that there is an SE for that. – mdpc Nov 14 '14 at 07:32
  • 1
    Well, my device is already attached to a Linux box. So I thought that instead of soldering the wires, I could just install a software package. Is this wrong? – Konstantin Shemyak Nov 14 '14 at 10:39
  • A two-year old similar question on Superuser (superuser.com/questions/434354/is-there-an-usb-power-consumption-meter/434383) was answered with "There is no such thing". I wonder if this is correct, and if the situation has changed since then. – Konstantin Shemyak Nov 14 '14 at 12:51
  • What distro is this on? – Bratchley Nov 14 '14 at 14:16
  • reason I ask is because there's a utility called `powertop` which can itemize by device and give you a relative sense of how much power each device is using. So if you know overall you can make an educated guess as to your USB stick. I've never had to delve too far into that though. – Bratchley Nov 14 '14 at 14:22
  • @JoelDavis: I can use any distro (if that makes a difference), and I have `powertop`. But as I understand from its output, `powertop` does not show the power consumption. (My USB device does not cause any CPU wakeups, it just drains the power.) – Konstantin Shemyak Nov 15 '14 at 10:50
  • At some point I saw the unit "mA" in powertop. But that seems to depend on the device its running on as I can't find it anymore on a different laptop with the same version of powertop (but likely a more recent Linux kernel than back then). – Axel Beckert Jun 20 '17 at 17:51

1 Answers1

1

Pin 1 is V_BUS, +5 V. Take a USB cable and horribly mangle it, to insert a 1-ohm resistor inline with the pin 1 conductor.

Run your USB workload and measure voltage drop across the resistor with a DMM or similar. V = I * R and P = I * V, so with R = 1 the millivolts you read will be identical to the milliamps drawn by the device, and power will be five times that. A unit load would be around a tenth of an amp.

If your device draws several unit loads you might consider using a smaller current sensing resistor, perhaps a tenth of an ohm.

For a very high power device, powering the computer through a Kill-a-Watt monitor might be an effective measurement technique. Note the power consumed first with USB unplugged, then while running the USB workload, and compute the difference.

current sensing resistor

J_H
  • 636
  • 4
  • 8