//Basic mathematical constant. Eulers constant float e = 2.718; //B Value of thermistor double B = 3435.0; //Kelvin //Rinf value 10kOhm * e^(-B/298.15) double Rinf = (10000*pow(e,(-B/298.15))); void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); //Convert ADC counts to a voltage based on the measured voltage (5.065V) double Vtherm = ((double)sensorValue) * (5.065/1023.0); //Convert measured voltage into the resistance using a voltage divider //Note 9910(Ohm) is the measured resistance of the voltage divider resistor double Rtherm = 9910.0 * (1.0/((5.065/Vtherm) - 1.0)); //At 25C //Temperature in Kelvin from measured resistance and B value double Temp = B / log(Rtherm/Rinf); double TempC = Temp-273.15; // print out the data to the serial monitor Serial.print("Sensor: "); Serial.print(sensorValue); Serial.print(" K: "); Serial.print(Temp); Serial.print(" C: "); Serial.println(TempC); delay(100); }