Measuring Voltage using an Arduino Uno

How can one measure or monitor voltages greater than 5V using an Arduino board? The easiest way is to use a voltage divider network — which consists of only two resistors as shown in the circuit diagram below.

A full article on the subject is available with more information, code (an Arduino sketch) and some precautions that need to be taken into consideration.

Arduino Voltmeter Circuit

Arduino Voltmeter Circuit

17 thoughts on “Measuring Voltage using an Arduino Uno

  1. Great tutorial!

    I’m thinking in the precision for measuring only between 0 to 12v, I want to improve the precision.

    What you think about I change the value of 100 k resistor? Can I reduce the interval of the measures? Maybe changing for a higher value. What you think?

    Thank you!

    • Replacing the 100k resistor with a 680k resistor will let you measure a voltage up to 12.353V. But anything above this value could damage the Arduino.

  2. Hello,

    I am just starting with Arduino. In your post “Measuring DC Voltage with Arduino”, may I know why the input voltage will be divided by 11. I just wondering were did you get the value 11.

    Thanks in advance.

    Best Regards,

    • Hi,

      Please disregard my questioned above. I already found the answer at the bottom part of the tutorial. I guessed I was just too excited that I forgot to read all. Thank you very much for this, just in time for the project that I am working.

      Could you also please make some tutorial on Ohmmeter, Ammeter as well as Frequency Counter using Arduino Uno. My project is to make an Arduino as DMM. I really like your tutorial, the codes are very well explained.

      Thanks again,

  3. Hello,

    I want to measure battery voltage range of 20 volts to 35 volts, whether it is safety for Arduino ? do not needed a capacitor?

    Thanks in advance.

    Best Regards,

    • Hi alex
      The resistor values in the circuit diagram allow for up to 55V to be applied. If you are measuring up to 35 volts max, then the circuit still has a 20V safety margin.

      If you are measuring batteries, it should not be necessary to use a capacitor as batteries should be pretty much noise and ripple free.

  4. I followed your tutorial but i keep getting 55.77 V readings on serial monitor, do you have any idea what seems to be the problem ?

  5. Hi, I really like your tutorial, it made me understand a lot of things I needed to understand, Thank you kindly.
    I’m researching about energy generated in microbial cells, I’m monitoring 4 sets of cells ranging from -2V. to 10V. and I made a 4 voltmeter with a pro mini and a LCD.
    I’ve replaced the resistor values to accomodate the impedance so that it doesn’t affect the cells but there isn’t any noise (which appear with the 1Mohm when measuring with the 4 analog pins at the same time).
    The values I’m using are 270Kohms and 100Kohms. These give me a ~3.7 voltage divider.
    I’ve got a problem that keeps me from being able to use it, when I calibrate with a 6V battery, it reads perfectly voltages between 10 and 4 volts but it becomes very unreliable when measuring lower voltages. The error is in the order of 12% lower.
    Is there a way to obtain really reliable results (tenths of millivolt) in the whole range from 8V. to 0V.?


    • Hi Diego
      It looks like there is some non-linearity in your circuit. I would really need to build the circuit and test it to find a good solution, but I don’t have time for that now.

      These are just some thoughts off the top of my head on what can affect the ADC reading:

      The first thing to do is to check that the ADC reference voltage is not changing over the range that you are measuring (check with a multimeter). Then check the voltage across the voltage divider and the actual voltage being measured. Do the calculation manually to see if there is any error in the calculation in the code. You can also calculate what the analog value (in the range 0 to 1023) is and then output the analog value that the Arduino is seeing and compare the two.

      Are you powering the Arduino from USB power or from an external power supply? If the Arduino is powered from USB power, the 5V can vary and therefore the 5V reference can vary as the Arduino and attached circuitry draws more or less power. This is because there is a resettable fuse on the USB 5V input. A resettable fuse has an internal resistance that will cause the voltage across it to change as more or less current is drawn. This in turn affects the 5V on the output of the fuse. Check that your 5V reference is not changing.

      I’m assuming that the internal pull-up resistors on the Arduino analog inputs are disabled by the Arduino code. If they are not, this will change your voltage divider value.

      The only real way to know what is going on is to take measurements with a multimeter and compare with what the Arduino is seeing and what the Arduino is calculating.

  6. Hi, great tutorial!! I got a lot out of read your article. However, when i used your sketch, i changed the value of the resistors I am using 100k and 10k. On the serial monitor it displays 55.77 and when I change the voltage on the variable power supply (i started at 5.0V) the serial monitor displays a two digital voltage. I am using the arduino mega 256 and pin A15. any ideas????


  7. Hello ,
    Thank you so much for this tutorial, very simple and helpful .
    I need to measure a voltage of solar panel (up to 30 volt)
    and save the values to SD card , can I use this circuit and take the output to SD card instead of serial monitor ?!

  8. Hey ,
    If I use this circuit with battery 9 Volts with this code
    int val=0;

    void setup ()

    void loop ()
    int V = analogRead(val);
    Serial.println(” Volt”);
    But I keep getting 170 volt
    What I have to change in this code?
    and can I make one hour delay??


Leave a Reply

Your email address will not be published. Required fields are marked *