# Thermistor doesn't work [closed]

Connecting all like shows the image, thermistor shows, that I'm going to be burnt:

The code is simple:

``````#define analogPin  A0 //the thermistor attach to
#define beta 4090
#define resistance 10

void setup()
{
Serial.begin(9600);
}

void loop()
{
//the calculating formula of temperature
float tempC = beta /(log((1025.0 * 10 / a - 10) / 10) + beta / 298.0) - 273.0;
float tempF = 1.8*tempC + 32.0;
Serial.print("Temp: ");

Serial.print(tempC);

Serial.print("  C");

Serial.print("Fahr: ");
Serial.print(tempF);
Serial.print(" F");
delay(200); //wait for 100 milliseconds
}
``````

Do I have a wrong thermistor or wrong code?

• There are no magicians here. What model/type of thermistor have you connected? What the thermistor's parameters are? Sep 3 '18 at 9:43

The series resistance is 220 Ohms (Red, Red, Brown).

You also need to take into account the thermistor resistance at 25C. Assuming its 10K. Hence choosing a 10K series resistance will make the calculations easier.

``````     int THERMISTORNOMINAL =  10000;
int SERIESRESISTOR = 10000;
int TEMPERATURENOMINAL = 25;

a = 1023 / a - 1;
a = SERIESRESISTOR / a;
tempC = a / THERMISTORNOMINAL;     // (R/Ro)
tempC = log(tempC);                  // ln(R/Ro)
tempC /= Beta;                   // 1/B * ln(R/Ro)
tempC += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
tempC = 1.0 / steinhart;                 // Invert
tempC -= 273.15;                         // convert to C
``````
• Could you make a full working sketch? This code snippet is confusing because it does not show if the variables are a float or integer. Add a link to a source for your calculation as well.
– Jot
Sep 3 '18 at 18:43
• I used 10K. The image is wrong. Sep 4 '18 at 9:28