Thermistor readings off by 900°

Hello! I’m creating a Star Trek tricorder, and I’m trying to use a thermistor in my circuit to detect the temperature.

I’m using a 10K resistor.
When I check the temperature readings that I get, with another thermometer, they’re correct.
However, I says 962 instead of just 62.

I’ve tried to subtract 900, but then it gives me a really weird negative number…

Here’s my code:

#include <math.h> //loads the more advanced math functions

void setup() { //This function gets called when the Arduino starts
* Serial.begin(9600); //This code sets up the Serial port at 115200 baud rate*

double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp + 273.15; // Convert Kelvin to Celsius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius
return Temp;

void loop() { //This function loops while the arduino is powered
* int val; //Create an integer variable*
* double temp; //Variable to hold a temperature value*
* val=analogRead(0); //Read the analog port 0 and store the value in val*
* temp=Thermister(val); //Runs the fancy math on the raw analog value*
* Serial.println(temp); //Print the value to the serial port*
* delay(1000); //Wait one second before we do it again*

Thanks for all of your help!

Nevermind, I figured it out!

I just needed to change this line:



Serial.println(temp - 900);

Just do that.. Your numbers are probably not correct anyway..