From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I measure the analog USB supply voltage using Labview?

Solved!
Go to solution

I'm basically powering a sensor from the 5V (nominal) USB supply but the full scale output depends upon the actual input voltage for any particular measurement- what I want to do is get labview to measure the voltage at the USB port at the same time it samples the sensor voltage output then from that the full scale output for that instant in time can be calculated and thus give a more accurate measurement. Can this be done in labview? Thanks very much.

Haydn Barker

0 Kudos
Message 1 of 6
(3,539 Views)

LabVIEW has no problems doing this, but your hardware may.  What hardware are you using?

 

As an example, a myDAQ has inputs with a -10V - 10V range.  You would need to wire the 5V wire from the USB to one of the analog inputs to measure it.  This would require cutting into the USB cable

and could compromise its function, so proceed with care.

 

Note that the 5V output from a USB cable is usually within a few hundredths of a volt of 5V.  Do you really need more than ~2% accuracy?  How good is the rest of your measurement stack?

0 Kudos
Message 2 of 6
(3,520 Views)

HI there thank you for the response.

The hardware is a single channel DAQ device so I cannot configure another channel specifically to measure the USB voltage. The measured signal will never be more than 10mV full scale so accuracy is important (the device itself is <+/-1% accuracy at room temperature.

What I was hoping was that there was a subvi or something that NI (or somebody) had made that measures the USB voltage internally on the computer/PC without the need for another analogue input. Surely something on a PC or laptop constantly monitors the output voltage to ensure there are no faults (it monitors current comsumption through the BUS down to individual ports) I hoped there would be a simply way to just tap into this value and use it in a VI...

 

0 Kudos
Message 3 of 6
(3,511 Views)

There is no such hardware feature that is universal to all motherboards. Additionally, depending on the current being used, the length of the usb cable, etc. the voltage present at your sensor would also vary, probably a lot more than the 1% accuracy. I know that some motherboards have onboard monitoring of key voltages, but think it more at the the "main 5V" level, not individual usb ports.A USB DQ device may be the only way to actually measure the supply voltage at the sensor.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 6
(3,492 Views)
Solution
Accepted by topic author H.Barker

That makes a lot of sense actually- probably would see a few mV's dropped from the measurement point to the sensor point- then you're doing the work with the corrective equations/measurements just to be working with an inaccurate level anyways. Okay well I shall write that off as a bad idea then and just stick to the system as it is at present- I am sure it will suffice. Thank you for your replies and help.

0 Kudos
Message 5 of 6
(3,473 Views)

With a single channel device you would not have many options anyway.  If you had multiple channels or some digital outputs you could add a references and a voltage divider and measure the power supply voltage that way. 

 

USB devices have multiple power handling modes, depending on the power required by the remote device.  Many high power USB devices have a power switch which disables the high power portion of the device until after a successful handshake/power negotiation with the host.  In such devices the voltage may be 100-200 mV below the host voltage when in the high power mode.

 

Lynn

0 Kudos
Message 6 of 6
(3,450 Views)