NTC Thermistor class.
Dependents: FermenterTempArray
Fork of Thermistor by
Diff: NTCThermistor.cpp
- Revision:
- 2:b052ac698148
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NTCThermistor.cpp Tue Sep 09 02:48:51 2014 +0000 @@ -0,0 +1,21 @@ +#include "NTCThermistor.h" + +/** Create a NTCThermistor instance +*@param T0 basic temperature[degrees/celsious] +*@param R0 basic resistance[ohm]. Thermistor takes this resistance at basic temperature T0. +*@param B B-parameter. +*/ +NTCThermistor::NTCThermistor(float T0,float R0,float B){ + T0_ = T0; + K0_ = T0_+273.0; + R0_ = R0; + B_ = B; +} + +/** Transfer temperature from resistance +*/ +float NTCThermistor::trans_R2T(float R){ + float K = (B_*K0_)/(K0_*log(R/R0_)+B_); + float temp = K-273.0; + return temp; +} \ No newline at end of file