Introduction: Automatic Temperature Control Fan Speed
In this project, I will design a practical temperature controller that controls temperature of any device according to its requirement for any industrial application. It can monitor the temperature and displays it on an LCD display in the range of –50°C to +150°C. The heart of the circuit is an Arduino board which controls all its functions. A NTC (Negative Temperature Coefficient) Thermistor is used as temperature sensor.
There are many potential applications for NTC thermistors. Their accuracy and stability make them highly useful for a wide range of purposes. These applications include temperature measurement, compensation, and control. Over the last decade, advances in electronics have made devices smaller, cheaper and faster. This project is about how the speed of a fan can be controlled, based on temperature sensor. It is also a part of smart home application where the fan will gradually increase its speed if the temperature is increasing. In general, home appliance fans need to be operated manually with the help of regulators with the variation of temperature, thus requires a repeatedly extra effort for regulating the fan speed which acts to our agony. So as to reduce this extra effort and to add comfort, it is intended in this paper designing an “Automatic Temperature Controlled Fan”.
The main intension is to control the fan by heating the sensor, i.e. the thermistor, where the speed of the fan is dependent and controlled by any device’s temperature like PC. As the temperature of the device increases or decreases, the speed of fan increases or decreases respectively. So, it can be used mainly as a cooling device. By modifying the circuit slightly, it can also be used to control the room temperature, depending on the property of thermistor. The thermistor used in the circuit here, decreases its resistance with increasing temperature, hence the electrical conductivity also increases, increasing voltage across it, resulting in an increment in the speed of the fan. Thus, it is possible to control the speed of the fan automatically when the device’s temperature varies. Experiment can be followed to evaluate whether this circuit can save energy through the use of temperature sensor and thus promote efficiency.
The circuit exploits the property of sensor to operate the DC Fan. A sensor is a type of transducer. In a broader sense, a transducer is sometimes defined as any device that converts energy from one form to another. Besides that, the component that made up the temperature sensor is known as thermistor. Thermistor is a kind of temperature dependent resistor and its resistance varies depending on the temperature in its vicinity. There are two types of Thermistors- Negative Temperature Coefficient Thermistor (NTC) and Positive Temperature Coefficient Thermistor (PTC). Thermistors are an analog temperature device is interfaced to the analog pin of the Arduino board, through its built-in ADC, which converts these analog reading and displays that on the LCD, to indicate temperature of the device. User-defined temperature settings can be done using push buttons provided through Arduino board. Maximum and minimum settings are used for allowing any necessary hysteresis. Few push buttons are used to set the temperature by INC, for increase and DEC for decrease settings. As soon the max and min temperatures are set then the Arduino program generates PWM output on the corresponding digital output according to the measured temperature. This is fed to a DC Fan through a motor driver IC. The fan speed is proportional to the temperature measured.
Step 1: Material Needed for This Project
.
List of Material :
- four 10 KΩ Resistors.
- One 1 KΩ Resistors.
- One 220 Ω Resistor.
One
Red LED- Four Push Button Switches.
you may found all the above components HERE
NTC Thermistor 103 ( Resistance (at 25℃) 10K Ω Operating Range-50 ℃ ~ 150 ℃ Thermal Time Constant 20 s Thermal Dissipation Constant 6.5mW/℃ Max. allowable power 550 mW )
- One LCD Display 16*2 OR I2C module
One Variable Resister 10 kΩ OR HERE OR Hole Kit
- One Breadboard
One Arduino uno
One cell box
Step 2: Conditioning Circuit:
.
The resistance of most common types of thermistor decreases as the temperature rises. They are called negative temperature coefficient, or NTC, thermistors. Note the -t° next to the circuit symbol. A typical NTC thermistor is made using semiconductor metal oxide materials. (Semiconductors have resistance properties midway between those of conductors and insulators.) As the temperature rises, more charge carriers become available and the resistance falls. Its simple circuit using the principle of the voltage divider rule to calculate the output voltage which eventually lead to measure the temperature difference.
Step 3: Sensor Modeling
.
We can module the thermistor sensor as follow:
1. A model for the resistivity of a semiconductor as a function of the temperature was found by Steinhart and Hart 1968. a common method to characterize a thermistor is to use the Steinhart-Hart equation:
1/T = A + [B * ln(R)] + [C * ln(R)^3]
The Steinhart-Hart law describes the absolute temperature T (in Kelvins) as a function of the NTC thermistor's resistivity (in Ω) according to the formula above.
Where:
T = Degrees Kelvin
R = Resistance
A, B, C = Curve-fitting constants.
In my testing for the sensor, I notice the next result varying the temperature:
T = 0°C when the resistance of a 10kohm thermistor R is 33430 ohms
T = 50°C when the resistance of a 10kohm thermistor R is 3510 ohms
T = 100°C when the resistance of a 10kohm thermistor R is 637ohms
The coefficients A, B and C are found by taking the resistance of the thermistor at three
temperatures and solving three simultaneous equations.
A = 0.001176064644
B = 0.0002293915326
C = 0.00000008430920765
2. The β-Parameter Equation
· R0 is the thermistor resistance at temperature T0.
· β is a curve fitting parameter.
β = ln (R1/ R2) / ( 1/T1 - 1/ T2)
Result I got with some simple calculation using formula above:
β = 3978.85 and R thermistor calculated at (25°C) = 9855.62 Ω
3.The last step to do is to convert Temperature from kelvin to Celsius by the formula below:
T(C) = T(k) - 273.15
Note: Every one should do modelling the sensor by himself because resistance value diver from one senser to another sensor even with the same type. you cannot take above values as yours unless you will get a wrong reading of temperature.It might be work if calibrate the sensor (coming at next step). these values must involves in your arduino formulas in the sketch.
more Information and references:
Beta Calculator: https://www.ametherm.com/thermistor/ntc-thermistor...
Thermistor Mathematics: http://mathscinotes.com/2011/07/thermistor-mathema...
Thermistor Calculator http://www.thinksrs.com/downloads/programs/Therm%2...
NTC Thermistor theory : see attach file or visit http://www.ecircuitcenter.com/Circuits/therm_model...
Attachments
Step 4: System Design
.
1. Measurement System Architecture
Vo = Vs * (R balance/ ( R thermistor + R balance ))
R thermistor=R balance⋅(Vs / Vout )−1)
see figure 1
2. Measurement System Design
2.1 Conditioning Circuit Design
Conditioning circuit of the sensor.
See figure 2
R Thermistor = 9855.62 Ω
R Series = 9800 Ω
2.2 Processing Design
Following is an example of modeled thermistor sensor
double temp;
int ADCVal = analogRead(tempPin); // Inputs ADC Value from thermistora nd outputs Temperature in Celsius
R = log(10000.0*((1023.0/ADCVal-1)));
temp = 1 / (0.001176064644+ (= 0.0002293915326* R) + (0.00000008430920765* R * R * R));
temp = temp - 273.15; // Convert Kelvin to Celsius
return temp; // Return the Temperature
See more that might help on
Step 5: Connection and Wiring
.LCD Connection:
- LCD RS pin to digital pin 8
- LCD D4 pin to digital pin 4
- LCD D5 pin to digital pin 5
- LCD D6 pin to digital pin 6
- LCD D7 pin to digital pin 7
- LCD A pin to 220 Resistor To 5V
- LCD k pin to Ground
- LCD Enable pin to digital pin 9
- LCD VDD pin to +5V to
Pos
Pin - LCD RW pin to VSS to
Pos
Ground LCD Vo pin to pos base
- set_btn to pin 2 // Set Botton
- decr_btn to pin 1 // Decrement Botton
- incr_btn to pin 0 // Increament Botton
- brk_btn to pin 3 // break Botton
- RLED to pin 12 // LED Pin
- tempPin to pin A5 // Thirmoster Output Pin
- fan to pin 11 // Fan Enable
.L293D Motor Drivee Connection:
- Pin 4,5,12,13 To Ground.
- Pin 2 To +5V
- Pin 1 to Arduino Pin 11 Enable
- Pin 16 To +5V
- Pin 8 to +V external power supply ( usually 12V supply )
- the ground of the voltage supply to the ground of the circuit.
- Pin 7 to Ground.
Step 6: Codes
/*practical temperature controller that controls temperature using a speed<br>fan (Cooling fan) created by: Ali Shwaiheen May 2017*/ /****************************************** * LCD RS pin to digital pin 8 * * LCD D4 pin to digital pin 4 * * LCD D5 pin to digital pin 5 * * LCD D6 pin to digital pin 6 * * LCD D7 pin to digital pin 7 * * LCD A pin to 220 Resistor To 5V * * LCD k pin to Ground * * LCD Enable pin to digital pin 9 * * LCD VDD pin to VSS to Ground Pos * * LCD RW pin to VSS to Ground Pos * *****************************************/ #include #include LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int set_btn = 2; // Set Botton int decr_btn = 1; // Decrement Botton int incr_btn = 0; // Increament Botton int brk_btn = 3; // break Botton int RLED = 12; // LED Pin */ double temp; // Sensor Data int tempPin = A5; // Thirmoster Output Pin int tempMin = 20; // Minumum Temperature Where The Fan Start to Operate At Low Rate Of Speed int tempMax = 30; // Maximum Temperature Where The Fan Start to Operate At Full Rate Of Speed int fan = 11; // Fan Enable int fanSpeed; // Fan Data int fanLCD,x=0; // LCD setup for varialble bush botton
void setup() {
pinMode(fan,OUTPUT); pinMode(RLED,OUTPUT); pinMode(tempPin,INPUT); attachInterrupt(0,set_Tmp,LOW); lcd.begin(16, 2);
}
void loop() {
int temp = readTemp(); // Get the Temperature if(temp < tempMin) { // If Temperature is Lower Than the Minimum Temperature fanSpeed = 0; digitalWrite(fan,LOW); } if((temp > tempMin) && (temp <= tempMax)) // If Temperature is Between The higher and Lower Tempertature { fanSpeed = map(temp,tempMin,tempMax,32,255); // Actual Speed of The Fan fanLCD = map(temp,tempMin,tempMax,0,100); // Speed of Fan To Display on LCD analogWrite(fan,fanSpeed); // Spin the fan at the fanSpeen speed } if( temp > tempMax) // If temperature higher than the Maximum Temperature turn on the LED { digitalWrite(RLED,HIGH); // Turn on LED } else { digitalWrite(RLED,LOW); }
lcd.print("TEMP:"); lcd.print(temp); // Display the Temperature lcd.print("C"); lcd.setCursor(0,1); // Move cursor to next line lcd.print("FANS:"); lcd.print(fanLCD); // Display the fan speed lcd.print("%"); delay(1000); // Delay One second lcd.clear(); }
double readTemp(){ // Get Temperature and Convert it To Celsius double temp; int ADCVal = analogRead(tempPin); // Inputs ADC Value from Thermistor and outputs Temperature in Celsius temp = log(10000.0*((1023.0/ADCVal-1))); temp = 1 / (0.001129148 + (0.000234125 * temp) + (0.0000000856741 * temp * temp * temp)); temp = temp - 273.15; // Convert Kelvin to Celcius return temp; // Return the Temperature } void set_Tmp(){
x = !x;
if(x==1) { lcd.clear();
lcd.setCursor(0,0);
lcd.print("PLEASE SET ");
lcd.setCursor(0,1);
lcd.print("MIN TEMPERATURE");
while(1) { if(digitalRead(incr_btn)==LOW) { while(digitalRead(incr_btn)==LOW) { tempMin = tempMin+1;
lcd.setCursor(0,0);
lcd.print("SET MIN TEMP:");
lcd.print(tempMin);
delay(10000); } }
you may download...
Attachments
Step 7: Calibration
Well, it'snot that difficult to calibrate a thermometer, the hardest work is to get accurate result match real life needed especially at hospitals, doctors take decision based on patient temperature. I imagine that the thermometer being used isn’t accurate, what could be happened?... people might be being killed in some cases. Anyway, I used the facts of boiling point of water and take several readings of the thermistor resistance change respect to changing in temperature. I kept repeat heating up the sensors, so I hopefully get a true value of resistance at this boiling point. In addition, I used the fact of freezing water point and repeat reading resistance change of the NTC thermistor.
I used another way to get more comfortable. I have a magnetics mixer used for mixing heavy liquid supplied by controllable heater with digital monitor. I used this mixture to helping being more presides. It wasn’t easy handling this case, but eventually it helped.
In Fact, this is not good enough to get an actual value or even to be fully calibrated. Calibration may work for only a short-term event. Calibration can be perfectly done by doing lots of processes and tests changing the surrounding environment and conditions. This takes long time and gain a highly apparated results.
Step 8: Accuracy and Precision
.
Only in my situation, the accuracy based on calibration and testing results I collect Showed that there is a ± 0.022 possible errors comparing with the data sheet provided by the manufacturing. Accuracy was achieved and hit the center. It was achieved while calculating and measuring the parameters during modeling the circuit which they are Beta ant the correct thermistor resistances and also the Steinhart-Hart coefficient. Getting this caricaturized variable is almost 80 percent of the hole process in order to get high accuracy. Other parts that might affect the accuracy like the microcontroller internal mistakes, during wiring mistakes, using a device as trust device doing some calculating and/or calibration while is not really fairly, causing errors that leads to un accurate modulation and could a precise one.
Step 9: End
Thank you spending time reviewing my project. Feel free to ask about. Do not be shy to correct me in any details. I`m welcoming feedback with love and respect.