Need help with BBQ sensor probe

Hi Guys,

I´m having trouble getting good readings from my BBQ Temp probe attached to a NodeMCU. I measure aroung 245 °C room temperature where should be 22°C...

I´m using a 10K resistor and I measured a resistance of the probe of 50.000 Ohm at 24 °C. Below you can find my code and hopefully you can give me some hints what I am doing wrong...

I´m using this probe, unfortunately I have no datasheet: https://smile.amazon.de/gp/product/B071HC9S75/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

// which analog pin to connect
#define THERMISTORPIN A0         
// resistance at 25 degrees C
#define THERMISTORNOMINAL 50000      
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25   
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 10000    
 
uint16_t samples[NUMSAMPLES];
 
void setup(void) {
  Serial.begin(9600);
 // analogReference(EXTERNAL);
}
 
void loop(void) {
  uint8_t i;
  float average;
 
  // take N samples in a row, with a slight delay
  for (i=0; i< NUMSAMPLES; i++) {
   samples[i] = analogRead(THERMISTORPIN);
   delay(10);
  }
 
  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;
 
  Serial.print("Average analog reading "); 
  Serial.println(average);
 
  // convert the value to resistance
  average = 1023 / average - 1;
  average = SERIESRESISTOR / average;
  Serial.print("Thermistor resistance "); 
  Serial.println(average);
 
  float steinhart;
  steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15;                         // convert to C
 
  Serial.print("Temperature "); 
  Serial.print(steinhart);
  Serial.println(" *C");
 
  delay(1000);
}

PS This code is from Adafruit

edit:

I also made this readings and added them to this online calculator (I hope I am on the right track...):

So I changed my code to this:

// which analog pin to connect
#define THERMISTORPIN A0         
// resistance at 25 degrees C
#define THERMISTORNOMINAL 47945     
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25   
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3716
// the value of the 'other' resistor
#define SERIESRESISTOR 10000    
 
uint16_t samples[NUMSAMPLES];
 
void setup(void) {
  Serial.begin(9600);
 // analogReference(EXTERNAL);
}
 
void loop(void) {
  uint8_t i;
  float average;
 
  // take N samples in a row, with a slight delay
  for (i=0; i< NUMSAMPLES; i++) {
   samples[i] = analogRead(THERMISTORPIN);
   delay(10);
  }
 
  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;
 
  Serial.print("Average analog reading "); 
  Serial.println(average);
 
  // convert the value to resistance
  average = 1023 / average - 1;
  average = SERIESRESISTOR / average;
  Serial.print("Thermistor resistance "); 
  Serial.println(average);
 
  float steinhart;
  steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15;                         // convert to C
 
  Serial.print("Temperature "); 
  Serial.print(steinhart);
  Serial.println(" *C");
 
  delay(1000);
}

which gives me. again, false readings:

Average analog reading 943.80
Thermistor resistance 119166.69
Temperature 4.70 *C

edit2:

I also noticed, that the temp shown in the serial monitor is getting higher when it should go lower (cup full of hot water is cooling down...)

edit3:

below is my actual setup, maybe you see some wiring problem!?
5V into 10K resistor, A0 to resistor, probe to resistor and probe to ground.
What makes me curious is, that my attached multimeter is showing a minus value. When removing probe from ground it´s returning back to 45.000-50.000 Ohm which is the actual resistance of the probe.

edit4:

Ok, I found out I get bad readings from my multimeter when the probe is connected to the MCU. So below is my actual code for testing the resistance measurements now. Unfortunately the resistor readings of the MCU are stille different to what my multimeter says. The MCU reports a restistance of 78189.65 and my multimeter says 56300. Because of this difference I cannot get correct temperature measurements.
I have no idea what I could improve now, I hope you can still support me here! I also updated my measurements for the steinhart calculation:

// the value of the 'other' resistor
#define SERIESRESISTOR 10000    
 
// What pin to connect the sensor to
#define THERMISTORPIN A0 
 
void setup(void) {
  Serial.begin(9600);
}
 
void loop(void) {
  float reading;
 
  reading = analogRead(THERMISTORPIN);
 
  Serial.print("Analog reading "); 
  Serial.println(reading);
 
  // convert the value to resistance
  reading = (1023 / reading)  - 1;     // (1023/ADC - 1) 
  reading = SERIESRESISTOR / reading;  // 10K / (1023/ADC - 1)
  Serial.print("Thermistor resistance "); 
  Serial.println(reading);
 
  delay(1000);
}

edit 6:

I changed my resistor from 10K to 100K, now I get resistance readings of around 54.000 which is much closer to 56.000 but still makes a difference of 5°C...

Can´t anyone help?

You don't have the datasheet of this temperature sensor so I don't think anyone can help you here.

I would suggest you to buy some other temperature sensor like DS18B20, its easy to handle and provides quite accurate reading.

Because I need it for a BBQ Temperature probe your suggestion is not an option. Maybe someone has another suggestion?

A thermocouple and a digital chip to read it like the MAX6675 or never.

About thermistors I read this
https://learn.adafruit.com/thermistor?view=all
It talks about 10K resistor (1%!!) but maybe it's because of measuring low temperatures, for higher maybe 100k is better.
Edit here he talks to use a 100k resistor because the NTC is 100k too
http://www.circuitbasics.com/arduino-thermistor-temperature-sensor-tutorial/

For high temperatures you can use a 100k thermistor but better use a 10k resistor with it, as the resistance of your thermistor will be in the order of 10k.

Make sure your thermistor works at normal temperatures so you know your code is correct. Then calibrate for high temperatures.

Or indeed use a thermocouple.