voltmeter

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);
}

The values of 100k and 1M are very high. Perhaps you can add a capacitor of 1nF or 10nF from A2 to GND.
Which one of the resistors is to GND and which one is to the measured voltage ?

The function analogRead() does not need a pinMode(..., INPUT). You may remove that.

100K is +V
1M is GND
both 1% 1/4W

i switch R1/R2 for lower values
100K is now +V
10K is GND
added 10nF

seems to be working great now.
it is .01 to .02 volt difference from DVM.
id say that very accurate.

Normally about 10k is from analog input to GND, and a higher value (100k to 1M) from analog input to the voltage to measure.

When you have the high value of 1M from A2 to GND, that makes it inaccurate. Could you try 100k for both ?