Go Down

Topic: Analog 1.1 VDC A/D reference does not compute? (Read 1 time) previous topic - next topic

ArduinoAndy

Using the internal analog 1.1 VDC A/D reference does not compute?

I am using a temperature sensor LM34DZ as an input to an Arduino analog input.
The "default" internal voltage ref of ~ 5 vdc is being used.
The LM34DZ outputs a voltage equal to 10mv/deg F.
The analog voltage input reads 0.7952 volts @ 10mv/F = 79.52F
The analog count is 159 out of 1024 steps or 0-1023 (10 bit A/D)
159/1023 = .155425219941 X 5000 (mv) = 777.126099705 / 10 mv/F = 77.71 F
This calculation both on the front end voltage and the A/D count is close.

Notes: The exact voltage ref (default) is not exactly 5 VDC but a number close to 5 VDC eg 5.06982.
This gives the calculation 78.77F. vs 79.52F using a 50,000 count voltmeter.
This default ref voltage varies between chip to chip.
The accuracy of the "cheaper" LM34DZ is +-2F


I decided to use the internal A/D 1.1 VDC Voltage ref by using the new command
analogReference(INTERNAL);
The AREF on pin 21 changed from 5VDC to ~ 1.0729 VDC.
The count changed from 159 to 252 with the same input voltage from the LM34DZ.
What does this count of 252 represent?


Note: I am using rev 14 and my various chips are 168P/328P with approximately the same results.
Note: The AREF is not connected to any external voltage source.  

:o :o :o


"Never trust an Internet bully who insults and makes fun of your level of intelligence."

RuggedCircuits

That....makes no sense. I would have expected a count closer to 720.

Did you take multiple readings? Any chance you're only reading one of the A/D registers (ADCH / ADCL) instead of both?

ArduinoAndy

I am "eating crow" on this one.
My variable is a byte and I needed to change it to an int when
changing to the 1.1 VDC internal ref.
count 778/1023 * 1100 / 10 works out to my new ambient temp.
:-[ :-[ :-[ :-[ :-[
"Never trust an Internet bully who insults and makes fun of your level of intelligence."

Marco Benini

Ciao,

if you are hanging the analog reference from standard to internal in the sketch take into account that a analog read + a delay are needed before internal reference is operational.

Here a portion of code that works for me
...
       // Temperature sensor LM35DZ - Change of analog reference voltage
       // Put to INTERNAL: 1.1 V
       // One analog read + delay are needed to make change operational
       analogReference(INTERNAL) ;
       analogRead(5) ;  // 5 = analog pin 5
       delay(100);  
       
       analog_val_temp = analogRead(5) ; // 5 = analog pin 5

       // Return to DEFAULT analog reference voltage (5V)
       analogReference(DEFAULT) ;
....

Have a nice day.
Marco.

Go Up