You are on page 1of 53


Mini-Project work submitted By



(09BA1A0203) (09BA1A0214) (09BA1A0221) (09BA1A0223)


Assistant professor


Jawaharlal Nehru Institute of Technology

[Affiliated to JNTUH, Hyderabad, Approved by AICTE, New Delhi] mangalpally patelguda (V), Ibrahimpatnam (M), Ranga reddy -501 510 2012-13





Under the guidance of Ms.G.SIRISHA (Assistant Professor)

Jawaharlal Nehru Institute of Technology

[Affiliated to JNTUH, Hyderabad, Approved by AICTE, New Delhi] mangalpally patelguda (V), Ibrahimpatnam (M), Ranga reddy -501510 2012-13 2


Dissertation Submitted to the


In partial fulfillment of the requirements for the Award of the Degree of





Jawaharlal Nehru Institute of Technology

[Affiliated to JNTUH, Hyderabad, Approved by AICTE, New Delhi] mangalpally patelguda (V), Ibrahimpatnam (M), Ranga reddy -501510 2012-13


I would like to express my gratitude to all the people behind the screen who helped me to transform an idea into a real application. I would like to express my heart- felt gratitude to my parents without whom I would not have been privileged to achieve and fulfill my dreams. I am grateful to our principal, Dr. K. SRINIVAS RAO, who most ably run the institution and had the major hand in enabling me to do my project. I profoundly thank Mrs. J. KARUNA KUMARI, head of the department of Electrical and Electronics Engineering who has been an excellent guide and also great source of inspiration to my work. I would like to thank my internal guide Ms. G. SIRISHA, Asst. Prof, for her technical guidance, constant encouragement and support in carrying out my project at college. The satisfaction and euphoria that accompany the successful completion of the task would be great but in complete without the mention of the people who made it possible with their constant guidance and encouragement crowns all the efforts with success in this context, I would like thank all the other staff members, both teaching and non-teaching, who have extended their timely help and eased my task.


The main aim of this project is to control the speed of ceiling fan using TV remote. This project is not only limited to speed control of fan but can also be extended to domestic and industrial purposes as home appliances controlling using IR. The home/ industrial appliances can be switched on/off using IR without actually going near the switch boards or regulators.

IR remote acts as the transmitter in this project. When a button is pressed in the remote, the signal will be passed and received by the IR receiver (TSOP Receiver). This signal is sent to the microcontroller which decodes the signal and performs the corresponding action in accordance with the button pressed in the remote. For example, if number 5 is pressed in the remote, the fan will start. By pressing the CH+, CH- in remote, we can increase or decrease the speed of the fan. The other tasks will be performed in the similar fashion using IR remote.

NAME OF THE CHAPTER ABSTRACT LIST OF FIGURES ABBREVATIONS 1. INTRODUCTION 2. BLOCK DIAGRAM 2.1. power supply 2.2. Transformer 2.2.1. Basic principle 2.2.2. Induction law 2.3. Rectifier 2.3.1. Full-wave Rectifier 2.3.2. Bridge Rectifier 2.4. Filter 2.4.1. Capacitor Filter 2.5. Voltage Regulator 2.5.1 78XX 2.5.2.Features 2.6. Microcontroller 2.6.1. Introduction 2.6.2. Introduction To ATMEL Microcontroller 2.6.3. Pin configuration 2.7. TSOP 2.7.1. Features 2.7.2. Specification 2.8. opto coupler 2.9. MOC3021 (Opto isolators or TRIAC driver) ii PAGE NO. i ii iii 1 4 5 5 6 7 9 9 9 12 12 13 13 14 14 14 15 17 17 17 18 18 18

2.9.1. Introduction 2.9.2 Applications 2.10. TRIAC 2.10.1.TRIAC BT136-600D 2.10.2 Features and benefits 2.11. Single Phase Induction Motor Control Theory 2.11.1. Capacitor Start AC Induction Motor 2.11.2. PSC Starting Mechanism 2.12. LCD (Liquid Cristal Display) 2.12.1. Introduction 2.12.2. Features 2.13. CIRCUIT DIAGRAM

19 19 19 20 21 22 22 23 24 24 25 26

