i have working setup with 1 issue - i cannot seem to get the reading to go pass 5.30V
using code from web, changed values of R1/R2 and Vref.
it works very, very close to DVM reading but i can have 7V input and still only outputs reading of 5.30V on screen.
why is this so???
/*
Voltmeter
Voltmeter base on voltage divider concept.
Code based on: http://www.clarenceho.net:8123/blog/articles/2009/05/17/arduino-test-voltmeter
Coded by: arduinoprojects101.com
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
// variables for input pin and control LED
int analogInput = A2;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0; // !! resistance of R1 !! 100K
float R2 = 1000000.0; // !! resistance of R2 !! 1M
// variable to store the value
int value = 0;
void setup(){
// declaration of pin modes
pinMode(analogInput, INPUT);
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("Vin=");
}
void loop(){
// read the value on analog input
value = analogRead(analogInput);
vout = (value * 4.82) / 1024.0;
vin = vout / (R2/(R1+R2));
Serial.println(vin);
delay(500);
}