# Arduino Digital Voltmeter 0V to 30V

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, Arduino’s 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!

Notes

• If the display reading didn’t 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

```/*
DC Voltmeter
An Arduino DVM based on voltage divider concept
T.K.Hareendran
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int analogInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0; // resistance of R1 (100K) -see text!
float R2 = 10000.0; // resistance of R2 (10K) - see text!
int value = 0;
void setup(){
lcd.begin(16, 2);
lcd.print("DC VOLTMETER");
}
void loop(){
vout = (value * 5.0) / 1024.0; // see text
vin = vout / (R2/(R1+R2));
if (vin<0.09) {
vin=0.0;//statement to quash undesired reading !
}
lcd.setCursor(0, 1);
lcd.print("INPUT V= ");
lcd.print(vin);
delay(500);
}
```

## Schematic of the Arduino DVM Circuit

Parts

• Arduino Uno Board
• 100K Resistor
• 10K Resistor
• 100R Resistor
• 10K Preset Pot
• 16×2 Parallel LCD ( Hitachi HD44780 driver compatible)

• Mike Dodd
• Mike Dodd

The ADC on the typical Uno/Mega devices is 10-bit, so only gives 3 significant digits accuracy.

If you want more significant digits you’ll need to interface to a high precision ADC somehow.

• Mayur

In ardino I got only two decimal value e.G. 12.02 ,20.45etc for more accurate and precision measurement I need more digital after point like 12.02123; 20.45557; 27.34567
Any solution….

• Myluck

Yes mike,
I want log data also. There is any others application is there , that I can used !!;

• ramosdennis1yahoo-com

Hi my name is Dennis, just wonder if somebody can help me to modify sketch a little bit.

I am interested an arduino voltmeter with led plus logger with date

Highly appreciate if somebody can do it for me.

Many thanks

• Mike Dodd

@Ramosdennis1 – You’ve got a few issues to consider there – As well as the logging issues (storage) you’ve got a real-time clock problem to resolve. I’m pretty sure you can get combined modules with IIC bus, that provide both RTC and EEPROM on the same card for a couple of quid/bucks. You just need to read up on the “wire” library to interface with these.

@Myluck – why not simply output either the scaled, or raw analogue values over the serial link on the Arduino – you can then log the data with a terminal package or dedicated software.

• Myluck

Can i read same volt by PC, I need your support on this

• Mike Dodd

Data logging is a separate issue, you just need to combine the principle of sampling data (e.g. the A/D interface discussed here) with a periodic scheduler that writes the resulting data to non-volatile memory. It’s almost certain that you’d need to look at the scope of the data that you’re looking to store to consider what peripheral device (IIC EEPROM) and particular what capacity you’d require.

Every case offers several solutions, but I wouldn’t confuse this thread with logging issues.

• Joe

Can you update this tutorial with data logger?
Maybe some new follow up topic?
I would like to measure some voltage from sensor periodically every 60 seconds for 2-7 days and save data to SD card in txt file.

Something like measuring sunlight brightness during the day, or speed of wind – weather station.

You could use “XD-05 Arduino Arduino Data Logging Shield Module” or just ”
SD Card Reading Writing Module for Arduino”.

• Ravindran

Thank you for sharing this project. I need to measure DC Voltage supplied to a 24V DC motor. The current can go up to 60 A while testing the motor. How can i use this system for measuring voltage where the current might range from 0 A to 60 A? Thanks for your help.

• Navida

Could you please tell me how can I make the voltmeter that have a sampling rate of 5Hz?

Looking for the latest from TI?