Arduino Voltmeter

LCD voltmeter example

YOU SHOULD NOT MEASURE MORE THAN 5v or reverse the polarity, you risk causing damage to your Arduino

arduino voltmeter
arduino voltmeter

 

I tested a 1.5v battery, the reading was 1.50v, using my multimeter I read 1.58v.

Code

#include <Wire.h>
#include <LiquidCrystal.h>

int analogValue = 0;
float voltage = 0;

// Connections: Sainsmart LCD/Keypad shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup()
{
//Serial.begin(9600);
delay(1000);
//setup the LCD
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print(“Voltage”);
//Serial.begin(9600);

}

void loop()
{
analogValue = analogRead(1);
voltage = 0.0048*analogValue;

lcd.setCursor(0,1);
lcd.print(voltage);
delay(1000);

}

Previous articleHMC5883L Arduino example
Next articleArduino and an IR reciever