A thermitor sensor detects ambient temperature and temperature changes. For this example we used this temperature sensor to turn on a fan whenever the programed temperature was reached.
Here is a video of the interaction of the thermitor sensor with the fan. When the desired temperature was reached the fan would turn on and whenever the temperature was under that of the desired, the fan would shut off.
There were many ways to conduct enough heat to warm up the thermitor sensor and start the fan, the easiest and fastest we found was covering the sensor with our hands, warming it up immediately. The next option was holding a lamp above the sensor, which depending on the temperature it needed to reach took a considerably longer time to achieve. The temperature could be lowered, and therefore result in the stopping of the fan by either removing ones fingers, or blowing on the sensor, lowering the temperature.
The code originated from the Getting Started with Arduino, 2nd Edition reader. We then manipulated the code to incorporate the thermitor sensor as well as conduct the reaction of the fan to the temperature.
The lights on the fan started in unison when the fan started.
Here is our code:
#include <math.h>
const int FAN = 9; //location pin of fan
/* This function determines a temperature in degrees Farenheit from the raw
data accumulated by the thermistor */
double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return Temp;
}
void setup() {
pinMode(FAN, OUTPUT); //set up fan as output
Serial.begin(115200); //start therm readings
}
void loop() {
if (Thermister(analogRead(0)) > 70) { //if therm temp is greater than 70
analogWrite(FAN, 0); // turn fan ON
}
else {
analogWrite(FAN, 255); // turn fan OFF
}
}