I have a usb hub and 'm trying to figure out how to measure the electric charge that runs though each of them - specifically when they are connected to mobile device.
Is there a way to make such a measure using arduino board / directly reading it from the hub (by now I can tell if a device is connected to one of the usb in the hub - but not how much power is running through it)
There exist USB ammeters. One would need an ammeter per USB device.
An issue with these is that they tend to work OK for typical phone charging currents (0.5 A to 3 A), but are not very accurate for devices drawing low currents (< 100 mA) typical of Arduino boards.
First off - It's not done very often. Most often we calculate or estimate/approximate current or we check the specs if we have them. I work in electronics and I measure voltage & resistance every day, but I can't remember the last time I measured current (with a multimeter). (The power supplies on my bench have built-in voltage & current meters and I DO "keep an eye" on the current.)
I assume you have a multimeter? [u]How To Measure Current[/u]. You have the break the circuit and insert the meter in series.
The easiest way to do that with USB is to get a USB extension cable, cut it open, and find & cut the 5V wire. At work when we were designing a USB product, we used to have a little "homemade" box with USB connectors and banana jacks so we could plug-in an ammeter. (I don't remember if it had a bypass switch so we could power through the box with the meter disconnected.)
Not only is current measurement a pain, it's "dangerous". In current mode the multimeter is essentially a "short circuit" (very low resistance). If you connect it wrong you can short stuff out and burn-up stuff or blow the fuse inside the meter. That's why most multimeters have a separate connection for current... So you don't accidentally switch it to current-mode and short stuff out. (Dangerous to the electronics if you don't do it right. It's not dangerous to you. )
Hi,
Thanks a lot for all your replies.
I'll try to make things clear.
What I'm looking for is to measure the current (I know that the max in the hub is 500mA - but I'm looking for the exact number and I want to do it by code (c# preferable)
I DO have a multimeter. I want to program one that will be able to measure each usb in the hub and the difference of the amperage every time I connect / disconnect a device to the hub