Sensor Accuracy Aref or VCC?

Hi Guys!

I know for some point, people like myself tend to ask questions about the accuracy of sensors and readings.

Background of my setup:
1x LM35 sensor
2x 220 ohm resistors acting as voltage divider

My objective:
measure temperature and voltage across the divider XD

Question:
I know people tend to use 5v*sensor reading/1024 to get the feed back voltage. And i know it is not accurate, after googling i have found this to get the real voltage reading, codes are here :

long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
return result;

(adopted from Google Code Archive - Long-term storage for Google Code Project Hosting.)

and i have also read up some information about using the Aref in Tutorial: Arduino and the AREF pin | tronixstuff.com

So, lets keep it short, which method is better? :grin:

Thanks in advance!! :wink: :wink:
Regards,

If you notice in the datasheet that the 1.1V reference is only accurate to about 10% (1.0V to 1.2V) you will learn that measuring Avcc that way will be no more than 10% accurate.

You can calibrate the internal reference for much better performance, but then you have to keep the calibration value somewhere (eeprom?).

The datasheet doesn't say anything about the repeatability or tempco of the bandgap reference, alas, its unclear how well it performs once calibrated.

Probably better to state what your accuracy desires are, what range voltages you wish to measure, and what minimum step size resolution you need. Then possible references can be offered. The built in arduino ADC is very useful and easy to use, but it should not be confused with instrumentation quality ADC. There are lots of I2C and SPI driven ADC chips available these days if your specifications require the performance they bring to the table.

Lefty