3.1. Introduction To Embedded C 4. CODING 5. CONCLUSION 5.1. Application and scope OUTPUT REFERENCES

27 28 38 38 39 41


SL.NO 1 2 3 NAME OF THE FIGURE Block diagram Power supply circuit An ideal step-down transformer showing magnetic flux in the core 4 5 6 7 8 9 10 11 12 13 For positive half cycle For negative half cycle Input and Output wave forms Internal Block Diagram Block Diagram Oscillator Connection. Pin Diagram TRIAC BT136-600D Total Power Dissipation Ceiling fan or single phase induction Motor 13 14 15 16 17 Capacitor Start AC Induction Motor PSC Starting Mechanism Ceiling fan winding Circuit diagram Output 22 23 23 24 26 39 6 10 10 11 13 15 16 17 20 21 PAGE.NO 4 5



IR TV A.C D.C mA Infra Red Television Alternating current Direct current Milli amperes



volts Liquid crystal display


Ground Transmitter Receiver Reset Atmel Electromotive Force



Linear Monolithic Central processing unit Random access memory


Read only memory


Electrically erasable and programmable read only memory Programmable read only memory Power factor Permanent Split capacitor


There are many methods for controlling Ceiling fan like Capacitor-stepped wall controls, Solid State speed controls, Transformer-based controls, computerized wall controls, pull chains, remote controls. Capacitor-stepped: Many manufacturers and retailers offer 3 or 4 speed wall controls that are hard-wired, that is they wire in place of a wall switch and directly regulate the current flow to the fan. The most common and universal wall controls use capacitors to set 3 (or 4) distinct speeds. Most capacitor type controls can only operate one fan per control, so multiple fans require multiple controls. Capacitor controls are commonly identified by having 3 or 4 distinct speeds, instead of infinitely variable speed selection. Transforme r-based controls: It is Similar to capacitor stepped controls, transformer-based controls offer 4 or 5 distinct fan speeds. They are compatible with most or all ceiling fan motors, and are quiet, although some produce an almost inaudible humming sound. They are most commonly found on industrial-type fans. They have the same advantages as capacitor-type controls, plus some are built to operate higher amounts of current and therefore control more than one fan. The disadvantage is that they usually mount on the surface of the wall rather than inside an outlet box, and therefore are ugly. Solid State speed: Some manufacturers and retailers also offer controls that, as opposed to having distinct separate speeds, offer an infinitely variable selection of speeds. These are called Solid State speed controls. Most ceiling fans sold currently use 16 pole spinner motors which are incompatible with solid state speed controls. Only fans with 18 pole motors (and other compatible designs) can be used with solid state controls. The advantage of solid state controls is the infinite selection of speeds, also solid state controls are often made to higher current ratings so that more than one fan can be operated by the same control. The disadvantage is that they are noisier. Pull chain: Most ceiling fans sold in recent years have a built in 3-speed pull chain for speed control. Some older fans have two speeds, or infinitely variable speed controls built into the fan. 1

However it is not uncommon to desire a means to control the fan from somewhere other than the fan body-- usually a wall switch. Here we will discuss a few options:

Remote control:
IR Remote control by which the control is very easy. These controls are handheld. We can use the remote for control of fan speed, we dont need any special remote for this the remote which we use for a TV is essential!!!



Fig 2 (a): block diagram

2.1. Power supply:

The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronic circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A D.C power supply which maintains the output voltage constant irrespective of A.C mains fluctuations or load variations is known as Regulated D.C Power Supply

Fig: 2.1(a) power supply circuit

2.2. Transformer:
A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled electrical conductors. A changing current in the first circuit (the primary) creates a changing magnetic field; in turn, this magnetic field induces a changing voltage in the second circuit (the secondary). By adding a load to the secondary circuit, one can make current flow in the transformer, thus transferring energy from one circuit to the other. The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP by a factor equal to the ratio of the number of turns of wire in their respective windings:

2.2.1 Basic principle

