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();`