# Arduino Forum

## Using Arduino => Project Guidance => Topic started by: johnerrington on Sep 14, 2019, 10:08 am

Title: Measuring USB voltage with 32U4 and potential divider
Post by: johnerrington on Sep 14, 2019, 10:08 am
I'm trying to build a unit to display the USB voltage.  I've tried the "secret voltmeter" - see my other post.  This is a different approach.

I have connected an analog input pin (A9) to Vcc (the pin on the Micro Pro board) via a 3.3:1 potential divider.

(Vcc - 33k - A9 - 10k - GND)

The USB voltage is read externally as 4.99V

however when I read Vcc - ground with a voltmeter at the Micro Pro board I only see 4.6V
and this is also what the Arduino reads.

When I look at the schematic it only shows a fuse which does not to me explain the voltage drop, especially as the current drawn is only 50mA.

I have read previously "Vcc is not the same as Vin".

Does anyone have an explanation for this?
Title: Re: Measuring USB voltage with 32U4 and potential divider
Post by: zwieblum on Sep 14, 2019, 10:25 am
LDO?
Title: Re: Measuring USB voltage with 32U4 and potential divider
Post by: PaulRB on Sep 14, 2019, 10:29 am
Not LDO, that's between Vin and Vcc.

You say 32U4, but what board is the chip on? Pro Micro, Leonardo...?

There may be a diode to protect the PC if the USB is plugged in while the Arduino is powered externally (i.e. through Vin, via the LDO). That diode is probably dropping the ~0.3V

What does your multimeter read on the 5V/Vcc pin, rather than the direct USB voltage?

Quote
a 3.3:1 potential divider.

(Vcc - 33k - A9 - 10k - GND)
That's 4.3:1, not 3.3:1. The resistors have a ratio 3.3:1, but the voltage divider they make has a ratio of Vin:Vout = (33+10):10. Are you calculating incorrectly in your code?

The internal voltage reference on atmega32U4 is 2.56V, not 1.1V as on atmega328.
Title: Re: Measuring USB voltage with 32U4 and potential divider
Post by: jremington on Sep 14, 2019, 06:01 pm
The code may be incorrect, and if you take the time to post it, using code tags, forum members can help.
Title: Re: Measuring USB voltage with 32U4 and potential divider
Post by: Robin2 on Sep 14, 2019, 06:10 pm
I'm trying to build a unit to display the USB voltage.  I've tried the "secret voltmeter" - see my other post.

...R
Title: Re: Measuring USB voltage with 32U4 and potential divider
Post by: johnerrington on Sep 14, 2019, 07:09 pm
Thanks all for your prompt input.

LDO: its a 5V board running AFAIK directly from USB. The schematic Pro Micro Rev 13 shows UVcc connected directly through a 500mA fuse and a closed jumper to Vcc.

PaulRB of course you are correct I meant 33k:10k which is of course 4.3:1

Hi JR thanks for input: the code actually reads correctly, the same as the multimeter.

To clarify: an external meter reads the usb voltage as 4.99V. A multimeter conected between "Vcc" and "Ground" pins on the pro micro board reads 4.6 V approximately.

https://forum.arduino.cc/index.php?topic=636038.0;topicseen
Title: Re: Measuring USB voltage with 32U4 and potential divider
Post by: Paul__B on Sep 16, 2019, 12:14 am