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