Antarctic Mission Calibration

The sensors need to be calibrated before the mission!

Input data

Average ambient temperature amb
Enter one measurement at 5 cm, one at 10 cm, and then one additional measurement every 10 cm.

Output

T(x) =
{
Tmax(T̄amb)
for x ≤ xmax
amb + A·eB·x
for xmax < x < xmin
Tmin(T̄amb)
for x ≥ xmin
Upper threshold Tmax
Lower threshold Tmin
Exponential coefficient A
Exponential coefficient B
Fitted middle function
Transition at Tmax
Transition at Tmin

Step-function graph

Explanation

The 6 ambient measurements are averaged to define the reference ambient temperature.

\[ \displaystyle \bar{T}_{amb}=\frac{1}{6}\sum_{i=1}^{6} T_{amb,i} \]

The warm-object data are fitted with an exponential curve that decreases with distance.

\[ \displaystyle T(x)=\bar{T}_{amb}+Ae^{Bx} \]
\[ \displaystyle Y_i=\ln\left(T_i-\bar{T}_{amb}\right) \]
\[ \displaystyle B=\frac{\sum x_iY_i-\frac{1}{n}\left(\sum x_i\right)\left(\sum Y_i\right)}{\sum x_i^2-\frac{1}{n}\left(\sum x_i\right)^2} \qquad \alpha=\bar{Y}-B\bar{x} \qquad A=e^{\alpha} \]

Two practical thresholds are then defined.

\[ \displaystyle T_{max}=\max\left(30,\bar{T}_{amb}+1\right) \qquad T_{min}=\max\left(24.5,\bar{T}_{amb}+1\right) \]

The transition distances are obtained where the exponential curve meets those thresholds.

\[ \displaystyle T_{max}=\bar{T}_{amb}+Ae^{Bx_{max}} \qquad T_{min}=\bar{T}_{amb}+Ae^{Bx_{min}} \]
\[ \displaystyle x_{max}=\frac{\ln\left(\frac{T_{max}-\bar{T}_{amb}}{A}\right)}{B} \qquad x_{min}=\frac{\ln\left(\frac{T_{min}-\bar{T}_{amb}}{A}\right)}{B} \]

The final result is shown as a continuous piecewise threshold and as an interactive graph.

\[ \displaystyle T(x)= \begin{cases} \displaystyle T_{max}, & x \le x_{max} \\[1ex] \displaystyle \bar{T}_{amb}+Ae^{Bx}, & x_{max} \lt x \lt x_{min} \\[1ex] \displaystyle T_{min}, & x \ge x_{min} \end{cases} \]

Generated Arduino Scaffold

This is the full Arduino project scaffold including your calibrated threshold function and dynamically assigned constants.

// Scaffold will appear here after calibration