Particle Photon measuring USB voltage

Hello community :slight_smile:

Is it possible to get the voltage of the USB port with a Particle command?

Best regards

Nope, not directly.
Since the ADCs on the Photon can only accept up to 3.3V you cannot directly measure the USB voltage (~5V).
However, you can use a voltage divider to “map” the Vin voltage down into the 0-3.3V range and then add the ~0.2V voltage drop the Schottky diode between USB and Vin incurs on the Vin output and then convert that reading back into the 0-5V range.

Once you have the figure you can expose that value however you feel most comfortable with.

1 Like

Thank you very much :slight_smile: