1/13/2014

(Arduino Study) temperature sensing

Temperature sensing  using thermister
Thermister gives resistance value depend on temperature changing.







...
#include < math.h>

void setup(void)
{
  Serial.begin(9600);
}

double Thermister(int RawADC){
  double Temp;
  Temp = log(((10240000/RawADC) - 10000));
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;  
  
  return Temp;
}

void printTemp(void){
  double fTemp;
  double temp = Thermister( analogRead(0) );
  
  //read sensor value
  Serial.println("Temperature is:");
  Serial.println(temp);
}

void loop(void)
{
  printTemp();
  delay(1000);
}
---

No comments:

Post a Comment