Go Down

Topic: Sensor Accuracy Aref or VCC? (Read 1 time) previous topic - next topic


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

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 http://code.google.com/p/tinkerit/wiki/SecretVoltmeter)

and i have also read up some information about using the Aref in http://tronixstuff.wordpress.com/2010/12/07/tutorial-arduino-and-the-aref-pin/

So, lets keep it short, which method is better? :smiley-mr-green:

Thanks in advance!! ;) ;)


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.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


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.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


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.


Go Up