Do you sometimes develop with USB? I do. So I need to access data lines, bus voltage and I'd like to easily monitor the current too. I made myself a small companion (43.5 mm × 22.5 mm, 9.5 g) to do that. Just a simple breakout board with one connector in and one out. And a little extra to make things easier. I call it USBuddy.
|USBuddy between host and device.|
It has one pin header to break out all the lines plus one LED to indicate that the USB is on. And the current measurement system: It is a very simple system, just a current shunt resistor and a current shunt amplifier. I chose INA199B1 with 50 gain which consumes less than 100 µA. This allowed me to use a very small current shunt, just 20 mΩ. This means that at 0.5 A, I will be losing only 10 mV. And it also means that the output will be a convenient ratio of 1 mV = 1 mA. The current shunt has 4-wire (Kelvin) connection for more precise measurement.
But why stop here? Often, USB is used for charging at larger currents. The design allows for up to 4 A and 24 V. While putting more than 5 V on USB is typically not a good idea, the USBuddy is designed to handle that just well.
If you think this project can help you, you will find all the design files on my Google Drive and on GitHub.