Skip to content

Instantly share code, notes, and snippets.

@JosephRedfern
Created October 6, 2012 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JosephRedfern/3843353 to your computer and use it in GitHub Desktop.
Save JosephRedfern/3843353 to your computer and use it in GitHub Desktop.
Thermistor Read Function
//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