Created
October 6, 2012 01:18
-
-
Save JosephRedfern/3843353 to your computer and use it in GitHub Desktop.
Thermistor Read Function
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
//a = analog reading, b = formula paramater (beta value of thermistor), r = reference resistance, t = reference temperature, z = resistance of static resistor in potential divider circuit, vin = input voltage. | |
double ntcTemp(double a, double b, double r, double t, double z, double vin){ | |
double vout = (vin*a)/1023.0; | |
double resistance = z/((vin)/(vout)-1); | |
return 1/((log(resistance/r)/b)+(1/t))-273.15; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment