Having problems with temp reading analog sensor

I am trying to get a temp value from a 10k NTC

I have not had problems dong this in the past but now for some reason I can only get strange charioteers on the LCD or serial monitor. (No LCD in this code)

I tried this example code and still get no joy.
I have the tried putting analog 0 to +5 and 0v just to see if the value changed, nothing… also tried different analog in.

The last time I used a sketch with this function in it it worked (V.22 or V1.0) did something change or am I missing something obvious?


#include <math.h>

double Thermister(int RawADC) {
 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 Celcius
 Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
 return Temp;

void setup() {

void loop() {
 Serial.println(int(Thermister(analogRead(0))));  // display Fahrenheit

Is your Serial Monitor set at the same baud speed as in your code?

If you are getting strange "charioteers" rather than strange values it would seem to point to a mismatch of baud rates between the program and the serial monitor. Try printing some text and see what you get.

You guys nailed it!
Different baud rates the monitor was set to 9600 and the chip was sending 115200.

My other problem was with the serial LCD displaying letters for temp values... :astonished:
I kinda figured it was interpreting the values and after a bit of Googling I found this Arduino Forum

THANK YOU :smiley: