Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:d8246c20aed2, committed 2021-07-01
- Comitter:
- mahphalke
- Date:
- Thu Jul 01 13:41:18 2021 +0530
- Parent:
- 3:a49cef3daae5
- Commit message:
- Adding equation to calculate 10K 44031 NTC temperature using Beta value
Changed in this revision
| ntc_10k_44031.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a49cef3daae5 -r d8246c20aed2 ntc_10k_44031.cpp
--- a/ntc_10k_44031.cpp Tue May 25 15:28:17 2021 +0530
+++ b/ntc_10k_44031.cpp Thu Jul 01 13:41:18 2021 +0530
@@ -18,6 +18,15 @@
#include "thermistor.h"
#include "ntc_10k_44031.h"
+/* Convert the temperature using Beta factor specified for 44031 10K NTC */
+//#define NTC_10K_44031_CONVERT_USING_BETA_VALUE
+
+#if defined(NTC_10K_44031_CONVERT_USING_BETA_VALUE)
+#define NTC_10K_44031_RESISTANCE_AT_25C 10000 // 10K
+#define NTC_10K_44031_ROOM_TEMP_IN_KELVIN 298.15
+#define NTC_10K_44031_BETA_VALUE 3694
+#endif
+
#ifdef DEFINE_LOOKUP_TABLES
/* 10K NTC look-up table. Values are resistance in ohm for temperature
* range from -10 to 80C with +/-1C tolerance.
@@ -61,13 +70,20 @@
/*!
* @brief Convert the thermistor resistance into equivalent temperature using
- * Steinhart-Hart equation for 10K 44031 NTC
+ * Steinhart-Hart equation Or Beta value for 10K 44031 NTC
* @param resistance[in] - thermistor resistance
- * @return Thermistor temperature value
+ * @return Thermistor temperature value in Celcius
*/
float ntc_10k_44031rc::convert(const float resistance)
{
+#if defined(NTC_10K_44031_CONVERT_USING_BETA_VALUE)
+ float temperature;
+ temperature = (1 / ((log(resistance / NTC_10K_44031_RESISTANCE_AT_25C) /
+ NTC_10K_44031_BETA_VALUE) + (1 / NTC_10K_44031_ROOM_TEMP_IN_KELVIN))) - 273.15;
+ return temperature;
+#else
return thermistor::convert(resistance, coeff_A, coeff_B, coeff_C);
+#endif
}