The transformer is based on two principles: firstly, that an electric current can produce a magnetic field (electromagnetism) and secondly that a changing magnetic field within a coil of wire induces a voltage across the ends of the coil (electromagnetic induction). By changing the current in the primary coil, it changes the strength of its magnetic field; since the changing magnetic field extends into the secondary coil, a voltage is induced across the secondary. A simplified transformer design is shown below. A current passing through the primary coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very high magnetic permeability, such as iron; this ensures that most of the magnetic field lines produced by the primary current are within the iron and pass through the secondary coil as well as the primary coil.

Fig: 2.1(b) An ideal step-down transformer showing magnetic flux in the core

2.2.2 Induction law

The voltage induced across the secondary coil may be calculated from Faraday's law of induction, which states that:

Where VS is the instantaneous voltage, N S is the number of turns in the secondary coil and equals the magnetic flux through one turn of the coil. If the turns of the coil are oriented perpendicular to the magnetic field lines, the flux is the product of the magnetic field strength B and the area A through which it cuts. The area is constant, being equal to the cross-sectional area of the transformer core, whereas the magnetic field varies with time according to the excitation of the primary. Since the same magnetic flux passes through both the primary and secondary coils in an ideal transformer, the instantaneous voltage across the primary winding equals

Taking the ratio of the two equations for VS and VP gives the basic equation for stepping up or stepping down the voltage

If the voltage is decreased (stepped down) (Vp > Vs), then the current is increased (stepped up) (Ip < Is) by the same factor. Transformers are efficient so this formula is a reasonable approximation. If the voltage is increased (stepped up) (VS > VP), then the current is decreased (stepped down) (IS < IP) by the same factor. Transformers are efficient so this formula is a reasonable approximation. The impedance in one circuit is transformed by the square of the turns ratio. For example, if an impedance ZS is attached across the terminals of the secondary coil, it appears to the primary circuit to have an impedance of 7

This relationship is reciprocal, so that the impedance ZP of the primary circuit appears to the secondary to be

Detailed operation
The simplified description above neglects several practical factors, in particular the primary current required to establish a magnetic field in the core, and the contribution to the field due to current in the secondary circuit. Models of an ideal transformer typically assume a core of negligible reluctance with two windings of zero resistance. When a voltage is applied to the primary winding, a small current flows, driving flux around the magnetic circuit of the core. The current required to create the flux is termed the magnetizing current; since the ideal core has been assumed to have near-zero reluctance, the magnetizing current is negligible, although still required to create the magnetic field. The changing magnetic field induces an electromotive force (EMF) across each winding. Since the ideal windings have no impedance, they have no associated voltage drop, and so the voltages VP and V S measured at the terminals of the transformer, are equal to the corresponding EMFs. The primary EMF, acting as it does in opposition to the primary voltage, is sometimes termed the "back EMF". This is due to Lenz's law which states that the induction of EMF would always be such that it will oppose development of any such change in magnetic field.

A circuit which is used to convert A.C to D.C is known as RECTIFIER. The process of conversion A.C to D.C is called rectification

TYPES OF RECTIFIERS: Half wave Rectifier Full wave rectifier 1. Centre tap full wave rectifier. 2. Bridge type full bridge rectifier.

2.3.1. full-wave Rectifier: From the comparison we came to know that full wave bridge rectifier have more advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier circuit. 2.3.2. Bridge Rectifier: A diode bridge or bridge rectifier is an arrangement of four diodes in a bridge configuration that provides the same polarity of output voltage for any polarity of input voltage. When used in its most common application, for conversion of alternating current (AC) input into direct current (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full- wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a center-tapped transformer design, but has two diode drops rather than one, thus exhibiting reduced efficiency over a center-tapped design for the sa me o utp ut vo lta ge.

Basic Operation
When the input connected at the left corner of the diamond is positive with respect to the one connected at the right hand corner, current flows to the right along the upper colored path to the output, and returns to the input supply via the lower one.

Fig: 2.3(a) For positive half cycle

When the right hand corner is positive relative to the left hand corner, current flows along the upper colored path and returns to the supply via the lower colored path.

Fig: 2.3(b) For negative half cycle


In each case, the upper right output remains positive with respect to the lower right one. Since this is true whether the input is AC or DC, this circuit not only produces DC power when supplied with AC power: it also can provide what is sometimes called "reverse polarity protection". That is, it permits normal functioning when batteries are installed backwards or DC input-power supply wiring "has its wires crossed" (and protects the circuitry it powers against damage that might occur without this circuit in place). Prior to availability of integrated electronics, such a bridge rectifier was always constructed from discrete components. Since about 1950, a single fourterminal component containing the four diodes connected in the bridge configuration became a standard commercial component and is now available with various voltage and current ratings.

Fig: 2.3 (c) Input and Output wave forms


2.4. Filter:
A Filter is a device which removes the A.C component of rectifier output but allows the D.C component to reach the load

2.4.1. Capacitor Filter:

We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that of full- wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not acceptable for most of the applications. Ripples can be removed by one of the following methods of filtering. (a) A capacitor, in parallel to the load, provides an easier by pass for the ripples voltage though it due to low impedance. At ripple frequency and leave the appears the load. (b) An inductor, in series with the load, prevents the passage of the ripple current (due to high impedance at ripple frequency) while allowing the D.C (due to low resistance to D.C) (c) Various combinations of capacitor and inductor, such as L-section filter section filter, multiple section filter etc. which make use of both the properties mentioned in (a) and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and another with full wave rectifier.

Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4 RMS value).


