NTC Thermistor class.
Dependents: FermenterTempArray
Fork of Thermistor by
NTCThermistor.h@3:e9f38dc974f8, 2014-09-09 (annotated)
- Committer:
- macht
- Date:
- Tue Sep 09 02:53:49 2014 +0000
- Revision:
- 3:e9f38dc974f8
- Parent:
- 2:b052ac698148
add documents
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
macht | 3:e9f38dc974f8 | 1 | #ifndef NTCTHERMISTOR_H |
macht | 3:e9f38dc974f8 | 2 | #define NTCTHERMISTOR_H |
macht | 0:d4198719a504 | 3 | #include "mbed.h" |
macht | 0:d4198719a504 | 4 | #include "math.h" |
macht | 3:e9f38dc974f8 | 5 | /** |
macht | 3:e9f38dc974f8 | 6 | *NTC Thermistor class |
macht | 3:e9f38dc974f8 | 7 | */ |
macht | 2:b052ac698148 | 8 | class NTCThermistor |
macht | 0:d4198719a504 | 9 | { |
macht | 0:d4198719a504 | 10 | public: |
macht | 2:b052ac698148 | 11 | /** Create a NTC Thermistor instance |
macht | 2:b052ac698148 | 12 | *@param T0 basic temperature[degrees/celsious] |
macht | 2:b052ac698148 | 13 | *@param R0 basic resistance[ohm]. Thermistor takes this resistance at basic temperature T0. |
macht | 2:b052ac698148 | 14 | *@param B B-parameter. |
macht | 2:b052ac698148 | 15 | */ |
macht | 2:b052ac698148 | 16 | NTCThermistor(float T0,float R0,float B); |
macht | 2:b052ac698148 | 17 | /** Transfer temperature from resistance. |
macht | 2:b052ac698148 | 18 | *@param R resitance of NTC thermistor |
macht | 2:b052ac698148 | 19 | */ |
macht | 0:d4198719a504 | 20 | float trans_R2T(float R); //transfer resistance to temperature(degrees) |
macht | 0:d4198719a504 | 21 | private: |
macht | 0:d4198719a504 | 22 | float R0_; //basic resisitance of thremister at basic temperature |
macht | 0:d4198719a504 | 23 | float T0_; //basic temperature[°C] |
macht | 0:d4198719a504 | 24 | float K0_; //basic temperature[K] |
macht | 0:d4198719a504 | 25 | float B_; //B constant |
macht | 0:d4198719a504 | 26 | }; |
macht | 0:d4198719a504 | 27 | #endif |
macht | 0:d4198719a504 | 28 | /* |
macht | 0:d4198719a504 | 29 | float R2T(float input){ |
macht | 0:d4198719a504 | 30 | float K0 = T0+273.0; |
macht | 0:d4198719a504 | 31 | float K = (B*K0)/(K0*log(input/R0)+B); |
macht | 0:d4198719a504 | 32 | float temp = K-273.0; |
macht | 0:d4198719a504 | 33 | return temp; |
macht | 0:d4198719a504 | 34 | |
macht | 0:d4198719a504 | 35 | }*/ |