Temp based fan speed control


Published on

Published in: Technology, Business
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Temp based fan speed control

  2. 2. Contents 1. INTRODUCTION 2. THEORY 2.1. LM35 (Temperature sensor) 2.2. ATMEGA micro controller unit 2.3. Brushless variable speed DC motor [DR-6634-514] 2.4. N mosfet (BUK9575-100A) 2.5. PWM (Pulse width modulation) 3. METHODOLOGY 3.1. Circuit schematic 3.2. Control algorithm - Flow chart 3.3. Hardware implementation 3.4. Software implementation 4. APPLICATIONS 5. CONCLUSION APPENDIX Program code List of components
  3. 3. 1. INTRODUCTIONThe idea behind the project TEMPERATURE BASED FAN SPEED CONTROL is to control thespeed of the fan using microcontroller based on the variation in temperature detected by thetemperature sensor.In this project we are using LM35 series analog temperature sensor. This is a precision integrated-circuit, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. It israted to operate over a -55° to +150°C temperature range. It has + 10.0 mV/°C linear scalefactor.The output of this sensor will be connected to ATMEGA-32 micro controller’s PORT-A. Theinbuilt ADC in ATMEGA is used for converting into Digital format. That will be used by ATMEGAto generate control logic. Then the PWM output from ATMEGA micro-controller is given tovariable speed DC motor through a motor driver stage.
  4. 4. 2. THEORY2.1. LM35 TEMPERATURE SENSORThe LM35 series are precision integrated-circuit temperature sensors, whose output voltage islinearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage overlinear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract alargeconstant voltage from its output to obtain convenient Centigradescaling. The LM35 does notrequire any external calibration or trimming to provide typical accuracies of ± 1/4°Cat roomtemperature and ±3/4°C, over a full -55 to +150°Ctemperature range. Low cost is assured bytrimming andcalibration at the wafer level. The LM35’s low output impedance,linear output, andprecise inherent calibration makeinterfacing to readout or control circuitry especially easy. Itcan beused with single power supplies, or with plus andminus supplies. As it draws only 60 µA from itssupply, it hasvery low self-heating, less than 0.1°C in still air. The LM35 israted to operate over a -55° to +150°C temperature range.Full range centigrade temperature sensor:MATHEMATICAL MODELLING:Range of sensor output: -550 mV to 1500mV (for temperature range of -55 to 150 degree Celsius).Range of ADC input for ATMEGA: 0 to 5 VADC output: 0 To1023 (10 bit)For every 1 degree Celsius temperature rise , rise of sensor output is 10mVFor every 5 milli volt input rise to ADC, count increments by 1ADC_OUT = 1023 * (ADC_IN)/5000;So Temperature = ADC_OUT /2.046;
  5. 5. 2.2. ATMEGA-32 MICRO CONTROLLER UNIT:Microcontrollers must contain at least two primary components – memory (RAM), and aninstruction set. RAM is a type of internal logic unit that stores information temporarily. RAMcontents disappear when the power is turned off. While RAM is used to hold any kind of data, someRAM is specialized, referred to as registers. The instruction set is a list of all commands and theircorresponding functions. During operation, the microcontroller will step through a program (thefirmware). Each valid instruction set and the matching internal hardware that differentiate onemicrocontroller from another.Most microcontrollers also contain read-only memory (ROM), programmable read-only memory(PROM), or erasable programmable read-only memory (EPROM). Al1 of these memories arepermanent: they retain what is programmed into them even during loss of power. They are used tostore the firmware that tells the microcontroller how to operate. They are also used to storepermanent lookup tables. Often these memories do not reside in the microcontroller; instead, theyare contained in external ICs, and the instructions are fetched as the microcontroller runs. Thisenables quick and low-cost updates to the firmware by replacing the ROM.Where would a microcontroller be without some way of communicating with the outside world?This job is left to input/output (I/O) port pins. The number of I/O pins per controllers varies greatly,plus each I/O pin can be programmed as an input or output (or even switch during the running of aprogram). The load (current draw) that each pin can drive is usually low. If the output is expectedto be a heavy load, then it is essential to use a driver chip or transistor buffer.Most microcontrollers contain circuitry to generate the system clock. Thissquare wave is theheartbeat of the microcontroller and all operations aresynchronized to it. Obviously, it controls thespeed at which the microcontrollerfunctions. All that needed to complete the clock circuit would bethe crystal or RCcomponents. We can, therefore precisely select the operating speed critical tomanyapplications.To summarize, a microcontroller contains (in one chip) the following elements:  Instruction set  RAM  ROM,PROM or EPROM  I/O ports  Clock generator  Reset function  Watchdog timer  Serial port  Interrupts  Timers  Analog-to-Digital converters  Digital-to-Analog converters
  6. 6. In order to maximize performance and parallelism, the AVR uses a HARVARD architecture with separatememories and buses for program and data. Instructions in the program memory are executed with a singlelevel pipelining. While one instruction is being executed, the next instruction is pre-fetched from the programmemory. This concept enables instructions to be executed in every clock cycle.
  7. 7. 2.3. Brushless variable speed DC motor [DR-6634-514]Brushless DC motors use a rotating permanent magnet or soft magnetic core in the rotor, and stationaryelectrical magnets on the motor housing. A motor controller converts DC to AC. This design is simplerthan that of brushed motors because it eliminates the complication of transferring power from outside themotor to the spinning rotor. Advantages of brushless motors include long life span, little or nomaintenance, and high efficiency. Disadvantages include high initial cost, and more complicated motorspeed controllers. Some such brushless motors are sometimes referred to as "synchronous motors"although they have no external power supply to be synchronized with, as would be the case with normalAC synchronous motors.DC Motor DR-6634-514:
  8. 8. 2.4. BUK9575-100A:Logic level N-channel enhancement mode Metal Oxide SemiconductorField-Effect Transistor(MOSFET) in a plasticpackage, using Trench MOS technology. This product has been designed and qualified to the appropriate AEC standardfor use in automotive critical applications. It has low conduction losses due to low on-state resistance.This transistor canbe switched on and off very rapidly (millions of times per second) and can handle the large currents required for bigmotors.Specifications:2.5. PULSE WIDTH MODULATION:The Pulse-Width-Modulation (PWM) in microcontroller is used to control duty cycle of DC motordrive. PWM is an entirely different approach to controlling the speed of a DCmotor. Power issupplied to the motor in square wave of constant voltage butvarying pulse-width or duty cycle. Dutycycle refers to the percentage of one cycleduring which duty cycle of a continuous train of pulses.Since the frequency is heldconstant while the on-off time is varied, the duty cycle of PWM isdetermined by thepulse width. Thus the power increases duty cycle in PWM.The expression of duty cycle is determined by, Basically, the speed of a DC motor is a function of the input power and drive characteristics. Whilethe area under an input pulse width train is measure of theaverage power available from such aninput.
  9. 9. 3. METHODOLOGY3.1. Circuitschematic:Pins used in ATMEGA 32:PORTA: pin 0 is for giving analog input from sensorPORTC: pins 0,1,2,3 are connected to D4, D5, D6, D7 for data transmission to LCD; Pins 4, 5, 6 are connected to EN, RD, RS of LCD module.PORTB: pin 3 is used for PWM output
  10. 10. 3.2. Control algorithm Flow chart:
  11. 11. 3.3. Hardware implementation:Micro controller unit is used as the controller to maintain the DC motor speed at desired value, based on theinput from the temperature sensor, in order to control the temperature.The duty cycle of the PWM (Pulsewidth modulation) from microcontroller will determine the speed of the DC motor.Block diagram:Most digital logic circuits and processors need a +5 volt power supply. To use these parts we need tobuild a regulated +5 volt source. Usually, we start with an unregulated power supply ranging from 9volts to 15 volts DC. To make +5 volt power supply, we can use a LM7805 voltage regulator IC.Sometimes the input supply line may be noisy. To help smooth out this noise and get a better 5 voltoutput, capacitors can be added to the circuit.3.4. Software Implementation:For software implementation, we used AVR STUDIO for writing programs for microcontroller inEmbedded C language. We have imported the HEX file formed into EXTREME BURNER-AVR,and then programmed the micro controller through USB cable interface.Main steps involved in the program:  Initialization of the port A for analog input from sensor  Initialization of LCD module for displaying temperature  Initialization of the PWM module  Initialization of the TIMER 1The micro controller reads the input from the sensor with fixed amount of delays. Then, the analoginput is converted into 10 bit digital format by ADC unit inside the micro controller, which indicatesthe temperature. Depending on the temperature value, the PWM duty cycle will be adjusted by themicro controller.
  12. 12. PWM output waveforms for different temperature ranges:For Duty cycle 20% (25 to 35 deg) For Duty cycle 40% (35 to 45 deg)For duty cycle 60% (45 to 55 deg) For Duty cycle 80% (55 to 65 deg)
  13. 13. 4. Applications Temperature based fan speed controller is useful for cooling the processor in the laptops and personal computers “more efficiently”. Generally fan in laptop comes with only two or three possible speeds. So it results in more power consumption. The fan designed in this project, has different values of speed according to temperature change. This can be also used in small scale industries for cooling the electrical/mechanical equipment. The whole circuit except motor and fan can be manufactured on a single PCB, and it can be used for temperature based control operations. 5. CONCLUSION Here, we did the project with a fan speed with fixed PWM duty cycle for each 10 degree centigradeinterval from 25 to 65 degree Celsius. Care should be taken such that delays will not affect the open loopcontrol system performance. Temperature should not vary abruptly, otherwise it will cause degradation ofthe system performance.
  14. 14. APPENDIXPROGRAM CODE:#include <avr/io.h>#include <avr/delay.h>#include <avr/interrupt.h>#include <avr/signal.h>#include "lcd.h"void InitPWM(){ TCCR0|=(1<<WGM00)|(1<<WGM01)|(1<<COM01)|(1<<CS00); DDRB|=(1<<PB3); }void InitADC(){ ADMUX=(1<<REFS0);ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); }uint16_t ReadADC(uint8_t ch){ ch=ch&0b00000111; ADMUX|=ch; ADCSRA|=(1<<ADSC); while(!(ADCSRA & (1<<ADIF))); ADCSRA|=(1<<ADIF); return(ADC); }void SetPWMOutput(uint8_t duty){ OCR0=duty; }void Wait(){ uint8_t i; for(i=0;i<20;i++) _delay_loop_2(0); }int main(void){ uint16_t temp;uint8_t i=0;uint16_t j=0,k=0;
  15. 15. initPWM(); uint16_t adc_result; InitLCD(LS_BLINK|LS_ULINE); LCDClear();InitADC();while (1){ LCDClear(); LCDWriteString("FAN CONTROL"); LCDWriteStringXY(0,1,"TEM="); adc_result=ReadADC(0); temp=(adc_result/2); LCDWriteIntXY(4,1,temp,4); if (temp<=25) { SetPWMOutput(0); } if (temp>25&&temp<=35) { SetPWMOutput(50); } if (temp>35&&temp<45) { SetPWMOutput(100); } if (temp>45&&temp<=55) { SetPWMOutput(150); } if (temp>55&&temp<=65) { SetPWMOutput(200); } if (temp>=65) { SetPWMOutput(245); }_delay_loop_2(0);}}
  16. 16. LIST OF COMPONENTS: 1. LM35 (Temperature sensor) 2. ATMEGA32 micro-controller unit 3. Brushless variable speed DC motor [DR-6634-514] 4. N mosfet (BUK9575-100A) 5. Resistors (10k ohm,1k ohm) 6. Breadboard 7. Red LED 8. LM7805 voltage regulator IC 9. Diodes (1N914) 10. Capacitors (0.1uf )