2.5. voltage Regulator:

A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level.

Fig: 2.5 (a) Internal Block Diagram Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages. The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.

2.5.1 78XX:
The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The LM78XX offer several fixed output voltages making them useful in wide range of applications. When used as a zener diode/resistor combination replacement, the LM78XX usually results in an effective output impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is available in the TO-252, TO-220 & TO-263packages. 13

2.5.2. Features:
Output Current of 1.5A Output Voltage Tolerance of 5% Internal thermal overload protection Internal Short-Circuit Limited No External Component Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V Offer in plastic TO-252, TO-220 & TO-263 Direct Replacement for LM78XX

2.6. Microcontroller: 2.6.1 Introduction:

A Micro controller consists of a powerful CPU tightly coupled with memory RAM, ROM or EPROM), various I/O features such as Serial ports, Parallel Ports, Timer/Counters, Interrupt Controller, Data Acquisition interfaces-Analog to Digital Converter (ADC), Digital to Analog Converter (ADC), everything integrated onto a single Silicon Chip. It does not mean that any micro controller should have all the above said features on chip, Depending on the need and area of application for which it is designed, The ON-CHIP features present in it may or may not include all the individual section said above. Any microcomputer system requires memory to store a sequence of instructions making up a program, parallel port or serial port for communicating with an external system, timer / counter for control purposes like generating time delays, Baud rate for the serial port, apart from the controlling unit called the Central Processing Unit.


2.6.2. Introduction To ATMEL Microcontroller

Block Diagram :











PO P2 P1 P3 Fig:2.6 (a) Block Diagram




Fig: 2.6 (b) Oscillator Connection. The AT89S52 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five vector two-level interrupt architecture, a full duplex serial port, and on-chip oscillator and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.


2.6.3. PIN Configuration:

Fig 2.6(c) Pin Diagram 2.7. TSOP

The TSOP17 series are miniaturized receivers for infrared remote control systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter. The demodulated output signal can directly be decoded by a microprocessor. TSOP17 is the standard IR remote control receiver series, supporting all major transmission codes.

Photo detector and preamplifier in one package Internal filter for PCM frequency Improved shielding against electrical field disturbance TTL and CMOS compatibility Output active low Low power consumption High immunity against ambient light Continuous data transmission possible(up to 2400 bps)


2.7.2. Specifications:
Supply Voltage: 0.3...6.0 V. Supply Current: 5 mA. Output Voltage: 0.3...6.0 V. Output Current: 5 mA. Storage Temperature Range: 25...+85 C Operating Temperature Range: 25...+85C

2.8. opto-coupler:
An Opto-coupler is used to transmit either analog or digital information from one voltage potential to another while maintaining isolation of potentials. It is used for low voltages. The output of the Opto-coupler is used to trigger the Monostable Multivibrator.

2.9. MOC3021 (Opto isolators or TRIAC driver) : 2.9.1. introduction:

The MOC3020 Series consists of gallium arsenide infrared emitting diodes An Opto isolator is used to transmit either analog or digital information from one voltage potential to another while maintaining isolation of the potentials. Its operating voltage is higher than that of an Opto coupler. The output of the Opto isolator is used to drive the TRIAC Optically coupled to a silicon bilateral switch. This opto isolator should not be used to drive a load directly. It is intended to be a trigger device only


Recommended for 115/240 Vac(rms) Solenoid/Valve Controls Static AC Power Switch Lamp Ballasts Solid State Relays Interfacing Microprocessors to 115 Vac Peripherals Incandescent Lamp Dimmers Motor Controls

2.10. TRIAC :
TRIAC, from Triode for Alternating Current, is a generalized trade name for an electronic component that can conduct current in either direction when it is triggered (turned on), and is formally called a bidirectional triode thyristor or bilateral triode thyristor. TRIACs belong to the thyristor family and are closely related to Siliconcontrolled rectifiers (SCR). However, unlike SCRs, which are unidirectional devices (i.e. can conduct current only in one direction). TRIACs are bidirectional and so current can flow through them in either direction. Another difference from SCRs is that TRIACs can be triggered by either a positive or a negative current applied to its gate electrode, whereas SCRs can be triggered only by currents going into the gate. In order to create a triggering current, a positive or negative voltage has to be applied to the gate with respect to the A1 terminal (otherwise known as MT1). Once triggered, the device continues to conduct until the current drops below a certain threshold, called the holding current.


2.10.1 TRIAC BT136-600D:

Planar passivated very sensitive gate four quadrant triac in a SOT78 plastic package intended for use in general purpose bidirectional switching and phase control applications, where high sensitivity is required in all four quadrants. This very sensitive gate "series D" triac is intended to be interfaced directly to microcontrollers, logic integrated circuits and other low power gate trigger circuits. A Triac changes its state when its gate receives a current pulse. It is a Thyristor with a firing angle of nearly 45 0 The variations in the firing angle affect the voltage and thus the speed of the fan is varied.

Fig 2.10.1: TRIAC BT136-600D


2.10.2 Features and benefits

Direct triggering from low power drivers and logic ICs High blocking voltage capability Low holding current for low current loads and lowest EMI at commutation Planar passivated for voltage ruggedness and reliability Triggering in all four quadrants Very sensitive gate.

Fig 2.10.2 (a) Total Power Dissipation


2.11. Single Phase Induction Motor Control Theory:

Fig 2.11: ceiling fan or single phase induction motor

2.11.1. Capacitor Start AC Induction Motor: Single-phase induction motors are the most used. These motors have only one stator winding, operate with a single-phase power supply, and are also squirrel cage. Because of the single phase, the motor is not self- started when connected to a power supply. The necessary torque is not generated therefore causing the motor to only vibrate and not rotate. To provide the starting torque most single-phase motors have a main and auxiliary winding, both in quadrature to help generate the phase-shifted magnetic field.



2.11.1 (a) Capacitor Start AC Induction Motor

The auxiliary winding current from the main winding is phase-shifted. Connecting a capacitor in series with the auxiliary winding causes the motor to start rotating. Using a centrifugal switch disconnects the capacitor and the auxiliary winding at 75% of the motor nominal speed. This topology is used if high torque is required.

2.11.2. PSC Starting Mechanism: In most fan motors, the capacitor and the auxiliary winding remain connected. This configuration is called permanent split capacitor (PSC) AC induction motor. No centrifugal switch is used and is considered to be the most reliable single-phase motors. At rated load, they can be designed for optimum efficiency and high power factor (PF).

Fig: 2.11.2 (a). PSC Starting Mechanism 23

Motors commonly used in ceiling fans are single-phase induction motors with a PSC starting mechanism. Most of them have three different speeds that are mechanically selected by pulling a chain. Every time the chain is pulled, the motor circuit changes to a predefined coil winding that cause the speed to vary. It is recommended that the fan be set at maximum speed. Considering that the load of the motor is proportional to the consumed current it is not the same range of speed variation with the load then without it. The range of speed variation needs to be recalculated.

2.11.2.(b) Fig: ceiling fan winding

2.12. LCD (Liquid Cristal Display): 2.12.1. Introduction:

