Step 0 0 to 4.8828124mVStep 1 4.8828125 to 9.765624...Step 1023 4.9951171875 to 5.0 V
Step (count) 0 0 to 4.8828124mVStep (count) 1 4.8828125 to 9.765624...Step (count) 1023 4.9951171875 to 5.0 V
Using 1024 has the advantage that the maths can be much faster (but not using map() ).
Or, put more succinctly, you could RTFM, and see what the device's own manufacturer recommends..
3) If there are 10 people living in each house, we will still not know who's bottle it was, but with 1 bin per house, at least we can narrow it down a bit.
Except that Atmel was not brave enough to explain (in the Atmega 328 datasheet at least) how to convert an ADC reading back to the voltage from which the reading was obtained.I don't think any of the subsequent comments have improved on @CodingBadly's Reply #75...R
The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB.
No, really, really RTFM. As in, download the datasheet, and read it.
The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB.
I didn't expect any replies on this topic...
In this image above...
a difference of 4.77microVolt (0.00477mV), much smaller than the expected fluctuations in the reference voltage in any case.
I don't think any of the subsequent comments have improved on @CodingBadly's Reply #75
So, as I wrote in #87, the last bucket is larger than the previous?
That may be true for your references but it is not true for mine.
It clearly explains how it converts voltages to ADC values. It does NOT explain how to convert ADC values to voltages.
No matter whether you use 1023 or 1024 the bucket size is the same for each step. 5/1023 or 5/1024.
If you use 1023, then voltage value returned has a progressive shift from returning the minimum value to returning the maximum value. Count = 0 returns 0V for voltages from 0 V to just short of 4.887586mV (5/1023), but count = 1023 returns a value of 5V, and is returned for any voltage from 4.995112 through 5V.
If you follow the datasheet, then each bucket is 5/1024 volts and count = 0 returns 0 V for input voltage up to 4.8828124mV and count = 1023 returns 4.995117mV for all input voltages from there to 5V. Using 1024, 5V is never returned; that is what the datasheet is saying.
Using 1023 divider you read 0V from 0V to 5/1024V. You read 5/1023V for input from 5/1024V to 10/1024V etc. But you are right the returned value is "drifting" in the correct range.
The datasheet does not say you should use 1024 and so you cannot get 5V! It just says 1023 represents voltage higher than Vref-1LSB. It is up to you what value you assign to this range.
This just shows how incompetent you are for this discussion.