Project13.Analog Temperature
Description
This module is based on the working principle of a thermistor (resistance varies with temperature change in the environment).It can sense temperature changes in the surrounding and send the data to the analog IO of Arduino board. All we need to do is to convert the sensor’s output data into degrees Celsius temperature via simple programming, finally displaying it on the monitor.
It’s both convenient and effective, thus it is widely applied to gardening, home alarm system and other devices.
Specification
Interface type: analog
Working voltage: 5V
Temperature range: -55℃~315℃
Size: 30*20mm
Weight: 3g
Connect
Code
int ThermistorPin = A0;
int Vo;
float R1 = 10000; // value of R1 on board
float logR2, R2, T;
float c1 = 0.001129148, c2 = 0.000234125, c3 = 0.0000000876741; //steinhart-hart coeficients for thermistor
void setup() {
Serial.begin(9600);
}
void loop() {
Vo = analogRead(ThermistorPin);
// R2 = R1 * (1023.0 / (float)Vo - 1.0); //calculate resistance on thermistor
R2 = R1 / ((1023.0 / (float)Vo) - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2)); // temperature in Kelvin
T = T - 273.15; //convert Kelvin to Celcius
// T = (T * 9.0)/ 5.0 + 32.0; //convert Celcius to Farenheit
Serial.print(Vo);
Serial.print("Temperature: ");
Serial.print(T);
Serial.println(" C");
delay(500);
}
Phenomenon