A liquid crystal display (LCD) is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a column of liquid crystal molecules suspended between two transparent electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to each other. Without the liquid crystals between them, light passing through one would be blocked by the other. The liquid crystal twists the polarization of light entering one filter to allow it to pass through the other.


A program must interact with the outside world using input and output devices that communicate directly with a human being. One of the most common devices attached to an controller is an LCD display. Some of the most common LCDs connected to the controllers are 16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters per line by 2 lines and 20 characters per line by 2 lines, respectively.

Many microcontroller devices use 'smart LCD' displays to output visual information. LCD displays designed around LCD NT-C1611 module, are

inexpensive, easy to use, and it is even possible to produce a readout using the 5X7 dots plus cursor of the display. They have a standard ASCII set of characters and mathematical symbols. For an 8-bit data bus, the display requires a +5V supply plus 10 I/O lines (RS RW D7 D6 D5 D4 D3 D2 D1 D0). For a 4-bit data bus it only

requires the supply lines plus 6 extra lines (RS RW D7 D6 D5 D4). When the LCD display is not enabled, data lines are tri-state and they do not interfere with the operation of the microcontroller.

2.12.2. Features:
Interface with either 4-bit or 8-bit microprocessor. Display data RAM 80x8 bits (80 characters). Character generator ROM 160 different 5 7 dot matrix character patterns. Character generator RAM 8 different user programmed 5 7 dot matrix patterns. Display data RAM and character generator RAM may be accessed by the microprocessor. Numerous instructions Clear Display, Cursor Home, Display ON/OFF, Cursor ON/OFF, blink Character, Cursor Shift, Display Shift. Built- in reset circuit is triggered Built- in oscillator. at power ON. available. Line


Shapes and S


Fig :circuit diagram


3.1.Introduction To Embedded C:
Ex: Hitec c, Keil c KEIL Software makes industrial-strength software development tools and C compilers that help software developers write compact, efficient embedded processor code. For over two decades Keil Software has delivered the industry's most reliable embedded software development tools and compilers for writing efficient and compact code to run on the most popular embedded processors. Used by tens of thousands of customers including General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH's reliable development tools and C compilers, combined with world-class support have helped serious embedded software programmers to create hundreds of breakthrough new solutions. Whichever embedded processor family you are targeting with your software, whether it is the ATMEL, PICC or 8051 series, Keil tools and C compilers can help you write better code and bring it to market faster. KEIL PICC is a high-performance C compiler for the Microchip PIC micro 10/12/14/16/17 series of micro controllers. Keil PICC is an industrial-strength ANSI C compiler - not a subset implementation like some other PIC compilers. The PICC compiler implements full ISO/ANSI C, with the exception of recursion. All data types are supported including 24 and 32-bit IEEE standard floating point. Keil PICC makes full use of specific PIC features and using an intelligent optimizer, can generate high-quality code easily rivaling hand-written assembler. Automatic handling of page and bank selection frees the programmer from the trivial details of assembler code.


#include <REG51.H>

sbit fan = P1^5; sbit led= P3^7; bit fanon,l1,l2,l3,l4,l5,l6,power,powercount,l1t,l2t,l3t,l4t,l5t,l6t; unsigned char speed,newkey,id[4]; unsigned char key1,count=0,ledon,zc=0,jj,timecount; unsigned int kkk,rise,x,z,ont,offt; void ir_build_bytes(void) interrupt 0 { if(ledon==0) { TR0=0; count=count++; x=TL0; z=TH0; z=z<<8; z=z|x; rise = z; if(count==2) kkk=rise; if((count==2)&&((kkk<13000)||(kkk>15000))) { count=0; } if((kkk>13000)&&(kkk<15000)&&(count>2)) { if((rise>1800)&&(rise<2500)) key1=key1|0x80; else 28

if((rise>750)&&(rise<1300)); else { led=0; count=0; } if(count==34) { id[3]=key1; newkey=1; count=0; kkk=0; led=0; } if(count<34) key1=key1>>1; } else { if(count>2) count=0; } if(count!=0) { TH0=0; TL0=0; TR0=1; } } } void timer0(void) interrupt 1 TR0=0; count=0; TH0=0; 29

