title: Arduino analogRead() with AREF internal
body: <p>So, this is my simple voltage divider code:</p>
  
  <pre><code>int sensorValue = 0;
  
  void setup() {
  
    analogReference(INTERNAL); 
  
    Serial.begin(9600);
  }
  void loop() {
  
    sensorValue = analogRead(A0);
  
    // ADC , AREF=1078mV=Vin
  
    Serial.println(sensorValue);
  
    delay(1000);
  
  }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/PjeMY.png" rel="nofollow">Scematic</a></p>
  
  <p>The analog reference is set to INTERNAL and this means that divider's Vin=AREF=1078mV. With multimeter i read 350 mV as Vin and 181 mV as Vout</p>
  
  <p>But the analogRead(0) outputs 1023, so its on the end or out of reference.</p>
  
  <p>As i understand that the R1=100,6 Ohm resistor is messing things up. </p>
  
  <p>When i replace R1=1000 Ohm then analogRead=98 and Vin=1070mV, everything looks ok. </p>
  
  <p>But what really happens when i use 100,6 Ohm as R1 ? Can somebody further explain this ?</p>
  
  <p>Also, Arduino official says that there is 32000 Ohm internal resistor on AREF 
  pin. </p>
  
  <p>*Alternatively, you can connect the external reference voltage to the AREF pin through a 5K resistor, allowing you to switch between external and internal reference voltages. Note that the resistor will alter the voltage that gets used as the reference because there is an internal 32K resistor on the AREF pin. The two act as a voltage divider, so, for example, 2.5V applied through the resistor will yield 2.5 * 32 / (32 + 5) = ~2.2V at the AREF pin.*</p>
  
  <p>How i have to take this into account when i measure the divider's voltage and use analogReference(INTERNAL); // 1.1 V as reference and Vin</p>
  
  <p>I know that it's better to use external ref voltage, but when i want to use INTERNAL 1.1V as ref and supply, is it possible ?</p>
  
  <p>Thanks for any suggestions !</p>