I am trying to get the Aref pin to work so I can scale down analog input references for better resolution. I cannot figure out what I am doing wrong here.
I am using the 3.3V supply from the Uno board through a voltage divider of 1.5M and 1K resistors. This provides around 2.19mV. I connect that to the Aref, and the GND below the Aref to the bottom of the divider. No matter what I do, I cannot read anything but 1023. I am understand the floating pin, but it doesn't go to 0 when grounded. I have tried just connecting it to the 3.3V supply directly (to AREF), and that works. I have tried INTERNAL and DEFAULT analog references, and they seem to work fine. It is only when I try and scale it down that it won't read. Also, I have tried multiple analog pins in case one was bad or something.
Divider:

Below is the code, however, I suspect there is something else going on as it work fine on a direct connection to board voltages...
Any help would be appreciated
float test;
float coeff[] = {0 , 1.978425E+2 , -2.001204E-7 , 1.036969E-11 , -2.549687E-16 ,
3.585153E-21 , -5.344285E-26 , 5.099890E-31}; //Type J coefficients
float temp;
float temp_comp;
long time_ref; //time to act as start time reference (milliseconds)
long time_current;
int analogpin = A1; //analog pin to use
int analoginput = 0; //integer value 0-1023 input from pin
void setup(){
Serial.begin(9600);
analogReference(EXTERNAL); //use AREF as voltage reference
Serial.println("Anolog input testing");
}
void loop(){
delay(2000);
time_current = millis(); //timestamp
// analoginput = 0;
analoginput = analogRead(analogpin); // reads analong input pin and stores to variable
test = 0;
temp = 0;
temp_comp = 0;
test = map(analoginput, 0 , 1023 , 0 , 2150); // maps 0-1023 to 0-2150 microvolts
test = test/1000; // converts microvolts to millivolts
temp = tc_calc(test);
temp_comp = temp + 21.222;
Serial.print(time_current);
Serial.print("\t");
Serial.print(analoginput);
Serial.print("\t");
Serial.print(test);
Serial.print("\t");
Serial.print(temp);
Serial.print("\t");
Serial.print(temp_comp);
Serial.println("");
}
// Thermocouple Calculations
float tc_calc(float tc_mv){
int i = 0;
while(i <=7) {
temp = temp + coeff[i]*pow(tc_mv,i);
i++;
}
return temp;
}