TL0=0; led=0; ledon=0; } void timer1(void) interrupt 3 { TR1=0; fan=~fan; timecount=timecount+1; if(timecount<4) { if(fan) { TH1=(offt&0xff00)>>8; TL1=(offt&0x00ff); } else { TH1=(ont&0xff00)>>8; TL1=(ont&0x00ff); } TR1=1; } //else //led=0; } void pulse (void) interrupt 2 { timecount=0; TR1=0; fan=1; if(count==0) { switch(speed) 30

{ case 9: { ont=0xe69b; offt=0xf447; break; } case 8: { ont=0xea83; offt=0xf05f; break; } case 7: { ont=0xec77; offt=0xee6b; break; } case 6: { ont=0xee6b; offt=0xec77; break; } case 5: { ont=0xf05f; offt=0xea83; break; } case 4: { ont=0xf253; 31

offt=0xe88f; break; } case 3: { ont=0xf447; offt=0xe69b; break; }

case 2: { ont=0xf63b; offt=0xe4a7; break; } case 1: { ont=0xf82f; offt=0xe2b3; break; } } } TH1=(offt&0xff00)>>8; TL1=offt&0x00ff; TR1=1; } void main() { power=0; fanon=0; fan=1; led=0; 32

speed=5; key1=0; TMOD=0X11; l1=l2=l4=l5=1; l3=1; l6=0; ledon=0; powercount=0; EA=1; EX0=1; ET0=1; ET1=1; PX0=1; PT0=1; IT0=1; IT1=1; count=0; newkey=0; // while(1) { while(!newkey); newkey=0; switch(id[3]) { case 87: { fanon=~fanon; l6=fanon; if(fanon) { EX1=1; zc=0; } 33 //5

else { fan=1; EX1=0; TR1=0; } id[3]=0; led=1; ledon=1; break; } case 11: { if(speed<9) { speed=speed+1; ledon=1; led=1; zc=0; } else speed=9; id[3]=0; break; } //up

case 15: { if(speed>1) { led=1;


speed=speed-1; ledon=1; zc=0; 34

} else speed=1; id[3]=0; break; } case 7: //power { power=~power; if((power)||(powercount==0)) { EX1=0; TR1=0; fan=1; fanon=0; l1t=l1; l2t=l2; l3t=l3; l4t=l4; l5t=l5; l6t=l6; l1=l2=l4=l5=1; l3=1; l6=0; zc=0; } else { fanon=l6t; if(fanon) { zc=0; EX1=1; } 35

} id[3]=0; led=1; ledon=1; break; } default: break; } if(ledon) { count=0; //newchange TH0=0; TL0=0; TR0=1; /*if(fanon==1) { ledon=0; }*/ } } }




5. Conclusion:
The speed of fan & intensity of light can be controlled in various levels from off position to maximum intensity possible. So it finds its use as night lamp by keeping the intensity of lamp in low level. The circuit also finds its use for switching ON and OFF any electronic circuitry. Our normal T.V. remote can be used for this purpose. Remote operating distance up to 30 ft / 10 mts. Provision for switching ON/OFF all lights & Fan instantly. Spark less switching increases switches life. Prevents us from risk of electrical shock and short circuit. No alteration required while installing our unit.

5.1. Application and scope:

This project is not only limited to speed control of fan but can also be extended to domestic and industrial purposes as home appliances controlling using IR. The home/ industrial appliances can be switched on/off and can be controlled using IR remote without actually going near the switch boards or regulators.



IMAGE 1: speed control of ceiling fan using tv remote kit,load in OFF condition

IMAGE 2: kit in ON condition with minimum speed


IMAGE 3: kit in ON condition with medium speed

IMAGE 4: kit in ON condition with maximum speed


The following are the references made during the development of this project work.

1. Electrical and Electronic Measurements & Measurements By A.K.SAWHNEY 2. Principles of Electronics By V.K. MEHTA 3. Principles of Electronics By B.V. NARAYANA RAO 4. Basic Electronics By GROB 5. Communication Systems By Simon Haykin 6. Electronic and Radio Engineering By Kennedy 7. Instrumentation Devices and Systems By Rangan and Sarma

(1) Electronic Design. (2) Electronics for you. (3) Electronics Text. (4) Practical Electronics.

1. 2. 3. 4. 5.