I have an Arduino UNO R3 where I’ve set Pin 13 to “HIGH” (as shown here) and I’ve connected an LED to Pin 13 and GND which glows brightly using a USB attached to my MacBook Air providing (I think) 5V.

Now, I’m powering the Arduino externally using a 3V (1.5+1.5) battery and the 5V/GND connection. The green light blinks showing the Arduino is being powered and the bulb glows since it’s the same circuit.

Now, I wish to connect the USB to the Arduino and basically read the voltage of the LED via Pin 13 and the GND connection. Of course, I could accomplish this by simply attaching a multimeter but that’s not the problem since it’s not the true aim of the project (which I can state if required but it’s more complicated and not too different). But when I connect the USB the LED glows brighter and the voltage across it is around 3.5V (higher than what the battery is supplying). I want the computer to read the voltage of the battery and not supply the arduino with it’s own power. How do I accomplish this (note: I’m allowed to break certain circuitry on the Arduino but I’d prefer to do this as last resort)?

Basically, how do I read voltage readings on a computer off an arduino without powering the arduino i.e. How do I convert the USB port and my computer into a multimeter with the arduino?

(I'm very new to experimenting with this so may have made crushing mistakes. Any help is appreciated)

New contributor
user220704 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • why do you want to do this? ... you can measure the battery voltage without using the battery to power the arduino ... otherwise, use an external USB serial adapter
    – jsotola
    May 13 at 16:59
  • When powering the Uno with 3V at its 5V input, then its underpowered. It might work (since the microcontroller on it is technically capable of working at 3V), but it might be unstable, especially when your batteries voltage goes lower while you are emptying them. And: Please explain what you want to learn from the voltage on the LED pin? It is mainly determined by the LEDs forward voltage and the resistor values in relation to the current supply voltage. And are you adding another LED to that pin? Since pin 13 already is connected to an LED you would need to also take that into account.
    – chrisl
    May 13 at 18:06

1 Answer 1


Pin 13 is a digital pin, it does not have the capability to read voltage. You need to use one of the analog pins to read voltage, they are prefixed with the letter "A" (A0 for example). You also need to note the Analog reference (maximum voltage reference point for the A/D) is the Arduino's +5 volt supply so if that changes so will the readings. You will get 0 with zero input and 1023 when the voltage matches the reference voltage. Note this voltage cannot exceed VCC by more than a very small amount (0.6V)or you will damage the Arduino. The USB supplies about 4.5 volts, depending on the protection circuit. If you power it via Vin with the appropriate voltage it will have nominally 5 volts and of course the ever changing battery voltage. All of these change your reference voltage changing your voltage measurement. The best solution is to power it externally and then connect the battery - to ground and the battery + to one of the A/D inputs. With a little math in your code you will have a voltmeter. There are many fine examples on line complete with code for the Arduino.

Your Answer

user220704 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.