Update Content - 2025-01-17

This commit is contained in:
Thomas Dehaeze 2025-01-17 10:36:25 +01:00
parent ba71eeb29c
commit d445d36f0d
4 changed files with 106 additions and 16 deletions

View File

@ -220,41 +220,131 @@ Values for A, B, C and D are depending on the exact model (summarized in [Table
%% Pt100 (3850 ppm/K)
R0 = 100; % [Ohm]
A = 3.9083e-3;
B = -5.775e-7;
C = -4.183e-12;
A = 3.9083e-3; % [degC^-1]
B = -5.775e-7; % [degC^-2]
C = -4.183e-12; % [degC^-4]
T1 = -200:0; % [degC]
T2 = 0:850; % [degC]
T = [T1,T2]; % [degC]
R = [R0*(1 + A*T1 + B*T1.^2 + C*(T1-100).*T1.^3), R0*(1 + A*T2 + B*T2.^2)]; % [Ohm]
figure;
plot(T, R)
xlabel('Temperature [${}^oC$]');
ylabel('Resistance [$\Omega$]')
```
<a id="figure--fig:temperature-sensor-pt100-curve"></a>
{{< figure src="/ox-hugo/temperature_sensor_pt100_curve.png" caption="<span class=\"figure-number\">Figure 7: </span>Resistance as a function of the temperature for a Pt100" >}}
For temperatures above 0 degrees, the temperature \\(T\\) can be easily computed from the measured resistance \\(R\\) using:
\\[ T = \frac{-A + \sqrt{A^2 - 4 B ( 1 - R/R\_0 )}}{2 B} \\]
For temperatures below 0 degrees, the equation is harder to solve analytically, and a lookup table is more appropriate.
Let's compare the temperature given by a Loopup table and the temperature given by the analytical formula in two cases:
- linear interpolation with one point every degree
- cubic interpolation with one point every 10 degrees
The error is less than 0.1mK over the full range, validating the use of a lookup table to convert the resistance to temperature ([Figure 8](#figure--fig:temperature-sensor-lut-errors)).
```matlab
%% Compute the temperature as a function of the resistance
R_meas_1 = 18:100;
R_meas_2 = 100:390;
%% "Perfect" temperature and resistance
R0 = 100; % [Ohm]
A = 3.9083e-3; % [degC^-1]
B = -5.775e-7; % [degC^-2]
C = -4.183e-12; % [degC^-4]
T1 = -200:0.1:0; % [degC]
T2 = 0.1:0.1:850; % [degC]
T_true = [T1,T2]; % [degC]
R_true = [R0*(1 + A*T1 + B*T1.^2 + C*(T1-100).*T1.^3), R0*(1 + A*T2 + B*T2.^2)]; % [Ohm]
T_meas = [(-A + sqrt(A^2 - 4*B*(1 - R_meas_2/R0)))/(2*B)];
%% Lookup table for Pt100 (3850 ppm/K) - Linear
dT = 1;
interp_method = 'linear';
figure;
plot(R_meas_2, T_meas)
xlabel('Resistance [$\Omega$]')
ylabel('Temperature [${}^oC$]');
T1 = -200:dT:0; % [degC]
T2 = dT:dT:850; % [degC]
T_lut_linear = [T1,T2]; % [degC]
R_lut_linear = [R0*(1 + A*T1 + B*T1.^2 + C*(T1-100).*T1.^3), R0*(1 + A*T2 + B*T2.^2)]; % [Ohm]
T_meas_linear = interp1(R_lut_linear,T_lut_linear,R_true,interp_method); % interpolate the resistance using the LUT to find the corresponding temperature
%% Lookup table for Pt100 (3850 ppm/K) - Makima
dT = 10;
interp_method = 'makima';
T1 = -200:dT:0; % [degC]
T2 = dT:dT:850; % [degC]
T_lut_makima = [T1,T2]; % [degC]
R_lut_makima = [R0*(1 + A*T1 + B*T1.^2 + C*(T1-100).*T1.^3), R0*(1 + A*T2 + B*T2.^2)]; % [Ohm]
T_meas_makima = interp1(R_lut_makima,T_lut_makima,R_true,interp_method); % interpolate the resistance using the LUT to find the corresponding temperature
```
<a id="figure--fig:temperature-sensor-lut-errors"></a>
{{< figure src="/ox-hugo/temperature_sensor_lut_errors.png" caption="<span class=\"figure-number\">Figure 8: </span>Interpolation errors in two cases when using a LUT for a Pt100" >}}
### NTC thermistor {#ntc-thermistor}
The resistance of the NTC thermistor as a function of the temperature can be well approximated with the following equation:
\\[ R\_t = R\_{25} \cdot e^{A + B/T + C/T^2 + D/T^3 \\]
where \\(T\\) is the temperature in kelvins, \\(R\_{25}\\) the nominal resistance at \\(25^oC\\), \\(A\\), \\(B\\), \\(C\\) and \\(D\\) are coefficients which are specific for a given thermistor.
Typically, coefficients A, B, C and D are varying with temperature as shown in [Table 2](#table--tab:temperature-sensor-ntc-coefs).
<a id="table--tab:temperature-sensor-ntc-coefs"></a>
<div class="table-caption">
<span class="table-number"><a href="#table--tab:temperature-sensor-ntc-coefs">Table 2</a>:</span>
Example of A, B, C and D coeficients for an NTC thermistor (DC95F202VN)
</div>
| | A | B | C | D |
|------------|----------------|---------------|----------------|----------------|
| -50 to 0 | -1.4122478E+01 | 4.4136033E+03 | -2.9034189E+04 | -9.3875035E+06 |
| 0 to 50 | -1.4141963E+01 | 4.4307830E+03 | -3.4078983E+04 | -8.8941929E+06 |
| 50 to 100 | -1.4202172E+01 | 4.4975256E+03 | -5.8421357E+04 | -5.9658796E+06 |
| 100 to 150 | -1.6154078E+01 | 6.8483992E+03 | -1.0004049E+06 | 1.1961431E+08 |
```matlab
%% Compute the resistance as a function of the temperature for a given NTC (DC95F202VN)
R0 = 2e3; % Resistance at 25deg
T1 = 273.15+[-50:0]; % [degK]
T2 = 273.15+[1:50]; % [degK]
T3 = 273.15+[51:100]; % [degK]
T4 = 273.15+[101:150]; % [degK]
R = R0*exp([[-1.4122478E+01 + 4.4136033E+03./T1 - 2.9034189E+04./T1.^2 - 9.3875035E+06./T1.^3]';
[-1.4141963E+01 + 4.4307830E+03./T2 - 3.4078983E+04./T2.^2 - 8.8941929E+06./T2.^3]';
[-1.4202172E+01 + 4.4975256E+03./T3 - 5.8421357E+04./T3.^2 - 5.9658796E+06./T3.^3]';
[-1.6154078E+01 + 6.8483992E+03./T4 - 1.0004049E+06./T4.^2 + 1.1961431E+08./T4.^3]'])'; % [Ohm]
T = -273.15+[T1,T2,T3,T4]; % [degC]
```
<a id="figure--fig:temperature-sensor-ntc-curve"></a>
{{< figure src="/ox-hugo/temperature_sensor_ntc_curve.png" caption="<span class=\"figure-number\">Figure 9: </span>Resistance as a function of the temperature for a given NTC" >}}
To calculate the actual thermistor temperature as a function of the measured thermistor resistance, use the following equation:
\\[ T = \frac{1}{a + b \ln(R\_t/R\_{25}) + c (Ln Rt/R25)^2 + d (Ln Rt/R25)^3) \\]
<a id="table--tab:temperature-sensor-ntc-equation"></a>
<div class="table-caption">
<span class="table-number"><a href="#table--tab:temperature-sensor-ntc-equation">Table 3</a>:</span>
Coefficients used to compute the temperature as a function of the resistance
</div>
| Rt/R25 range | a | b | c | d |
|--------------------|---------------|---------------|----------------|----------------|
| 68.600 to 3.274 | 3.3538646E-03 | 2.5654090E-04 | 1.9243889E-06 | 1.0969244E-07 |
| 3.274 to 0.36036 | 3.3540154E-03 | 2.5627725E-04 | 2.0829210E-06 | 7.3003206E-08 |
| 0.36036 to 0.06831 | 3.3539264E-03 | 2.5609446E-04 | 1.9621987E-06 | 4.6045930E-08 |
| 0.06831 to 0.01872 | 3.3368620E-03 | 2.4057263E-04 | -2.6687093E-06 | -4.0719355E-07 |
## Commercial Temperature Sensors {#commercial-temperature-sensors}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB