TEMPERATURE CONTROLLED FAN USING PIC16F877A

Shubham Gupta

--

This project will display the configuration, development, advancement, control and assessment of an automatic switching speed electric fan. This further venture of a smart electric fans than before that utilizing “clever innovation’’. The microcontroller base programmed fan framework introduced in this task is obliged to satisfy the necessity of advances “tomorrow will be better than today”. The electric fan naturally switches the speed as indicated by the environment temperature changes.

Generally, electronic gadgets create enough heat due to internal loss. There is a necessity to decrease heat to so that electronics devices won’t lose their characteristic. The heat can be minimized in various methods. One of the method is temperature dependent dc fan implementing microcontroller. When environment temperature sensed by the sensor crosses the threshold value fan is switched on and temperature is reduced. The fan will remain on till the temperature reduces below the threshold value. This general idea is used in this project.

2.Introduction

The objectives of this project are to:-

(i) Enable the electric fan to consequently change the rate level as indicated by temperature changes.

(ii) Develop an automatic fan framework that can change the speed level because of the environment temperature changes.

2.1PIC

PIC is a family of microcontrollers made by Microchip Technology. The name PIC initially referred to Peripheral Interface Controller, and is currently expanded as Programmable Intelligent Computer. The first parts of the family were available in 1976; by 2013 the company had shipped more than twelve billion individual parts, used in a wide variety of embedded system. [6]

2.2PIC16

These devices feature a 14-bit wide code memory, and an improved 8-level deep call stack. The instruction set differs very little from the baseline devices, but the two additional opcode bits allow 128 registers and 2048 words of code to be directly addressed. There are a few additional miscellaneous instructions, and two additional 8- bit literal instructions, add and subtract. The midrange core is available in the majority of devices labeled PIC12 and PIC16.[5]

2.3 PIC16F877A Pin Diagram

3.Components

3.1.PIC16F877A

3.2.LCD 2x16

It is very basic module and is very commonly used in various devices and circuits. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. The 16 x 2 intelligent alphanumeric dot matrix display is capable of displaying 224 different characters and symbols. This LCD has two registers, namely, Command and Data.[3]

3.3.LM35

LM35 is a device which converts the physical signal into electrical signal. That’s why this is known as the transducer. It is calibrated with the environmental temperature and it is linearly varies with the temperature and its output is in volt. There is no need of external calibration to provide the accuracy of the LM35 at room temperature which is about ±¼°C. Minimum temperature that can be measured by the LM35 device is -55°C. And maximum temperature that can be measured by LM35 is 150°C. Calibration of LM35 is done by trimming at the water level. [1]

To make the interfacing of control circuitry and readout circuitry very easy, low impedance at output side, output which is linear and precise inherent calibration of LM35 plays an important role. Temperature sensor takes a very low current of order 60 μA from the input supply. Heat loss in the LM35 is very less degree of around 0.1°C. LM35 can work in the range of -50°C to +150° which is the rated value. Another device which is also a temperature sensor of the family of LM35 known as LM35C which ranges from -40°C to +110°C. LM35 costs around 10 rupees in India and is easily available in the market which anyone can buy at any convenience store or electronics store.[1]

4.Diode

5.LED Red

6.Buzzer

7.DC Fan

8.Supporting Wires

4.Code

sbit LCD_RS at RB4_bit;

sbit LCD_EN at RB5_bit;

sbit LCD_D7 at RB3_bit;

sbit LCD_D6 at RB2_bit;

sbit LCD_D5 at RB1_bit;

sbit LCD_D4 at RB0_bit;

sbit LCD_RS_Direction at TRISB4_bit;

sbit LCD_EN_Direction at TRISB5_bit;

sbit LCD_D7_Direction at TRISB3_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D4_Direction at TRISB0_bit;

sbit buzzer at portb.b6;

float temp;

char temper[7];

float feh;

char fehr[7];

void main(){

trisc.f2=0;

trisa.f0=1;

trisb.b6=0;

adc_init();;

Lcd_Init();

PWM1_Init(5000);

pwm1_start();

Lcd_Cmd(_LCD_CURSOR_OFF);

Lcd_Out(1,1,”Temp Thermometer”);

Lcd_out(2,1,”LM35 with Alarm”);

delay_ms(1000);

Lcd_Cmd(_LCD_CLEAR);

Lcd_Out(1,1,”fan controlled”);

Lcd_out(2,1,”by temprature”);

delay_ms(1000);

Lcd_Cmd(_LCD_CLEAR);

while(1){

temp=ADC_Read(0)*.005*100;

feh= temp*1.8 + 32.0;

pwm1_set_duty(2*temp);

portc.f2=1;

inttostr(temp,temper);

inttostr(feh,fehr);

lcd_out(1,1,”Temp cels=”);

lcd_out(1,12,Ltrim(temper));

lcd_Chr_Cp(223);

lcd_Chr_Cp(‘C’);

lcd_out(2,1,”Temp fehr=”);

lcd_out(2,12,Ltrim(fehr));

lcd_Chr_Cp(223);

lcd_Chr_Cp(‘F’);

if(temp>40){ buzzer=1; delay_ms(50); }

else{ buzzer=0; }

}

}

5.Circuit

1.Protues 8 Professional is used to design the circuit

2.MIKRO C is used to generate HEX file for the PIC

6.Working

1.The LCD and other components gets initialized.

2.Reading from LM35 is constantly compared with the pre-default value.

3.ADC pins of the microcontroller starts converting analog signal into digital signal.

4.Using the internal successive approximation method the conversion of analog value to digital value is done by the microcontroller

5.On further increasing the temperature the microcontroller. sends the signal to turn the fan On.

6. When the temperature is greater than the threshold or set value then the microcontroller gives output to the motor driver for starting the DC fan.

6.1 Working of Code

1. Initializing pins of PIC and LCD by setting sbit.

2. Declaring variables feh and temp are both float and character array to print on lcd.

float temp; char temper[7];

float feh; char fehr[7];

3. Set port direction as output for A,B and C

trisc.f2=0; trisa.f0=1; trisb.b6=0;

4. Initialize ADC,LCD and motor.

adc_init(); Lcd_Init(); PWM1_Init(5000); pwm1_start();

5. Print Roll Nos and Project name on LCD using lcd_out(“String”) and clearing after a delay of 1sec.

Lcd_Out(1,1,”fan controlled”); Lcd_out(2,1,”by temprature”);

delay_ms(1000); Lcd_Cmd(_LCD_CLEAR);

6. In while loop do 7.

7. Print the temperature in Fahrenheit and Celsisus. The temperature is sensed by PORTC using LM35.

temp=ADC_Read(0)*.005*100;

The floating value of temperature in Celsius is converted to Fahrenheit also. Then we display the Temperature as strings on 2x16 LCD.

8. Using an If condition to check is temperature in celsisus is greater than 40C we initialize motor using pwm1_set_duty(2*temp) and make buzzer and led variables set to 1.

If (temp>40){

pwm1_set_duty(2*temp);;buzzer=1; delay_ms(50);

}

7.Simulation Results

1.Temperature under 40C , so the LED not glowing and fan is stationary.

2. Temperature is above 40C , so the LED is glowing and fan is revolving.

Video at https://www.youtube.com/watch?v=dvdsqK4Pz6s

8.Applications
1.It is very economical and easy to integrate, so used in heat dissipation devices like CPUs.

2.Cooling pads for laptop, or inbuilt fan of laptops are also temperature controlled.

3.In saving the energy, electronic devices adopt this mechanism to reduce the wastage of power in home appliccations.

4.In car engines to reduce the heat of engine.

Conclusion

Basic idea of this project is to run the DC motor fan when temperature sensed by the temperature sensor is greater than threshold value and also to make a beep using buzzer and indicate the higher temperature using a LED. So, we have successfully implemented a PIC16 circuit in which the fan is controlled by temperature. As the temperature is more than 40 deg. C the fan starts rotating and as the temperature increases the speed on fan increases with a linear relation .

In this project we have simulated the circuit using PIC16 microcontroller through the protues. The microcontroller uses the hex file to execute the program. The temperature sensor output is connected to the microcontroller and it gives the output to the motor driver IC which runs the motor. In this way our main objective of the project is achieved.

References

1. Sharma, Akash, and Vishal Pramanik. “Fan Speed Controller using PWM and LM35.”

2. F. Luo, X. Zhao, and Y. Xu, “A new hybrid elevator group control system scheduling strategy based on particle swarm simulated annealing optimization algorithm”, Intelligent Control and Automation (WCICA), 2010, pp.5121–5124.

3. IEEE Vehicle Power and Propulsion, Sept. 3–5 Harbin, China, 2008, pp. 1–6.

4. Solís, Jaime Héctor Sotero, and Omar Miguel Aznarán Rodriguez. “Sistema de control para mantener la temperatura constante del agua en un tanque de teknopor.” MATHEMA 1.1 (2018).

5. Anshuman, B. “PIC16F877A-based Temperature monitoring system.“

6. Shanmugasundaram, M., G. Muthuselvi, and S. Sundar. “Implementation of PIC16F877A based intelligent smart home system.” International Journal of Engineering and Technology 5.2 (2013): 1608–1624..

7. Xiaodong Xia, Based on Single Chip MicrocomputerRemote Wireless Control System Design. Coal Mine Machinery, vol. 32 (8), 2011, pp. 202–204.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Shubham Gupta
Shubham Gupta

Written by Shubham Gupta

Software Engineer and Content Writer at Lovebird Lingerie

No responses yet

Write a response