Projects   /   Sensors & Temperature   /   PIC16F877A

Temperature controlled fan using PIC 16F877A

An LM35 feeds the PIC16F877A ADC and the code scales its 10 mV per degree output to vary fan speed by PWM through an L293D motor driver.

Published
Updated

At a glance

CategorySensors & Temperature
PIC modelPIC16F877A
Reading time~3 min
Jump to a section
  1. DESIGN OF TEMPERATURE CONTROLLED FAN SYSTEM:
  2. LM35:
  3. CALIBRATION:
  4. Quick Solutions to Questions related to Temperature Controlled Fan System:
  5. Related projects

Summary of Temperature controlled fan using PIC 16F877A

This embedded system automatically controls a DC motor's speed based on external temperature readings. Using an LM35 sensor to detect temperature changes, the microcontroller processes the analog data via its A/D channel. The system adjusts the motor speed through Pulse Width Modulation (PWM), increasing speed as temperature rises and decreasing it as temperature falls, effectively acting as an automated cooling fan.

Parts used in the Temperature Controlled Fan System:

  • LM35 Temperature Sensor
  • Microcontroller with A/D channel
  • PWM module
  • DC Motor
  • L293D Driver IC

You might have come across several applications where we need to control a specific device based on analog parameter. This Embedded system works in a similar concept where we are about to control the speed of a DC motor using based on the external temperature. The rise in temperature will result in increase in speed of the motor and vice versa. These type of Temperature controlled fan systems can generally be used to maintain temperature of a room or object automatically.Temperature controlled fan using PIC 16F877A

DESIGN OF TEMPERATURE CONTROLLED FAN SYSTEM:

  • The temperature is measured by means of a temperature sensor LM35.
  • The output voltage of the sensor is fed to the A/D channel of the Microcontroller.
  • Based on the sensed temperature the speed of the motor is controlled using PWM .
  • Several temperature ranges was set in the code to vary the motor speed based on the level of temperature sensed.
  • The speed of the motor is controlled by using PWM.
  • The motor is driven using a driver IC l293D, See a brief explanation on its working and wiring here.

LM35:

Schematic Temperature controlled fan using PIC 16F877A
LM35 Pin Diagram

Lm 35 is used to sense the external temperature which is capable of sensing temperature ranges from -55 to 150 C. The output voltage is proportional to the temperature hence there is no need of trimmers to calibrate the reading. The output voltage of this sensor varies by 10mv per degree change in temperature.

CALIBRATION:

We are using a 10 bit ADC and Vcc as Vref to the ADC module of the Controller. So in order to determine the step size we have to divide the Vref by our resolution that is 2^10 ( 1024 ).

Step Size = 5 / 1024 = 4.83mV

We obtain a change of 10mV with each rise or fall in temperature from the sensor. And value in the ADC register will alter by two steps with each degree change in the sensor since two increments of step size i.e 4.833mV * 2 = 9.96mV which is approximately equal to 10mV. So in order to obtain the original value we have to divide the contents in the ADC register by 2

For more detail: Temperature controlled fan using PIC 16F877A

  • How does the system control motor speed?
    The speed is controlled using PWM based on the sensed temperature level.
  • What component measures the external temperature?
    An LM35 temperature sensor is used to measure the temperature.
  • Can the LM35 sensor sense temperatures below zero?
    Yes, the sensor can sense temperature ranges from -55 to 150 C.
  • Does the LM35 require calibration trimmers?
    No, there is no need for trimmers because the output voltage is proportional to the temperature.
  • How much does the output voltage change per degree?
    The output voltage varies by 10mv per degree change in temperature.
  • What resolution does the ADC use in this design?
    A 10 bit ADC is used with Vcc as the reference voltage.
  • How do you calculate the original temperature value from the ADC register?
    You must divide the contents in the ADC register by 2 to obtain the original value.
  • Which driver IC is used to drive the motor?
    The motor is driven using a driver IC l293D.
Beginner Tutorials · PIC16F877A

PIC16F877 Driving LCD in 4-Bit Mode using PIC16F877 with Proteus Simulation

Introduction This microcontroller project shows how a PIC16F877 can drive an LCD display using 4-bit mode inside a Proteus simulation.The project demonstrates...

Programmers & ICSP · PIC16F877A

EPE PIC/LCD Demo using PIC16F877 with Proteus Simulation

IntroductionThe EPE PIC/LCD Demo is a classic microcontroller project that demonstrates how a PIC16F877 can fully control a PG12864F graphical LCD.Designed as...

Motors & Robotics · PIC16F877A

Efficient Sun-Following Robot: A Solar Tracker with Microcontroller Control

Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....

Sensors & Temperature

Spectrum Analyzer using TMS320F28023DA with Proteus Simulation

Introduction This project demonstrates a real-time audio spectrum analyzer using the TMS320F28023DA Piccolo microcontroller, simulated in Proteus VSM. The system captures an...

Sensors & Temperature

DHT22 Low Cost Humidity Sensor using PIC18F25K20 with Proteus Simulation

IntroductionThis microcontroller project demonstrates how to interface a DHT22 (RHT03) digital temperature and humidity sensor with a PIC18F25K20 using Proteus simulation.The project...

Sensors & Temperature

Crafting a Microcontroller-Based Temperature Monitoring System

Abstract As technological advancements progress, processes become increasingly intricate, demanding a corresponding expansion in the parameters necessary for efficient analysis. Data acquisition,...

Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough...