Weird results from a thermistor

I’m trying to set up a simple thermal monitor for my freezer using the April board. I’ve hooked up an adafruit thermistor and it am using the temperature code from the imp documentation.

At room temps, it works great. However when I put it in the freezer and wait a little while the temp starts showing up as a high positive number

2015-06-10 13:41:06 UTC-4 [Device] 94.926 C 2015-06-10 13:41:06 UTC-4 [Device] 202.867 F

Now, I’m pretty sure I stuck the thermistor in my freezer and not in my oven…

Any ideas what could be causing this? Could this be a bad pin? bad thermistor? bad configuration my part?

Here is my device code

`
therm <- hardware.pin2;
therm.configure(ANALOG_IN);

const INTERVAL_MIN = 5;
local SLEEP_TIME = INTERVAL_MIN * 60;

const B_THERM = 3977.0;
const T0_THERM = 298.15;
const R2 = 10000.0;

function getTemp() {
local vin = hardware.voltage()
local vout = vin * therm.read() / 65535.0
local rTherm = (R2 * vin / vout) - R2
local lnTherm = math.log(10000.0 / rTherm)
local tempK = (T0_THERM * B_THERM) / (B_THERM - T0_THERM * lnTherm)

local tempC = tempK - 273.15
local tempF = tempC * 9.0 / 5.0 + 32.0

server.log(tempC + " C");
server.log(tempF + " F");

local temp = {}
temp.celsius <- tempC
temp.fahrenheit <- tempF

return temp

}

function check_temp() {
local temp = getTemp();
imp.wakeup(SLEEP_TIME, check_temp);
}

check_temp();`

The resistance of a thermistor decreases with increasing temperature.
Have you reversed something in your math?

Yeah, that would be my guess - as both thermistor and bias resistor are likely ~10k at 25C, it’ll read right at that temperature, but if they are the wrong way round for your algorithm then the temperature will move the wrong way as you go away from 25C :slight_smile:

I’m not sure what the actual issue was, but I took the circuit apart, and re-assembled it on a different pin and it seems to be reading the correct value now. It could have been that I had the circuit laid out wrong or that something is off w/ the pin that I was using.

Are you getting (conductive) frost forming?