Hello. I have a 100k thermistor and a 100k resistor in a voltage divider. What I want to do is get the resistance of my thermistor so I can feed it to the Steinhart-Hart equation.
what I have so far is this…
rawADC = analogRead(0); res = (500000/((rawADC/1024)*5)) - 100000; temperature = (1 / (thermA + (thermB * log(res)) + (thermC * log(res) * log(res) * log(res)))) - 273;
where res (initialised as a float) should be the resistance of the thermistor. I am trying to use R1=(R2.Vin)/Vout - R2 - sounds simple, but when I get the program to send rawADC and res to serial, I get values that change as expected for rawADC (so not hardware), but res always results in a value of -100001.00
I think I must be doing something obvious wrong but I can’t see what it is.
Incidentally the temperature equation works nicely given dummy values for res.