You are on page 1of 6


free energy
Submit article
Power supply

Arduino Digital Voltmeter
This circuit was tested and worked properly!
Posted by T.K. Hareendran in Arduino, Tested with 3 comments


Arduino Digital Voltmeter
1 of 6 9/16/2014 9:47 PM
Print to PDF without this message by purchasing novaPDF (
Here is a useful circuit for Arduino lovers and experimenters. It is a simple digital voltmeter, which can safely measure
input dc voltages in 0 to 30V range. The Arduino board can be powered from a standard 9V battery pack, as usual.
As you may well know, Arduinos analog inputs can be used to measure DC voltage between 0 and 5V (when using the
standard 5V analog reference voltage) and this range can be increased by using two resistors to create a voltage divider.
The voltage divider decreases the voltage being measured to within the range of the Arduino analog inputs. Code in the
Arduino sketch is then used to compute the actual voltage being measured.
The analog sensor on the Arduino board senses the voltage on the analog pin and converts it into a digital format that can
be processed by the microcontroller. Here, we are feeding the input voltage to the analog pin (A0) using a simple voltage
divider circuit comprising resistors R1 (100K) and R2 (10K). With the values used in the voltage divider it is possible to
feed voltage from 0V to 55V into the Arduino board. The junction on the voltage divider network connected to the the
Arduino analog pin is equivalent to the input voltage divided by 11, so 55V 11 =5V. In other words, when measuring
55V, the Arduino analog pin will be at its maximum voltage of 5V. So, in practice, it is better to label this voltmeter as
0-30V DVM to add a safety margin!
Arduino Digital Voltmeter
2 of 6 9/16/2014 9:47 PM
Print to PDF without this message by purchasing novaPDF (
If the display reading didnt match when comparing with your lab DVM, use a precision DMM to find the actual
resistance of R1 and R2, and replace R1=100000.0 and R2=10000.0 in the code with that values. Next check the
5V supply with the lab DVM at GND and 5V pins on the Arduino board. It might give you less (for instance
4.95V), replace the value into the code vout =(value * 5.0) / 1024.0 (ie replace the 5.0 value to the actual V
reading, in this case 4.95V). Further,always try to use precision 1% tolerance resistors for R1 and R2.
The resistor values (R1&R2) in the circuit diagram provide some over-voltage protection then measuring low
voltages. Keep it in mind that any input voltage higher than about 55V could fry the Arduino. No other protection
(for voltage spikes, reverse voltages or higher voltages) is incorporated in this circuit!
Arduino Digital Voltmeter Sketch
/ * 1.
DC Vol t met er 2.
An Ar dui no DVM based on vol t age di vi der concept 3.
T. K. Har eendr an 4.
*/ 5.
#i ncl ude <Li qui dCr yst al . h> 6.
Li qui dCr yst al l cd( 7, 8, 9, 10, 11, 12) ; 7.
i nt anal ogI nput = 0; 8.
f l oat vout = 0. 0; 9.
f l oat vi n = 0. 0; 10.
f l oat R1 = 100000. 0; / / r esi st ance of R1 ( 100K) - see t ext ! 11.
f l oat R2 = 10000. 0; / / r esi st ance of R2 ( 10K) - see t ext ! 12.
i nt val ue = 0; 13.
voi d set up( ) { 14.
pi nMode( anal ogI nput , I NPUT) ; 15.
l cd. begi n( 16, 2) ; 16.
l cd. pr i nt ( "DC VOLTMETER") ; 17.
} 18.
voi d l oop( ) { 19.
/ / r ead t he val ue at anal og i nput 20.
val ue = anal ogRead( anal ogI nput ) ; 21.
vout = ( val ue * 5. 0) / 1024. 0; / / see t ext 22.
vi n = vout / ( R2/ ( R1+R2) ) ; 23.
i f ( vi n<0. 09) { 24.
vi n=0. 0; / / st at ement t o quash undesi r ed r eadi ng ! 25.
} 26.
l cd. set Cur sor ( 0, 1) ; 27.
Arduino Digital Voltmeter
3 of 6 9/16/2014 9:47 PM
Print to PDF without this message by purchasing novaPDF (
l cd. pr i nt ( "I NPUT V= ") ; 28.
l cd. pr i nt ( vi n) ; 29.
del ay( 500) ; 30.
} 31.
Schematic of the Arduino DVM Circuit
Arduino Uno Board
100K Resistor
10K Resistor
100R Resistor
10K Preset Pot
162 Parallel LCD ( Hitachi HD44780 driver compatible)

Tweet 2

Arduino Room

Arduino Due

Arduino Ethernet

Brightness or Fan
3 Responses to "Arduino Digital Voltmeter"
Mohan says: on March 28, 2014 at 2:39 pm
Great Job!
Arduino Digital Voltmeter
4 of 6 9/16/2014 9:47 PM
Print to PDF without this message by purchasing novaPDF (
I was wondering if this can be modified to use to measure car Fuel level and display it in digital format. I am not
sure if there would be any risk in connecting this to the car battery and the fuel guage or fuel sender unit.
What do you think?
Almako says: on May 22, 2014 at 8:09 pm
Thanks for your work, its useful, I used this code for a project, but I had to correct it on line 23:
vin =vout * (R2/(R1+R2));
And I must changed (R2/(R1+R2)) with a constant because arduino(1.0.5) returned an error.
Jose E says: on J uly 30, 2014 at 7:19 am
Ok.. what do you propose wvoltage range is low but current is dangerously high?
What do you think about this article? Leave a comment!
Name (required)
Mail (will not be published) (required)
You may add a picture too No file selected.
Check this checkbox to get notifications of followup comments via e-mail. You can also subscribe without
electroschematics partners
Arduino Digital Voltmeter
5 of 6 9/16/2014 9:47 PM
Print to PDF without this message by purchasing novaPDF (
Remember Me
lets talk about electronics!
ElectroSchematics Community on Google+
Recent Questions
how do I "declare serial" ?
What type of Arduino Board use for the arduino water level indicator +controller project?
I need a replacement for CA 3130, my circuit is a sound level meter.
recently added electronic circuits
3-Wire Cooling Fan Monitor
Balancing Ni-MH Battery Packs
SCR Based SSS Solar Charge Control
AVR Bootloader Tutorial #18
Fluorescent Lamp Driver with Starter
Links - Policy - Disclaimer - Copyright 2008 - 2014
Arduino Digital Voltmeter
6 of 6 9/16/2014 9:47 PM
Print to PDF without this message by purchasing novaPDF (