Temperature sensing

Building a dual thermometer display for BBQ. Temperature probes good for up to 500degF but mostly need accuracy between 100degF and 300degF. I'm using a simple divider with 9900ohm reference resistor connected to gnd and thermistor connected to +5V while tapping sense voltage between them. I'm having major problems calibrating. I've taken thermistor resistance readings at:
74degF - 10683ohm,
183degF - 9833ohm,
344degF - 922ohm.
I've tried different Steinhart-Hart calculators but I can't get this code to work. I get numbers that are way off. Does anyone see what I'm doing wrong. I've checked my wiring a number of times and can't find anything wrong. I'm using Arduino Nano.
BTW, this device will transmit temperature to a receiver.

#include <LiquidCrystal.h>
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
LiquidCrystal lcd(11, 10, 9, 8, 7, 6);   //RS, EN, DB4, DB5, DB6, DB7
int ThermPin1 = 0;    // Arduino analog read pin numbers
int ThermPin2 = 1;
float Vs = 4.79;   //source voltage
float Vt1, Vt2; // raw voltage from analog inputs
float V1, V2; // real volts converted from analog readings
float R1 = 9930;  //value of resistor chosen for divider
float R2 = 9930;  //value of resistor chosen for divider
float Rp1, Rp2;   // calculated R values of thermistors                                                                                                        ;
float logRp1, logRp2;
float T1, T2; //calculated temperatures
// coefficients from Steinhart-Hart Equation calculator
float c1 = 108.7752882e-3, c2 = -206.1903352e-4, c3 = 1075.708164e-7;
int col, row;    //row and column of lcd display
int iT1, iT2;

RH_ASK rf_driver;
void setup() {
  // Initialize ASK Object
  if (!rf_driver.init())
  {
    Serial.println("Unable to initialize rf_driver.");
  }
  // Setup Serial Monitor
  Serial.begin(9600);  
  lcd.begin(8, 2);
}

void loop() {
  Vt1 = analogRead(ThermPin1);
  Vt2 = analogRead(ThermPin2);
  V1 = Vt1 * .00488; // .0048 = 5V/1023 convert ADC reading to real volts
  V2 = Vt2 * .00488;
  Rp1 = (Vs - V1) / (V1 / R1);   // calculate probe resistance based on values of Vs, V1 and R1
  Rp2 = (Vs - V2) / (V2 / R2);  // Vthermistor = Vs-V2, Current = V2/R2, Rthermistor = Vthermistor/Current  

  // calculate temperature in Kelvin
  logRp1 = log(Rp1);
  T1 = 1.0 / (c1 + c2 * logRp1 + c3 * logRp1 * logRp1 * logRp1);
  logRp2 = log(Rp2);
  T2 = 1.0 / (c1 + c2 * logRp2 + c3 * logRp2 * logRp2 * logRp2);
  
  //convert K to C
  T1 = T1 - 273.15;  
  T2 = T2 - 273.15;
  // convert C to F
  T1 = (T1 * 9.0)/ 5.0 + 32.0;
  T2 = (T2 * 9.0)/ 5.0 + 32.0;
  
  //lcd.clear();
  iT1 = T1;  //convert float to int
  lcd.setCursor(0, 0); //col,row  
  lcd.print("T1=");
  lcd.print(iT1);
  lcd.print("F ");
  
  iT2 = T2;  //convert float to int
  lcd.setCursor(0, 1); //col,row
  lcd.print("T2=");
  lcd.print(iT2); 
  lcd.print("F ");
//for temperature coefficients see https://rusefi.com/Steinhart-Hart.html
}

I'm not sure a float will be able to do what you want. They only have 6-7 decimal digits of precision.

To calculate the resistance at any particular temperature you need both the 25 °C resistance and the β (beta) value.

I would:

  • using the data you have, calculate how many volts per degree the Arduino is "seeing". It will be different at the different temperatures. Use a linear interpolation to find the ohms/°F values. Then verify the A/D converter in the Arduino has the resolution you require.

  • I plotted your data in Excel, added a trendline (see below). I would use that for you calculations.

Now I know there is a desire to make the calculation "exact". However the rest of the components are not up the the task. Kinda like putting racing slicks on a Yugo :slight_smile:

Consider looking at a type K thermocouple, it is good for the temperature, inexpensive, and there are inexpensive modules that do the cold junction compensation for you.

Why particularly? They're quite inexpensive in fully debugged form - is there some special feature you need in a home built one?

I've owned a number of BBQ temperature monitors and all of them are a pain in the ass to use. Also, I just wanted to have fun building it.

Thanks everyone. I figured out the problem. I was using the lcd display to show me the Rp1 probe resistance at different temperatures. I measured the probe out of the circuit at room temperature and it measured about 100kohm. As you can see in my post, at 74degF I was getting 10683ohms. The lcd display, in my case, was truncating the number. Thank you all for your responses.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.