Digital Arduino Voltmeter

Description
 
      A Voltmeter or a Voltage Meter is a measuring instrument that is used for measuring voltage or potential difference between two points in a circuit. Voltmeters are an important piece of equipment which are associated with any kind of electronics project. They are used in measurement of both AC and DC voltages. In this project, we are going to design a Arduino based Digital Voltmeter which can measure voltages up to 50V. Okey, let's see how it works.
    
Components Required

 1. Arduino UNO   * 1
 2. Bread Board  * 1
 3. Resistor(100K ohm)  * 1
 4. Resistor(10K ohm)    * 1
 5. Jumper Wires   * 1

Circuit Diagram







Program

int analogInput = 1;
float Vout = 0.00;
float Vin = 0.00;
float R1 = 100000.00;  // resistance of R1 (100K) 
float R2 = 10000.00;  // resistance of R2 (10K) 
int val = 0;
void setup(){
   pinMode(analogInput, INPUT);  //assigning the input port
   Serial.begin(9600);  //BaudRate
}
void loop(){
   
   val = analogRead(analogInput); //reads the analog input
   Vout = (val * 5.00) / 1024.00;  // formula for calculating voltage out i.e. V+, here 5.00
   Vin = Vout / (R2/(R1+R2));  // formula for calculating voltage in i.e. GND
   if (Vin<0.09) //condition 
   {
     Vin=0.00 ;//statement to quash undesired reading !
  } 
Serial.print("\t Voltage of the given source = ");
Serial.print(Vin);
delay(1000); //for maintaining the speed of the output in serial moniter
}