adafruit_products_image.png
Photo by Andrea Piacquadio from Pexels

The TMP117 is not merely a temperature sensor, any hunk of silicon can do that. It comes with a handful of relevant features that help you make best use of this information.

Temperature offset management

When you're trying to get an accurate measurement, despite your best efforts it's common that the temperature reported by your measurement is different than the actual value. You might be sitting in your kitchen, surrounded by thermometers telling you that the room is in fact 40 degrees Celcius, however due to specifics of the immediate environment of the sensor, it may declare with the upmost certainty that it is actually 43 degrees C.

This type of change from the actual value will most times stay the same or close to it as the sensor finds itself in different locations with different temperature. This type of deviation from the known value is called an offset. No matter where the sensor is, the sensor will measure the temperature, but because of how air flows around the sensor, or how heat moves through the circuit board, or one of a thousand other things, it then takes this temperature and sets it off to the side, always the same amount. The offset remains relatively constant because the factors causing it are not changing, so their effect on the temperature also does not change.

adafruit_products_image.png
Photo by Digital Buggu from Pexels

Because they're constant, a temperature offset is easy to fix by adding or subtracting it from the reported temperature. The TMP117 will manage this for you by allowing you to set the offset amount which is then added to the measured temperature before it is reported to you. If the sensor says itself 43 degrees but you know from other sources that it is actually 40 degrees, setting an offset of -3 will account for it. After setting the offset, the TMP117 will take the measured 43 degrees, add -3 to it to account for the offset before reporting the adjusted value to you.

Temperature thresholds

Measuring temperature is all well and good, everyone needs to know the temperature at some point, but usually you want to know the temperature not out of pure curiosity but because you want to do something differently depending on what the temperature is. If it's colder than 60ºF degrees outside, you probably want to wear a hoodie. If instead it's -10ºC and you're in Saskatoon, you probably want to think about putting on an extra pair of dungarees.

The clever people at Texas Instruments were smart enough to predict this important decision point and they added high and low temperature thresholds to the TMP117. This allows you to delegate this decision to it and let it make decisions on your behalf. Most people may be hesitant to allow a machine to make such an important pants-related decision, however unlike your friend Joe who is well meaning but inattentive, the TMP117 won't get distracted by other stuff. All it's doing is sitting there, doing its part as a cog in the machine, measuring, reporting, and if appropriate, acting on the temperature.

By setting the high and low temperature thresholds, the TMP117 can then tell you when either threshold is exceeded. If you know you always wear pants when the temperature is below 60 degrees, set the low temperature threshold to 60 degrees and let the TMP117 tell you when it's time for pants.

If like me you also believe that wearing pants when the temperature is above 75 degrees is tepidly tyrannical, you may then also wish to set a high temperature threshold that well tell you when it's time to release the bonds of your pants and be free of their stifling embrace.

adafruit_products_image.png
Figure 18 from the TMP117 Datasheet. Link is available on the downloads page.

Threshold behavior

This behavior essentially boils down to "tell me when it's hot" and "tell me when it's cold". You still have to decide what that _means_. Alternatively, you could ask the TMP117 to answer the question: "Should I be wearing a skirt"?. In this case, you don't care if the temperature is high or low exactly, you want to know if the temperature is in a range where wearing a skirt is warranted. In this case, obviously if the temperature is over a certain amount, you're going to be wearing a skirt. But if the temperature goes below 40 degrees, are you going to immediately take off your skirt and put on some capris? No, you're going to keep your skirt on as long as possible, so you want to wait not until it's OK to wear capris, but when must you wear capris.

In this case, you would want to use the TMP117's "THERM" mode. When configured this way, only the high threshold alert will be used. Instead of the low threshold being the "it's cold" temperature, it is instead used as a "it's not hot anymore" value.

adafruit_products_image.png
Figure 19 from the TMP117 Datasheet. Link is available on the downloads page.

Measurement Delay


The TMP117 also allows you to made adjustments to the measurement behavior. Unlike things like "speed" or "fashion", temperature doesn't change all that fast. If it's too cold for a skirt one second, it's going to still be too cold 15 seconds later, barring unexpected lava.

To make use of this, the TMP117 allows you to change how often it calculates the temperature. By specifying a read delay, the TMP117 can go into a low power mode when continuing to read new values would be redundant.

adafruit_products_image.png
Figure 16 from the TMP117 Datasheet. Link is available on the downloads page.

Sample Count and Averaging

As we've established, from a human perspective, temperature doesn't change very quickly. Sensor are not humans however; they don't "have a feeling" about what the temperature is, they _measure_ it. That means that even if just one second ago the temperature was exactly 36.42 degrees C, if moments later a draft or paranormal phenomenon causes a micro-current of cold air to wisp across the sensor, the temperature *for the sensor* will drop, if only for a fraction of a second.

adafruit_products_image.png
The overall measurement behavior and timing is determined by the combination of Sample Count and Measurement Delay. Figure 15 from the TMP117 Datasheet. Link is available on the downloads page.

The result of this is that if you were to take that single measurement that occurred while the sensor was momentarily in a cold spot, while technically accurate it won't be representative of the overall temperature. Like good scientists, we know that to account for this inevitable fluctuation we should instead take several measurements and average them to get a more representative value.

The TMP117 also allows you to specify the number of readings that are taken and averaged. While they only take approximately 15.5 milliseconds, they will add up, so the more you average, the longer it will take to return a result.

This guide was first published on Dec 02, 2020. It was last updated on Dec 02, 2020.

This page (Featured Features) was last updated on Apr 22, 2021.

Text editor powered by tinymce.