You are on page 1of 34

www.final-yearprojects.co.cc | www.troubleshoot4free.

com/fyp/

Project Report On

INFRARED REMOTE CONTROL ON/OFF SWITCH


Submitted in partial fulfillment of the requirements for the award of the degree of Bachelor of Engineering in Electrical Engineering of Guwahati University Session 2010

by Anirban Lahon (07/169) Farooq Imran Khan(07/123) Indranuj Khound(07/143) Pallab Das(07/151) Under the guidance of DR. AROOP BARDALAI Assistant professor Department of Electrical Engineering Assam Engineering College

Department of Electrical & Instrumentation Engineering


Assam Engineering College, Jalukbari, Guwahati- 781013

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

ABSTRACT

This Project INFRARED REMOTE CONTROL ON/OFF SWITCH is used to switch on/off the Home Appliances by using a standard Remote control. The system is used to switch on/off upto six electrical devices. All the above processes are controlled by the 8 bit Microcontroller AT89C2051. The system works on Phillips RC5 format.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Certificate from the Supervisor

This is to certify that the project entitled INFRARED REMOTE CONTROL ON/OFF SWITCH has been carried out and presented by 1.Anirban Lahon (07/169) 2.Farooq Imran Khan(07/123) 3.Indranuj Khound(07/143) 4.Pallab Das(07/151) Students of B.E. 7th Semeste (Electrical Engineering), Assam Engineering College, under my supervision and guidance in a manner satisfactory to warrant its acceptance as prerequisite for the award of Bachelor of Engineering in Electrical Engineering of the Gauhati University. Further the report has not been submitted/ reproduced in any form for the award of any other degree/ diploma.

Date: Place: Guwahati

Dr. AROOP BARDALAI Deptt. Of Electrical & Instrumentaion Enginnering Assam Engineering College Guwahati-781013

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Certificate from the Head of the Department

This is to certify that the project report enitled INFRARED REMOTE CONTROL ON/OFF SWITCH has been submitted by the following BE 7th semester students. 1.Anirban Lahon (07/169) 2.Farooq Imran Khan(07/123) 3.Indranuj Khound(07/143) 4.Pallab Das(07/151) in the partial fulfillment of the requirements for the award of the degree of Bachelor of Engineering in Electrical Engineering of Gauhati University.

Date: Place: Guwahati

(Dr. Damodar Agarwal) Head of the Department, Deptt. Of Electrical& Instrumentaion Engineering Assam Engineering College Guwahati-781013

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Acknowledgement

We are thankful to Dr. Aroop Bardalai and our respected Head of the Department Dr. Damodar Agarwal who have given me a great opportunity and guided me to complete this project. We have taken help from the internet from where I got important data and information.I have also got hold of some information from a mazagine. I have enjoyed and learnt a lot during the completion of this project. We also envince thanks to Prof., Dr.Durlav Hazarika and Asstt.Prof., Dr. Dipankar Chanda for their kind assistance and guidance. We are also thankful to all Electrical Engineering Department personnel for their help and details explanation on various systems.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CONTENTS
1.

Introduction.

1-3

2.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CHAPTER 1

1.1 Introduction

The Project INFRA-RED REMOTE SWITCH USING MICROCONTROLLER is used to switch on/off the Home Appliances by using a standard Remote control. The system is used to switch on/off upto six electrical devices. All the above processes are controlled by the 8 bit Microcontroller AT89C2051. The Microcontroller receives the Infrared Signal from the receiver and it decodes and switch on/off the appropriate Device. The Range of the system is upto 10 meters. The system works on Phillips RC5 format. High power loads can also be connected by changing the Relay. The Microcontroller is used to receive the Infrared signal from the Transmitter, the received signal is processed by the Microcontroller and according to the signal the corresponding device is switched ON/OFF.

1.2 Objectives
1. To switch on/off the Home Appliances by using a standard Remote control. 2. The system is used to switch on/off upto six electrical devices. 3. The system should work within a range of 10 meters. 4. High power loads can also be connected by using relays of appropriate value.
5. The system should work on any remote supporting Phillips RC5 protocol.

1.3Background INFRARED REMOTE CONTROL


An infra-red remote control is a component of an electronics device, most commonly a television set, used for operating the device wirelessly from a short line-of-sight distance. Since infrared (IR) remote controls use light, they require line of sight to operate the destination device. The signal can, however, be reflected by mirrors, just like any other light source..Infrared receivers

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

also tend to have a more or less limited operating angle, which mainly depends on the optical characteristics of the phototransistor.

INFRA-RED
Infrared (IR) light is electromagnetic radiation with a wavelength between 0.7 and 300 micrometres, which equates to a frequency range between approximately 1 and 430 THz. IR wavelengths are longer than that of visible light, but shorter than that of terahertz radiation microwaves. Infrared imaging is used extensively for military and civilian purposes. Military applications include target acquisition, surveillance, night vision, homing and tracking. Nonmilitary uses include thermal efficiency analysis, remote temperature sensing, short-ranged wireless communication, spectroscopy, and weather forecasting. Infrared astronomy uses sensorequipped telescopes to penetrate dusty regions of space, such as molecular clouds; detect objects such as planets, and to view highly red-shifted objects from the early days of the universe.

RC-5 protocol
The RC-5 protocol was developed by Philips in the late 1980s as a semi-proprietary consumer IR (infrared) remote control communication protocol for consumer electronics. he advantage of the RC-5 protocol is that (when properly followed) any CD handset (for example) may be used to control any brand of CD player using the RC-5 protocol. The handset contains a keypad and a transmitter integrated circuit (IC) driving an IR LED. The command data is a Manchester coded bitstream modulating a 36 kHz carrier The IR signal from the transmitter is detected by a specialized IC with an integral photo-diode, and is amplified, filtered, and demodulated so that the receiving device can act upon the received command. RC-5 only provides a one-way link, with information traveling from the handset to the receiving unit.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

1.4 SIGNIFICANCE OF THE PROJECT


In modern electronics, electronic remote control system is a well known system. Infrared remote control kits available in the market are quite expensive and it some one wishes to assemble one, their ICs may not be easily available. More over for simple ON-OFF function such as controlling a lamp or fan we do not need very complex circuit. The IR remote control circuit using photodiode and phototransistor sensor suffer from major drawback of being affected by ambient light and a very low range. The advantage is that this circuit is absolutely free form ambient light interference.

1.5 ORGANISATION OF THE REPORT

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CHAPTER 2

CIRCUIT DESCRIPTION
Here is a versatile remote controlled appliance switch that can ON or OFF any appliance connected to it using a TV remote. IR remote sensor SM0038 is used for recieving the signal. Normally when no signal is falling on pin3,the output of it will be high.When a signal of 38 KHz from the TV remote falls on the pin3 its output goes low.This send a pulse at pin 6 of AT89C2051 which is the microcontroller.The high output is amplified to drive the relay .For the next signal the outputs of IC3(ULN2003) toggles state. Result, we get a relay toggling on each press on the remote.Any appliance connected to this circuit can be switched ON or OFF.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Fig1. Circuit Diagram

CHAPTER 3

CIRCUIT COMPONENETS 3.1 AT89C2051 (MICROCONTROLLER)

The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industrystandard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, a precision

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

analog comparator, on-chip oscillator and clock circuitry. In addition, the AT89C2051 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.

Fig2. Pin configuration of AT89C2051

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Fig3.Block diagram of AT89C2051

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

PIN DESCRIPTION
VCC GND Supply Voltage Ground

PORT 1 The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull-ups. P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision analog comparator. When 1s are written to Port 1 pins, they can be used as inputs. Port 1 also receives code data during Flash programming and verification. PORT 3 Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups. P3.6 is hard-wired as an input to the output of the on-chip comparator and is not accessible as a gen-eral-purpose I/O pin. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. RST Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for two machine cycles while the oscillator is running resets the device. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit . XTAL2 Output from the inverting oscillator amplifier.

OSCILLATOR CHARACTERISTICS The XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 5-1. Either a quartz crystal or ceramic resonator may be used.

