I am doing this:
double tempC(int sensorPin) {
int analogVal = analogRead(sensorPin);
double temp;
temp = log(((10240000/analogVal) - 10000));
temp = 1 / (0.001129148 + (0.000234125 * temp) + (0.0000000876741 * temp * temp * temp));
temp = temp - 273.15;
return temp;
}
When putting analogReference(EXTERNAL); and hook up the AREF with 3.3V pin of the Arduino, I'm getting readings of 46—46.3ºC and 48—48.3ºC when it should be around 24.6ºC. I'm sure I'm missing something out.