# Problem regarding analog input in Arduino nano

I have given 9 to 15 volt to the Aurdino nano through the potential divider. The input is given to the A6 pin of Aurdino nano. I want to check the given input in the serial monitor of Aurdino software, but serial monitor is showing the voltage range from 666.43 to 989.37. Why the serial monitor is showing like this?. My program is given below, and circuit diagram is given in attachment.

Programme:
int analogpin=A6;
int i,n=100;
float val=0,v2=0;
void setup()
{
pinMode(analogpin, INPUT);
Serial.begin(9600);
}
void loop()
{
v2=0;
for(i=1;i<n;i++)
{
v2= v2+val;
delayMicroseconds(50);
}
v2= v2/n;
Serial.println(v2);
}

I have given 9 to 15 volt to the Aurdino nano through the potential divider.

Please post a schematic or a very clear photograph of your circuit

Hi,
The analogRead does not return a value of Volts.
It returns a counter value from the AtoD between 0 and 1023.
If you are using 5V as the reference then;

An AtoD count of 1= 5.0/1023.0 = ‭0.0048Volts

So using your counts;
666.43 x 0.0048V = 3.25V at the analog input.
989.37 x 0.0048V = 4.83V at the analog input.

Using your potential divider;
Vanalog= 9.9/(9.9+21.5) x Vin
Vanalog = 0.315 x Vin

Vin = Vanalog / 0.315

Vin >>>> 3.25/0.315 = 10.30V
Vin >>>> 4.83/0.315 = 15.13V

Do you have a DMM to check your Vin and Vanalog voltages?
There should be no reason to average your readings, however a 0.1uF capacitor will help if placed between the analog input and gnd.

Tom...