# Thermistor is accurate on Arduino, but is off by 10 degrees F on wemos d1 mini

I'm new to electronics and followed a simple thermistor tutorial which worked flawlessly. It uses Arduino Uno, a 10k thermistor and a 10k resistor.

Now I'm trying to use the exact same circuit except with a Wemos D1 Mini, but the temperature is now about 10 degrees Fahrenheit higher than when I was using the Arduino.

The only difference I can see is that the Wemos D1 Mini uses 3.3V instead of the Arduino's 5V. Could this make a difference in the temperature reading? However, if I use the Wemos D1 Minis 5V pin, the temperature is about 60 degrees F off so I'm not sure what is going on.

What might cause this 10 degree difference and what can I do to fix it?

Circuit:

simulate this circuit – Schematic created using CircuitLab

Code:

void setup() {
Serial.begin(9600);
}
float currentTemp(int tempPin) {
double tempK = log(10000.0 * ((1024.0 / tempReading - 1)));
tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK );       //  Temp Kelvin
float tempC = tempK - 273.15;            // Convert Kelvin to Celcius
float tempF = (tempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return tempF;
}

void loop()
{
double tempF = currentTemp(A0);
Serial.println((String)"tempF: " + tempF);
delay(1000);
}
`

The "Wemos D1 Mini" appears to be based on the ESP-8266. BTW, your voltage source is shown upside-down.

The ESP-8266 ADC span is not very well controlled but it's approximately 1V. There is typically a divider - 220K in series with 100K on the input to accept approximately 3.2V F.S.

The resistor + thermistor circuit is ideal (well, aside from self-heating) in a ratiometric arrangement where the Vref for the ADC is the reference voltage for the half-bridge. That's the situation with a 5V Arduino.

In this case, you're using Vcc of approximately 3.3V, which is not directly related to the (very) approximately 1V reference for the ADC and there is a divider in parallel with the 10K resistor.

Thermistors change a lot with temperature, so the 10F is probably ~20% in terms of resistance or ~10% FS in terms of voltage at the ADC.

There is no stated tolerance on the ADC reference from the manufacturer so it's really only suitable for coarse measurements. If you want to continue fiddling with it, I suggest reading the voltage at the board ADC pin and the MCU ADC pin with an accurate meter to figure out where the errors are coming from. Generally it would be better to use an external ADC where accuracy is of concern.

To look at it another way, ideally two 10K 1% resistors would yield an ADC reading of 512 and a temperature reading of 25°C (assuming the thermistor is 10K at 25°C). The divider loading, divider tolerance, and the highly variable Vref will all affect the actual reading.