Created
March 26, 2024 01:33
-
-
Save larryli/ec66d2c9f818cd56440fba3e0b04fbcf to your computer and use it in GitHub Desktop.
NTC 100K
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
/** | |
* 3v3 --- [10K] -+- [NTC] --- GND | |
* | | |
* +-- ADC | |
*/ | |
#define NTC_V 3300 | |
#define NTC_R_PULLUP 10000 | |
#define NTC_R(v) (NTC_R_PULLUP * (v) / (NTC_V - (v))) | |
/** | |
* B: 3950 | |
* T25: 273.15 + 25 | |
* T50: 273.15 + 50 | |
* R25: 100000 | |
* R50: 35884 | |
* T25 * T50 R25 | |
* B = --------- * ln(---) | |
* T50 - T25 R50 | |
*/ | |
#define NTC_B 3950 | |
#define NTC_R25 100000 | |
#define NTC_T25 (273.15 + 25) | |
#define NTC_T0 273.15 | |
#define NTC_T(r) (1 / (1 / NTC_T25 + log((r) / NTC_R25) / NTC_B) - NTC_T0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment