“Do you really want a plastic pop-up timer telling you when your turkey is done? How about a tricked out IoT solution instead?
Ever wonder what temperature your Thanksgiving turkey is really at when that plastic pop-up timer pops? When your oven says it’s pre-heated to 375°F do you actually believe it? This Thanksgiving I decided to question everything and monitor these temperatures myself. The goal of this project is to monitor, from the interwebs, the ambient temperature inside the oven as well as the meat temperature of my turkey.
Hot! Too Hot!
So how do we get a temperature reading from inside the oven? We can’t just stick a TMP36 or DS1820 in there because neither go up into the three and four hundred degree range. Besides, we wouldn’t want to try to embed one inside the turkey anyway. For higher temperatures like the oven we need a special kind of temperature sensor known as a thermistor. A thermistor is simply a temperature dependent resistor. As the temperature changes so does its resistance. There are two main types of thermistors. With a PTC (positive temperature coefficient) thermistor as the temperature rises, so does the resistance (hence the “positive” part). When using an NTC (negative temperature coefficient) thermistor the resistance drops as the temperature rises.
Thermistors come in many shapes and sizes. So how do we find one for our project? Turns out there are lots of lame, non-IoT oven/meat temp tracking devices out there and many sell replacement probes. A quick search on Amazon and eBay yields lots of options. All you are looking for is a replacement probe that looks like it terminates with a headphone plug (read the Lessons Learned section below before ordering anything).
How to Read a Thermistor
Now that we have this temperature dependent resistor how do we read it’s resistance? We don’t have a get_resistance function in any of the IoT platforms I’ve played with. What we do have in many scenarios is a GPIO pin capable of reading an analog voltage. All we have to do is connect our thermistor to a known resistor value in a voltage divider configuration and read the output. Once we know the fixed resistance as well as the output voltage from the divider some simple algebra allows us to solve for the resistance of the thermistor. Perfect…except we need a temperature, not a resistance.
What’s This Steinhart-Hart Thingy?
Now that we know how to get the resistance of our thermistor we need to turn it into a temperature. Turns out some smart folks back in the 60s figured out that all thermistors have a fairly standard non-linear characteristic curve which describes the relationship between temperature and resistance. It’s called the Steinhart-Hart equation and it’s our best friend for turning our thermistor resistance into a temperature.
The problem with the Steinhart-Hart equation (and it’s simplified form) is that we need some coefficient values to plug into the equation. Ideally you would buy a thermistor that has a datasheet spelling out what the coefficient values are but when you buy them online in the form of random replacement meat probes you are unlikely to get that information. The way around this is to use a simple online calculator. Plug in 3 resistances that you measure from 3 known temperatures and the SRS Thermistor Calculator will spit out your coefficients. With that information we can turn our thermistor value into a temperature.
Who’s In Charge Here?
At the heart of this project we need an IoT hardware platform to read the thermistors, calculate a temperature for each probe and send the data to the cloud. Everything is better in the cloud. At least that’s what people tell me. For this project I decided to use the WiPy from Pycom. The WiPy is based on the ESP32 module and is programmed in Python. It has an onboard ADC which is exactly what we need to “talk” to our thermistors. Here’s how I wired everything up.”