# How can I estimate a temperature quickly?

Common thermometers only measure their own temperature so if you want to measure air temperature and you take the thermometer out of your pocket it will initially show your body temperature and begin changing until it stabilize at air temperature.

But the rate of change will be fast when de difference between the thermometer temp and the air temp is big and it will be slow when it is small because the heat transfer is faster when that difference is big. Can I use the temperature and the rate of change to estimate the air temperature fast? Can you help me with it? Thank you.

I wish to use this with a digital sensor that measures tenths of celsius degrees connected to a microcontroller so I wish the math to be as simple as possible.

Sorry for my English.

• I've deleted several nonconstructive comments. – David Z Jul 30 '16 at 16:37
• How "quickly" do you want to measure the temperatures? You can easily buy sensors with a response time of about 1 second. There are temperature sensors that have a response time of less than 0.1 milliseconds - but they may be too expensive and/or too fragile for your application. – alephzero Jul 30 '16 at 20:41
• @alephzero Does it really change from any temperature to any other in one second? In any case I wanted the maths to estimate the temperature. – aalku Jul 31 '16 at 9:29

The idea you have in mind is basically Newton's Law of Cooling which states that the rate of heat transfer between two systems is proportional to the temperature difference between those systems. You can rewrite it in terms of temperature as $$\frac{\mathrm{d}T(t)}{\mathrm{d}t} = -r[T(t) - T_{\text{env}}]$$ where $r$ is a constant that depends on the systems. It's probably impractical to calculate $r$, but if your thermometer is always going to be used in the same way (i.e. always exposed to air, without any significant external heat sources), you can determine it from measurements in known temperature conditions. Once you've done that, you can program the thermometer to calculate an estimate of the surrounding temperature as $$T_{\text{env}} = T(t) + \frac{1}{r}\frac{\mathrm{d}T(t)}{\mathrm{d}t}$$

Alternatively, you could program the thermometer to collect several different temperature readings at different times and fit them to the expression $$T(r) = T_{\text{env}} - [T(0) - T_{\text{env}}] e^{-rt}$$ which is the solution to the differential equation I wrote above. The value of $T_{\text{env}}$ that the fit produces is your estimate (or, measurement) of the external temperature. This has the advantage that, as your thermometer collects more data, it will give progressively more and more accurate estimates.

Since your thermometer is going to have access to a computer chip anyway, it should be straightforward to include a bit of code to perform the fit. Fitting to an exponential model is a well-studied problem and there are standard algorithms that handle it quite well, even accounting for random noise. If you're not familiar with them, start by looking up least-squares regression.

• or merely by learning from experimental curves with the chosen device – user46925 Jul 30 '16 at 16:37
• I think your answer is perfect but I am not sure I understand the expressions. Don't worry, I'll get to do it. :) – aalku Jul 30 '16 at 16:42

I have bought a thermometer from japan made by citizen which measure the body temperature in 30 sec. There are others available which can estimate the temperature in 10 sec. It was shown on its leaflet that faster sensing is achieved through curve fitting. They have fitted various curves which looks like fast rise and then saturation. They have developed an algorithm by which one can predict the saturation point after measuring the rate of change of temperature and the final temperature in the rising portion. These thermometers work correctly only if the initial temperature is below some limit (32 degrees). It was claimed that the temperature accuracy is 0.1 deg.

I think you have to do a lot of data collection and curve fitting. There must be a range of starting and ending temperatures and that must not be very wide, otherwise it will become increasingly difficult to estimate the temperatures.

It also occurred to me that these type of thermometers may not be very useful in your case because you want to measure the temperature continuously. In order to use these thermometers you have to first disconnect them from heat, cool them and connect again. You may alternatively try thermal infrared guns to read temperature but the accuracy is in the range of $\pm2$ degrees.

Commercially available thermocouple sensors are also quite fast to detect differential changes. In my experience it took few seconds to detect the temperature variation of 0.1 deg.

I hope this will help