This is how I see this - may be we will get everyone to agree

Let's assume everything is perfect from a hardware perspective and no bias is introduced

- you input a voltage

V between

GND and

V_{cc} -

analogRead() gives you a value of

xAs documented in the datasheet,

x represents any voltage between

x * V_{cc} / 1024 and

(x+1)* V_{cc} / 1024 That means that if you take

V_{est} =

x * V_{cc} / 1024 as the measure, you are saying that you

always take the

lowest value of the interval as your estimated voltage read so you are

always undershooting. It means that your max absolute error can be as big as

V_{cc} / 1024 for every possible value of

x. You have a constant distribution of the error

Now if you were to take the value divided by 1023:

V_{est} =

x * V_{cc} / 1023 to represent a fair possible value, what does that mean?

There are two key questions: #1/ Is this

V_{est} a fair possible original voltage value, ie are you within the right interval for every possible value of

x?

#2/ what is the distribution of the max error for every possible value of

xfor #1 it's easy to prove that for every possible value of

x in

[0, 1023] x * V_{cc} / 1024 <= x * V_{cc} / 1023 <= (x+1)* V_{cc} / 1024

--> So

V_{est} =

x * V_{cc} / 1023 is a possible value and thus mathematically as correct as any other value in the interval

for #2, it's best to see how

V_{est} moves across the possible interval depending on

xWith this approach one sees (the blue arrow) that

V_{est} will vary between the min of the interval and the max when

x varies between

0 and

1023--> thus whilst it means that your max absolute error can be as big as

V_{cc} / 1024 for

x = 0 or

x = 1023, for the other values of

x, the max absolute error will be less and at

x~511 you have divided by 2 the max absoute error compared to the other approach.

Conclusions:

1. dividing by 1023 or 1024 gives

in both cases a

likely estimate of the original input value

V and thus

are both correct. everyone wins 2. dividing by 1023 statistically minimizes the maximum absolute error and thus it's fair then to assume that you get statistically a better approximation of your true original input value

V if you use 1023

----> THIS IS WHY I THINK 1023 IS BETTER THAN 1024 (and you get a nice 5V for 1023)

That being said, the assumption we made initially that everything is perfect is never true...

so in practice you can do what you want, it does not matter much or if this level of precision is important for your project, then you probably need to invest in better hardware...