Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
manodeep
Published © CERN-OHL2

Voltage Measurement using Arduino

Voltage measuring device using Arduino.

BeginnerFull instructions provided11,251
Voltage Measurement using Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 100k ohm
Resistor 100k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Voltage measurement using Arduino

Code

Voltage measurement using Arduino

Arduino
float input_volt = 0.0;
float temp=0.0;
float r1=10000.0;    //r1 value
float r2=100000.0;      //r2 value

void setup()
{
   Serial.begin(9600);     //  opens serial port, sets data rate to 9600 bps
}

void loop()
{
    int analogvalue = analogRead(A0);
    temp = (analogvalue * 5.0) / 1024.0;  // FORMULA USED TO CONVERT THE VOLTAGE
    input_volt = temp / (r2/(r1+r2));
    if (input_volt < 0.1) 
    {
      input_volt=0.0;
    } 
    Serial.print("Voltage= ");                 // prints the voltage value in the serial monitor
    Serial.print(input_volt);
    Serial.println(" Volts");
    delay(1000);
}

Credits

manodeep

manodeep

0 projects • 4 followers

Comments