rusefi-1/misc/www/Steinhart-Hart.html

198 lines
3.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head>
<title>SteinhartHart equation calculator
</title>
</head>
<body onload="DoMathABC();">
If you have a random thermistor (like a random Engine Coolant Temperature (ECT) sensor or a random Intake Air Temperature (IAT) sensor),
you can calculate the coefficients for the Steinhart-Hart Equation, which provides excellent curve fitting, based on three meaurments:
low temperature, mid-range temperature and high temperature.
<br>
<br>
<br>
Right from <a href=http://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation#Inverse_of_the_equation>Wikipedia:</a>
<br>
<script type="text/javascript">
function DoMathABC() {
T1 = (Calc.t1f.value - 32)*5/9+273.15;
T2 = (Calc.t2f.value - 32)*5/9+273.15;
T3 = (Calc.t3f.value - 32)*5/9+273.15;
L1 = Math.log(Calc.r1.value);
L2 = Math.log(Calc.r2.value);
L3 = Math.log(Calc.r3.value);
Y1 = 1 / T1;
Y2 = 1 / T2;
Y3 = 1 / T3;
U2 = (Y2-Y1)/(L2-L1);
U3 = (Y3-Y1)/(L3-L1);
C = (U3 - U2)/(L3 - L2) * Math.pow(L1 + L2 + L3, -1);
B = U2 - C * (L1*L1 + L1*L2 + L2*L2);
A = Y1 - (B+L1*L1*C)*L1;
Calc.avalue.value = A;
Calc.bvalue.value = B;
Calc.cvalue.value = C;
Calc.formula.value = "1 / (" + A + " + " + B + " * logR + " + C + " * logR * logR * logR)";
}
function DoMathT() {
LNR = Math.log(Calc.r.value);
A = Number(Calc.avalue.value);
B = Number(Calc.bvalue.value);
C = Number(Calc.cvalue.value);
tempK = 1 / (A + B * LNR + C * Math.pow(LNR, 3));
TC = tempK - 273.15;
TF = TC * 9 / 5 + 32;
}
</script>
<FORM NAME="Calc">
<TABLE BORDER=0>
<TR>
<TD>
T low (F)
</td>
<TD>
<INPUT TYPE="text" NAME="t1f" value="32" >
</td>
<TD>
R low (Ohm)
</td>
<TD>
<INPUT TYPE="text" NAME="r1" value="9500">
</td>
</tr>
<tr>
<TR>
<TD>
T mid (F)
</td>
<TD>
<INPUT TYPE="text" NAME="t2f" value="75">
</td>
<TD>
R mid (Ohm)
</td>
<TD>
<INPUT TYPE="text" NAME="r2" value="2100">
</td>
</tr>
<tr>
<TR>
<TD>
T high (F)
</td>
<TD>
<INPUT TYPE="text" NAME="t3f" value="120">
</td>
<TD>
R high (Ohm)
</td>
<TD>
<INPUT TYPE="text" NAME="r3" value="1000">
</td>
</tr>
<tr>
<td>
<INPUT TYPE="button" NAME="zero" VALUE="Calculate A, B, C" OnClick="DoMathABC();">
<br>
</TD>
</TR>
<tr>
<TD>
A
<INPUT TYPE="text" NAME="avalue">
<br>
</TD>
<TD>
B
<INPUT TYPE="text" NAME="bvalue">
<br>
</TD>
<TD>
C
<INPUT TYPE="text" NAME="cvalue">
<br>
</TD>
</tr>
<tr>
<td colspan=4>
C language formula:<br>
<INPUT TYPE="text" NAME="formula" size=100>
</td>
</tr>
<tr>
<td colspan="3">
<br><br>
Now, with these coefficients, you can calulatate the temperature for any given resistance:
<br>
R (Ohm) <INPUT TYPE="text" NAME="r" value="3500">
<INPUT TYPE="button" NAME="DoIt" VALUE="Calculate Temperature" OnClick="DoMathT();Calc.tc.value = TC;Calc.tf.value = TF;">
<br>
Result (F)
<INPUT TYPE="text" NAME="tf">
<br>
Result (C)
<INPUT TYPE="text" NAME="tc">
</td>
</tr>
<tr>
<td>
<input type="reset" value="Reset!">
</td>
</TR>
</TABLE>
</FORM>
<hr>
Copyleft Andrey 2013
<br><br><br>
External links:<br>
<a href=http://www.raltron.com/cust/tools/voltage_divider.asp>Voltage Divider calculator</a>
</body>
</html>