Fig4. Oscillator connections

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.2 ULN2003 (HIGH VOLTAGE AND CURRENT TRANSISTOR ARRAY

The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It consists of seven NPN Darlington pairs that features high-voltage outputs with common-cathode clamp diode for switching inductive loads. The collector-current rating of a single Darlington pair is 500mA. The Darlington pairs may be paralleled for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers. The ULN2003 has a 2.7kW series base resistor for each Darlington pair for operation directly with TTL or 5V CMOS devices.

Fig5. Logic Diagram

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Fig6. Schematic (each Darlington pair)

Features
500mA rated collector current. Inputs compatible with various type of inputs. Relay driver application.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.3 74LS04 (Hex Inverting Gates) This device contains six independent gates each of which performs the logic INVERT function.

Fig7. Logic Diagram

FUNCTION TABLE

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.4 LM7805 (VOLTAGE REGULATOR)


Voltage Regulator (LM7805), having three legs, converts varying input voltage and produces a constant regulated output voltage. The LM7805 typically has the ability to drive current up to 1A The component has three legs: Input leg which can hold up to 36VDC Common leg (GND) and an output leg with the regulator's voltage. For maximum voltage regulation, adding a capacitor in parallel between the common leg and the output is usually recommended. This eliminates any high frequency AC voltage that could otherwise combine with the output voltage.

Fig8. LM7805 IC

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.5 CRYSTAL OSCILLATOR


Most microprocessors, and microcontrollers have two oscillator pins labeled XTAL1 and XTAL2 to connect to an external quartz crystal, RC network or even a Ceramic resonator. In this application the Crystal Oscillator produces a train of continuous square wave pulses whose frequency is controlled by the crystal which in turn regulates the instructions that controls the device. For example, the master clock and system timing.

3.6 SIP RESISTOR


SIP stands for Serial In-line Package. single in-line package (or SIP) is an electronic device package which has one row of connecting pins. It is not as popular as the dual in-line package, but has been used for packaging RAM chips and multiple resistors with a common pin. In this project, it has been used as a pull-up resistor for port1 of the microcontroller (AT89C2051).

Fig9. SIP resistor

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.7 TRANSFORMER(230/12V)

A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductorsthe transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual induction. If a load is connected to the secondary, an electric current will flow in the secondary winding and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (Vs) is in proportion to the primary voltage (Vp), and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary (Np) as follows:-

Fig9. A transformer

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.8 RELAY
A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal.

Fig10. A Relay

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

3.9 INFRA-RED SENSOR

Fig11. Internal circuit of an IR sensor The IR emitter outputs IR at D1. The output from sensor turns on sensor,Q1,when there is nothing blocking it. The sensor is connected as an inverting transistor, so its output is low when IR light is striking it. When something blocks IR beam, the output of Q1 goes high. The output is connected to a Schmitt trigger input which converts the slowly changing analog signal to a conventional TTL logic signal with fast rise and fall time. It also provides noise immunity so the output gate does not make multiple transisitions as the input signal slowly passes through the threshold.

Fig12. An SM0038 IR sensor

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CHAPTER 4

PROGRAMMING THE MICROCONTROLLER The AT89C2051 is shipped with the 2K bytes of on-chip PEROM code memory array in the erased state (i.e., contents = FFH) and ready to be programmed. The code memory array is programmed one byte at a time. Once the array is programmed, to re-program any non-blank byte, the entire memory array needs to be erased electrically. Internal Address Counter: The AT89C2051 contains an internal PEROM address counter which is always reset to 000H on the rising edge of RST and is advanced by applying a positive going pulse to pin XTAL1. To program the AT89C2051, the following sequence is recommended. 1. Power-up sequence: Apply power between VCC and GND pins. Set RST and XTAL1 to GND. 2. Set pin RST to H Set pin P3.2 to H 3.Apply the appropriate combination of H or L logic levels to pins P3.3, P3.4, P3.5, P3.7 to select one of the programming operation.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CHAPTER 5 SOURCE CODE(PROGRAM)

[ PROGRAM FOR REMOTE CONTROL ] INCLUDE reg_52.pdf INPUT EQU P3.2 ; Port3, Bit2 is used as input. The demodulated signal with active low level is connected to this pin OUTPUT EQU P1 OP1 OP2 OP3 OP4 OP5 OP6 EQU P1.2 EQU P1.3 EQU P1.4 EQU P1.5 EQU P1.6 EQU P1.7

DSEG ORG 20H

; this is internal data memory ; Bit addressable memory

FLAGS: DS CONTROL BIT NEW BIT

1 FLAGS.0 ; toggles with every new keystroke

FLAGS.1; Bit set when a new command has been received

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

COMMAND: DS SUBAD: DS TOGGLE: DS ANS: DS ADDR: STACK: DS CSEG 1 DS 1 1 1

; Received command byte ; Device subaddress ;Toggle every bit ; 1 ; Stack begins here

; Code begins here

[ PROCESSOR INTERRUPT AND RESET VECTORS]

ORG JMP

00H MAIN

; Reset

ORG JMP

0003H ; External Interrupt0 RECEIVE

[ Interrupt 0 routine]

RECEIVE: cpl p3.7 MOV 2,#255 DJNZ 2,$ ; Time Loop (3/4 bit time) ; Waste Time to sync second bit

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

MOV 2,#255 Djnz 2,$ Mov 2,#145 Djnz 2,$ clr mov a r6,#07h

; Time Loop (3/4 bit time) ; Waste Time to sync second bit ; Time Loop (3/4 bit time) ; Waste Time to sync second bit

pol1: mov rlc

c,Input a ; Waste time for next BIT

Mov 2,#255 Djnz 2,$ Mov 2,#255 Djnz 2,$ Mov 2,#255 Djnz 2,$ Mov 2,#114 Djnz 2,$ djnz r6,pol1

; Time Loop (3/4 bit time) ; Waste Time to sync second bit ; Time Loop (3/4 bit time) ; Waste Time to sync second bit ; Time Loop (3/4 bit time) ; Waste Time to sync second bit

MOV SUBAD,A

mov pol2: mov rlc

r6,#06h

c,Input a ; Waste time for next BIT

Mov 2,#255

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Djnz 2,$ Mov 2,#255 Djnz 2,$ Mov 2,#255 Djnz 2,$ Mov 2,#114 Djnz 2,$ djnz r6,pol2 ; Save Command at IRData memory ; Time Loop (3/4 bit time) ; Waste Time to sync second bit ; Time Loop (3/4 bit time) ; Waste Time to sync second bit ; Time Loop (3/4 bit time) ; Waste Time to sync second bit

Mov COMMAND,A

MOV A,SUBAD MOV ADDR,A ANL A,#0FH MOV SUBAD,A CJNE A,#03H,ZXC1 MOV A,COMMAND CPL A MOV COMMAND,A AJMP ASZ ZXC1: MOV A,SUBAD CJNE A,#00H,ANSS AJMP ASZ

ASZ: MOV A,ADDR

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

ANL A,#20H MOV TOGGLE,A CJNE A,ANS,ANSS AJMP WAR ANSS: JMP ANS1 WAR: ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! MOV A,COMMAND ;------------------------------------------MOV R0,A XRL A,#01H JNZ CH1 CPL OP1 AJMP GO CH1: MOV A,R0 XRL A,#02H JNZ CH2 CPL OP2 AJMP GO CH2: MOV A,R0 XRL A,#03H JNZ CH3 CPL OP3 AJMP GO ;Light 1 ; device 3 ;Light 1 ; device 2 ;Light 1 ; device 1

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CH3: MOV A,R0 XRL A,#04H JNZ CH4 CPL OP4 AJMP GO CH4: MOV A,R0 XRL A,#05H JNZ CH5 CPL OP5 AJMP GO CH5: MOV A,R0 XRL A,#06H JNZ CH6 CPL OP6 AJMP GO CH6: MOV A,R0 XRL A,#0CH JNZ go MOV OUTPUT,#0FFH AJMP GO GO: ;*********************************************************** MOV ANS,TOGGLE MOV A,ANS CPL ACC.5 ; all devices off ;Light 1 ; device 6 ;Light 1 ; device 5 ;Light 1 ; device 4

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

MOV ANS,A SETB NEW ; Set flag to indicate the new command

;################################################################ ANS1: RETI [ Main routine. Program execution starts here.] MAIN: MOV SP,#60H MOV OUTPUT,#0FFH SETB EX0 CLR IT0 SETB EA ;Switch off all devices ; Enable external Interrupt0 ; triggered by a high to low transition

MOV ANS,#00H

;clear temp toggle bit

CLR NEW LOO: JNB NEW,LOO CLR NEW AJMP LOO END

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

CHAPTER 6

WORKING OF THE CIRCUIT


The Infra-Red Remote control circuit described here used here for any simple ON-OFF function. The circuit is free from ambient light interference and works upto a range of 10 meters. The 38khz infra-red(IR) rays energized by a remote control are received a infrared receiver module SM0038 of the circuit. Pin1 is connected to ground, pin2 is connected to supply through a 47k resistor and the output is taken from pin3. The output is given to the pin6 of the microcontroller(AT89C2051) for processing. The IC ULN2003 amplifies the signal which drives the relay. The appliance connected to the relay does operate due to signal from the remote control. The 12V to the relay circuit and the 5V to the microcontroller circuit is provided by the rectifier circuit. This circuit consists of an IC LM7805 which constantly gives an output of 5V for an input in the range of (9-12V). It has a transformer which steps down the 220V to 12V and a bridge rectifier which converts the ac to dc.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

BIBLIOGRAPHY

1. Muhammad Ali Mazidi, Janice Gillispie Mazidi, Rolin d. Mckinlay, THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEMS
2. 3. 4. 5. 6.

www.8051projects.info www.wikipedia.org www.atmel.com www.datasheetcatalog.org www.electronics-tutorials.com

You might also like