MICROCONTROLLER BASED I.

R REMOTE CONTROL OPERATED ELECRICAL APPLIANCE CONROL SYSTEM

A PROJECT REPORT

Submitted by CHUDASMA RAVINDRA R. VAGADIYA RAJESH D. PATEL KIRAN

In fulfillment for the award of the degree of

BACHELOR OF ENGINEERING
in Electrical

Government Engineering College, Bhuj

Gujarat Technological University, Ahmedabad
April, 2012

Government Engineering College, Bhuj
Electrical Engineering Department 2012

CERTIFICATE
Date: This is to certify that the dissertation entitled “

MICROCONTROLLER BASED I.R REMOTE CONTROL OPERATED ELECRICAL APPLIANCE CONROL SYSTEM ” has been carried out by following students under my guidance in fulfillment of the degree of Bachelor of Engineering in ELECTRICAL (8th Semester) of Gujarat

Technological University, Ahmedabad during the academic year 2011-12.

Name of Students 1. Chudasma Ravindra R. 2. vagadiya rajesh D. 3.patel kiran

Enrollment No. 080150109008 080150109059 080150109037

Guide: Prof. K.A.SONAGRA

Prof. H. D. Mehta Head of the Department

ACKNOWLEDGEMENT

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It would be impossible to name each and every individual who had offered the support encouragement and ideas which made this Industry Defined Project a possible thing. We are greatly thankful to our external guide MR. DHARMENDRA PARAMAR of “automation engineers-ahmedabad” who has given us a tremendous effort for shaping our ideas and knowledge according to the industrial requirements. He has helped us on reaching each and every milestone of the project, he has encouraged us in every failure during the project, and he has increased our confidence with every success in the project. On the other hand we are greatly thankful to our internal guide Prof. K.A.SONAGRA who has made us aware with the requirement of the industry from this project, what we should actually try to learn that idea was planted by her and we had grown it up during this period with their helps. We are also thankful to our H.O.D. Prof. H. D. Mehta and other professors of Electrical department of our college.

[i]

ABSTRACT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In current days it is a major problem that we may loss our key in normal locking system, we may forgotten to lock the device, office, home, empire, company etc. which results in the insecurity for our valuable data, instruments, devices, money or any valuable things. Hence this is the advanced locking system which uses infrared rays and a setup password will be done which provide a high security option in place of manual locking system. As the current days the smart card locking or opening security system are also available but this is the advance electronics device which uses remote control, and in all the devices are provided their separate password which we can use for opening that device. When the user provide their password to receiver through remote control, and the receiver transfer the received signal to the microcontroller. And if the user password matches with remote controls password then operation will be successful otherwise a buzzer starts and make alert to the security guards. Hence this is very convenient for using. The infrared remote controlled password security system is an advance electronic based security system; hence in future this system may be become too much common at everywhere. This provides high sense of security in all the way. In coming days this infrared system is high sensing in nature. Through this system the size of present day’s manual locking system can be reduced.

[ii]

........ 10 [iii] .. Distribution of port pin 1….……………. Distribution of port pin 3.....………………………......1…………………..... 9 Table 2.2…………………….LIST OF TABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Table No..... Table Description Page No Table 2...

.…….LIST OF FIGURES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Figure No Figure Description Page No Figure 2.5…………… pin description of AT89S52 microcontroller………….....………..10………….6 Figure 2.Diode……………………………………………………....18 [iv] ..7…………….3………….………………..1…………… Basic block diagram ………………………………………………….11……………LED ……..…………….…….……15 Figure 2...13 Figure 2.10………….…...17 Figure 2..…….16 Figure 2..…………………………………………...Capacitor…………………………………………….….14 Figure 2..2…………… Power supply of circuit……………………………………………...….Relay……………………………………………………...8…………….11………….9…………… Transistor………………………………………………. Resister ……………………………………………….4 Figure 2.4…………… microcontroller (AT89S52)…………………………..8 Figure 2.2 Figure 2.6…………… Mct2e optocoupler…………………………………………......Schematic diagram of main circuit…………………….….TSOP…………………………………………….…...12 Figure 2. .………..….5 Figure 2..…….……..…….…….….13 Figure 2..

LIST OF SYMBOL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Symbol Symbol Description Capacitor Resistor Charge Page No 17 17 17 C R Q [v] .

2..2.....3.1 Basic block diagram………………………………………….2...….2...…………………………………………………….2...…. (vi) Chapter 1: Introduction 1.……...………18 2.………………………………………………...13 2....……………………………………………….14 2. (iii) List of Tables ………………………………………………………… (iv) List of symbol………………………………………………………..13 2.……….....2.......3 Component Details ……………………………………...2 Hardware implementation ………………………………...3 Problem and solutions……….3.……15 2.2 Infrared Remote Control Transmitter ....5 Application of the infrared remote control system……………….1 Power supply Circuit 2.2....……..5 Relay...17 2.3.TABLE OF CONTENTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Acknowledgement …………………………………………………… (i) Abstract ……………………………………………………………… (ii) List of Figures ……………………………………………………….3.4 2......3.….……..……4 2.3 Mct2eOpto-Coupler.1Microcontroller………….3.…... …………………..6 2.…..….5 2.……..3....… (v) Table of Contents …………………………………………………….20 [vi] .1 Introduction …………….2...….4 TSOP …………………………………………………....3.....1..…..………19 2..2 Distribution of power supply circuit:……………..…………………………………….1.…………………….…..9 Capacitor.………………………………………....….2 2.……..12 2...……….……………………………….4 2.3.7 Diode …………………………………………………. …………………….2..RC5 …………….……………………………………………..3.…….6 Transistor ………………………………………………......8 Resistor.6 2.….10 LED.2.4 Advantages..2.…….2.2....2.1 Schematic Diagram of Power Supply Circuit……….……….2 Schematic diagram of main circuit …….11 2.....1 Chapter 2: Literature Survey 2.…..…..2.20 2.16 2..

...2 simulation ………………………………………………………….1 programming ………………………………………………...22 4.…21 Chapter 4: Hardware and Software 4.……....34 References…………………………………………………………………………....36 [vii] ..Chapter 3: Industry Defined Problem Formulation 3.…29 4..32 Chapter 5: Conclusion………………….…..……………………………………………..…..35 Appendix…………………………………………………………………………......1 Problem/Project Identification …………………………………..3 Hardware photograph …………………………………………………......

[8] .

When a button is pressed in the remote. Here in our application we are using microcontroller AT89S52 which is Flash Programmable IC. power controlling system and also current through the loads can be controlled in this project. Page | 1 . 7805 three terminal voltage regulator is used for voltage regulation. The loads like electronic appliances. even they will be wasted up to some extent. compile and debug this program. Micro Flash programmer is used for burning the developed code on Kiel in to the microcontroller Chip. This project uses regulated 5V.1 Introduction In this competitive world human cannot spare his time to perform his daily activities manually without any fail. Also the manual operation is completely eliminated the industrial Appliances can be switched on using IR without actually going near the switch boards or regulators.CHAPTER: 1 INTRODUCTION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. IR remote acts as the transmitter in this project. With this. 500mA power supply. This IC is one of the versions of 8051. Bridge type full wave rectifier is used to rectify the ac output of secondary of 230/12V step down transformer. The most important thing he forgets to switch off the room lights wherever not required. the signal will be passed and received by the IR receiver TSOP Receiver. This project gives the best solution for electrical power wastage. The TV remote used in this project is IR remote. The KEIL cross compiler is used to edit. 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. We can control all loads at a time from one place (control room) without connecting any physical wire between loads and control room.

1 Basic block diagram Page | 2 .1 Basic block diagram Fig: 2.CHAPTER: 2 LITERATURE SURVEY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2.

The IR receiver module receives the data sent by remote handset. amplifies. demodulates and converts it to MCU compatible voltage format and outputs it on its data output pin. High power loads can also be connected by changing the Relay. the received signal is processed and sent to the relay driver circuit.The Microcontroller receives the infrared signals from the receiver and it decodes and finally a device will be switched on through relay. All the above process is control by the Microcontroller AT89S52. The range of the system is up to 10 meters. Page | 3 .• Block Diagram Description This project is an implementation of-remote reception on an AT89S52 microcontroller. The conditions of devices are stored in the EEPROM IC. And the devices will come to the original state after the power failure. The infrared receiver have 3 pins in which two pins are for +5v supply and ground while the third pin is for data output. The project report focuses on the system which is designed by using the Microcontroller AT89S52. The Microcontroller is used receive the Infrared signal from the Transmitter. The received code is decoded and sent to the microcontroller software developed using high level graphical programming language (C).

the system will be divided into two sections.2.1. Which is convert the 12 V supply to 5 V dc supply.2. The system will be powered via single phase with the required the 5V in section two obtained via a LM7805 5V voltage regulator.2.2. Single phase supply (230 V) is given a single phase transformer and at secondary side output is 12 V.1 Power supply Circuit 2. Power supply of circuit 2.2 Hardware implementation 2. This output of 12V is filtered by capacitor and given to the 7805 IC.2.2 Distribution of power supply circuit: To power the circuit. In this power circuit we use a one single phase transformer. Page | 4 .1 Schematic Diagram of Power Supply Circuit Fig:2.1. This 5V is again filtered by capacitor and given to VCC terminal of ATMEL 89S52 IC.

2.2.2 Schematic diagram of main circuit Fig:2.3 Schematic diagram of main circuit Page | 5 .

4 microcontroller (AT89S52)  Features • • • • • • Compatible with MCS-51® Products 8K Bytes of In-System Programmable (ISP) Flash Memory 4.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz 256 x 8-bit Internal RAM 32 Programmable I/O Lines • central processing unit .1 Micro controller-AT89S52 Fig:2.2.ranging from small and simple 4-bit processors to complex 32.2. Serial Peripheral Interface and Controller Area Network for system interconnect • • Full Duplex UART Serial Channel Include analog-to-digital converters Page | 6 .3 Component Details 2.0V to 5.or 64bit processors • Three 16-bit Timer/Counters • Other serial communications interfaces like I²C.3.2.

The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. 32 I/O lines. the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. Page | 7 . high-performance 8-bit microcontroller with 8K bytes of insystem programmable Flash memory. and clock circuitry. on-chip oscillator. the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash. three 16-bit timer/counters. Description The AT89S52 is a low-power. In addition. a full duplex serial port. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. By combining a versatile 8-bit CPU with insystem programmable Flash on a monolithic chip. 256 bytes of RAM.

Port 0 also receives the code Page | 8 . Pin Description Fig:2. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory.  GND Ground. each pin can sink inputs. As an output port.  Port 0 Port 0 is an 8-bit open drain bidirectional I/O port.5 pin description of AT89S52 microcontroller  VCC Supply voltage. the pins can be used as high impedance inputs. P0 has internal pull-ups. In this mode. When 1s are written to port 0 pins.

 Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. they are pulled high by the internal pull-ups and can be used as inputs. The Port 1 output buffers can sink/source inputs. Table:2. Page | 9 . When 1s are written to Port 2 pins. When 1s are written to Port 1 pins.  Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. as shown in the following table. As inputs. The Port 2 output buffers can sink/source inputs. The Port 3 output buffers can sink/source inputs. Port 3 also serves the functions of various special features of the AT89S52. they are pulled high by the internal pull-ups and can be used as inputs. External pull-ups are required during program verification. Port 2 pins that are externally being pulled low will source current because of the internal pull-ups. Port 3 pins that are externally being pulled low will source current because of the pull-up. As inputs. As inputs. they are pulled high by the internal pull-ups and can be used as inputs. Port 3 also receives some control signals for Flash programming and verification. Port 1 pins that are externally being pulled low will source current because of the internal pull-ups.bytes during Flash programming and outputs the code bytes during program verification. When 1s are written to Port 3 pins.1 Distribution of port pin 1  Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups.

 ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. EA will be internally latched on reset. except that two PSEN activations are skipped during each access to external data memory. Page | 10 . that if lock bit 1 is programmed. EA should be strapped to VCC for internal program executions. PSEN is activated twice each machine cycle. A high on this pin for two machine cycles while the oscillator is running resets the device. When the AT89S52 is executing code from external program memory.Table:2 Distribution of port pin 3  RST Reset input. however.  EA/VPP EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. This pin drives High for 96 oscillator periods after the Watchdog times out. This pin is also the program pulse input (PROG) During Flash programming in normal operation. ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes.  PSEN Program Store Enable (PSEN) is the read strobe to external program memory. Note. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming.

Page | 11 . 2. • Manufacturer Philips  Modulation • In RC5 Modulation the protocol uses bi-phase modulation of a 36 kHz IR carrier frequency.2 Infrared Remote Control Transmitter - RC5 Protocol This infrared remote control transmitter is based on Philips IC which is a RC5 protocol transmitter. Different timing for 38 KHz Should be adjusted in decoder part by monitoring first two bits.3.  XTAL2 Output from the inverting oscillator amplifier.  Protocol • The drawing below shows a typical pulse train of an RC-5 message.2. All bits are of equal length of 1. Unit is powered by onboard 3V battery Range of the remote transmitter is around 10 meters (30feet). with half of the bit time filled with a burst of the 36 kHz carrier and the other half being idle.778ms (64 cycles of 36 kHz).778ms in this protocol.  Features • RC5 Transmitter with LED indication · Power Save: 3V battery operation in sleep mode(Battery last around 2 years) · Six RC5 commands can be transmitted on each key press · RC5 address is set as 1 to prevent interference with TV remotes • • Carrier frequency of 36kHz or 38kHz Constant bit time of 1. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

• Cheap remote controls. Fig:2. Page | 12 .3.3 Mct2e Opto-Coupler The Mct2e Opto-coupler device consists of a gallium arsenide infrared emitting diode optically coupled to a monolithic silicon phototransistor detector. 2. for new key bit changes)  Philips RC5 Protocol • Philips is possibly the most used protocol by probably because of the wide availability of models.• • Transmitted Data on each key press Switch Address Command Toggle (If key kept pressed toggle bit remains same.6 Mct2e Opto-Coupler  Applications • • General Purpose Switching Circuits. Interfacing and coupling systems of different potentials and impedances.2.

2. Fig: 2. the epoxy package is designed as IR filter.7 TSOP  Features • • • Photo detector and preamplifier in one package.3. PIN diode and preamplifier are assembled on Lead frame.2. TSOP17.8 Relay Page | 13 .5 Relay Fig: 2. Internal filter for PCM frequency Output active low 2. supporting all major transmission codes.4 TSOP The TSOP17 – Series are miniaturized receivers for infrared Remote control systems.2. The demodulated output signal can directly be decoded by a Microprocessor.3. Is the standard IR remote control receiver Series. • Monitor and Detection Circuits.• I/O Interfacing.

The base is the lead responsible for activating the transistor.A relay is an electrically operated switch.6 Transistor Fig :2. Page | 14 . repeating the signal coming in from one circuit and re-transmitting it to another. Many relays use an electromagnet to operate a switching mechanism. Most Transistors used today are NPN because this is the easiest type to make from silicon. Relays find applications where it is necessary to control a circuit by a low-power signal. The leads are labeled base (B). collector(C) and emitter (E). or where several circuits must be controlled by one signal. 2. The first relays were used in long distance telegraph circuits. NPN or PNP. Solid-state relays control power circuits with no moving parts. with different circuits’ symbols. instead using a semiconductor device to perform switching. A type of relay that can handle the high power required to directly drive an electric motor is called a contactor. Transistors are manufactured in different shapes but they have three leads. but other operating principles are also used. the collector is negative lead.2. Relays found extensive use in telephone exchanges and early computers to perform logical operations. and the emitter is the negative lead.3.9 symbol of transistor  Types of Transistor There are two types of standard Transistors. the letters refer to the layers of semiconductor material used to make the Transistor.

7 Diode Fig:2. 2. collector regions made physical larger that the emitter because it has to dissipate much greater power. In most transistors. the most common type today.  Base It forms the middle section of the transistor. it is very thin as compared to either or collector and it very light doped. Page | 15 . In integrated circuits.10 Diode In electronics diode is two terminal electronic component which conducts electric current asymmetrically or unidirectional that is it conducts current more easily in one direction than in the opposite direction. The term usually refers to a semiconductor diode. Because of this difference is no possibility the transistor. Emitter It is more heavily doped than any of the other regions because its main function is to supply majority charge carriers to the base.3.  Collector Its main function is to collect majority charge carriers coming from the emitter and passing through the base.  Use • • • As a amplifier Oscillator.2.

A vacuum tube diode. IDENTIFYING RESISTORS Most axial resistors use a pattern of colored stripes to indicate resistance. or green. which was the first type of diode invented but is now little used.8 Resistor Fig:2. Cases are usually brown. the third is a multiplier.3.2. One can also use a multi meter or ohmmeter to test the values of a resistor. 2. is a vacuum tube with two electrodes: an anode and a cathode. though other colors are occasionally found such as dark red or dark grey.11 Resistor A Resistor is a two-terminal electrical or electronic component that opposes an electric current by producing a voltage drop between its terminals in accordance with Ohm's law: The electrical resistance is equal to the voltage drop across the resistor divided by the current through the resistor. Surfacemount ones are marked numerically. Resistors are used as part of electrical networks and electronic circuits. blue.which is a two terminal semiconductor P-N junction. Electronic Color Code Four-band identification is the most commonly used color coding scheme on all resistors. Each color corresponds to a Page | 16 . The scheme is simple: The first two numbers are the first two significant digits of the resistance value. It consists of four colored bands that are painted around the body of the resistor. and the fourth is the tolerance of the value.

certain number. a capacitance of one farad means that one coulomb of charge on each conductor causes a voltage of one volt across the device. neon feared or Pico faraday. The more the working voltage the more the size of capacitors. The value of capacitors and its working voltage printed on its body. shown in the chart below. or 10%. as the increase the frequency is has maximum resistor. 5%.C.9 Capacitor In the capacitors non-conducting material is put between low conducting plates. and the dielectric develops an electric field. In SI units. pulse and allowed is passed the constant D. defined as the ratio of charge ±Q on each conductor to the voltage V between them.C. 2. An ideal capacitor is wholly characterized by a constant capacitance C. Capacitor is used for the reserve the A. The capacitor is a reasonably general model for electric fields within electric circuits. The value of capacitors is measured in micro faraday. A capacitor is assumed to be self-contained and isolated.2. Page | 17 . Voltage Fig:2. The conductors thus hold equal and opposite charges on their facing surfaces.3. The tolerance for a 4-band resistor will be 1%. with no net electric charge and no influence from any external electric field.12 Capacitor A capacitor consists of two conductors separated by a non-conductive region called the dielectric medium though it may be a vacuum or a semiconductor depletion region chemically identical to the conductors.

6V DC and use approximately 30 milliamps of current. spot lighting or anything else LEDs need 3.Sometimes charge build-up affects the capacitor mechanically. Unlike other light sources. LEDs can be made waterproof. causing its capacitance to vary.2.13 LED LEDs are 'Light Emitting Diodes'.8 LED Fig:2. They can be used for street lights. a type of semiconductor. The positive power is applied to one side of the LED semiconductor through a lead Page | 18 . capacitance is defined in terms of incremental changes:  Uses • • • Coupling capacitor Bipolar capacitor Blocking capacitor 2. a power dissipation of 110 mill watts. sign lighting.3. They are the newest item in today's lighting technology. heat and severe cold. and put into a lighting package with 2 to 1000 LEDs. these LEDs can take a lot of punishment from vibration. In this case.

2. SOLUTION:If we want to operate system for that we must take remote control in direction of sensor then system should operate otherwise sensing is not done and system not operates. The other side of the semiconductor is attached to the top of the anvil that is the negative power lead. In this situation we should take radio frequency instead of IR which works more than 10m and avoid the problem of limitation of range and make the system more comfortable. If we want to open the door at more than 10m then IR is not working.3 Problem and solutions PROBLEM 1:This system can operate with another same frequency I. SOLUTION:That is the advanced locking system which uses infra red rays and a setup password will be done which provide a high security option in place of manual locking system. By the use of radio frequency we can overcome problem of line of site.R remote that anyone can interference with this system. and it protects the semiconductor from the elements.and a whisker. The plastic housing has three functions: it is designed to allow the most light to escape from the semiconductor. PROBLEM3:Direction of operating. It is the chemical makeup of the LED semiconductor that determines the color of the light that the LED produces. which is not so long. PROBLEM 2:Limitation range of the IR remote control. it focuses the light. Page | 19 . SOLUTION:Infrared have a range like 10m.

Page | 20 . Project coast is less. • Companies.4 Advantages • • • • • We can operate device at any place. • Cyber world.5 Application of the infrared remote control system • Now days the system is required in • Major industries. Not go to that switch.2. More easy to operate because it is user friendly 2. • Multiplexes. We can also save time at in farm. • Offices. We can save our lives because this is shock proof. industry etc. • Educational department and many more. • Empire. • Banks.

1 Problem/Project Identification • In the modern world the automatic systems are used on large scale. • Page | 21 . This is a simple approach to control the home appliances by IR remote control without making physical contact with AC/HEATER we can on /off the devices connected. In very big plants operator has to go here and there to make various machines on and off. It is a problem to handle various machines when less staff is present.CHAPTER: 3 INDUSTRY DEFINED PROBLEM FORMULATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3. This concept is also used in big plants.

codeisnotcorrect. rxdigitcounter.cmpflag.H> #define #define #define #define #define #define #define #define #define #define YES 1 NO 0 TRUE 1 FALSE 0 LOCK P2_4 BUZZER P2_3 OPEN 0 CLOSE 1 CLRSCR lcdcmd(0x01) CRSRBLINK lcdcmd(0x0F) bit firsthalf.CHAPTER: 4 SOFTWARE AND HARDWARE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4. sbit rw = P2^1. P2_2 = EN P2_4 used for LOCK P2_3 used for BUZZER after four digit password #include <REGX51."7412". sbit rs = P2^0. sbit en = P2^2.isfirstdigit.previoushighbyte. rxpassword[4].counter."3091"}. void Millisecdelay (unsigned int k). currenthighbyte.secondhalf."5489". Page | 22 . void lcddata(unsigned char y). userpassword[4][4] = {"3865". void lcdcmd(unsigned char x). currentlowbyte. unsigned int unsigned unsigned unsigned unsigned unsigned char char char char char buffer.sample.1 programming // // // // // // // Remotecontrol lock system IMPORTANT NOTE : press '0' (zero) P3_2 (INT 0) used for sensor input P0 used for LCD data P2_0 = RS. P2_1 = RW.memberno.previouslowbyte.next.

TR0 = 1.0x90. // start timer0 while(TF0 == 0){}// wait TR0 = 0.code unsigned char prompt[16] = "*ENTER PASSWORD*". code unsigned char initial_line_add[4] = {0x80. // desabling further interrupts during the current subroutine TR0 = 0.740 = 64796 = 0xFD1C TL0 = 0x1C.. code unsigned char welcome[4][16] = {"WELCOME Ravindra". // stop timer0 buffer = 0. TH0 = 0xF8. // start timer0 while(TF0 == 0){}// wait for 2. TH0 = 0xFD."}.5 remote pulses 2. TR0 = 0. // stop timer0 TF0 = 0.0xD0}. "WELCOME HOD sir. // wainting for 740 clks // 65536 . Page | 23 .". i++) { firsthalf = 0.0xC0. i<12. // stop timer0 // wainting for 2. "WELCOME Kiran. for(i=0. next = YES. TR0 = 1. void extinterrup0(void) interrupt 0 { unsigned char i.. secondhalf = 0.5 remote pulses TF0 = 0.. code unsigned char accessdenined[16] = "|ACCESS DENINED|". EX0 = 0.".1990 = 63546 = 0xF83A TL0 = 0x3A. "WELCOME Rajesh.5 * 796 = 1990 last 12 bits // 65536 .

// set cursor at line1 position 1 Millisecdelay(1). lcddata('*'). if(isfirstdigit == YES) { rxpassword[rxdigitcounter] = currentlowbyte. // stop timer TF0 = 0. } buffer = ~buffer. lcdcmd(0xC0). rxdigitcounter++. previoushighbyte = currenthighbyte. // firsthalfdata to firsthalf TL0 = 0x1C. TR0 = 1. currenthighbyte = buffer/256. secondhalf = P3_2.// secondhalfdata to secondhalf sample = secondhalf. } if( (previoushighbyte != currenthighbyte)||(previouslowbyte != currentlowbyte)) { if((rxdigitcounter > 0) && ( rxdigitcounter < 4)) { rxpassword[rxdigitcounter] = currentlowbyte. TH0 = 0xFD. previouslowbyte = currentlowbyte. previoushighbyte = currenthighbyte.// changing from active0 to active1 currentlowbyte = buffer%256. isfirstdigit = NO.firsthalf = P3_2. if(i < 11) buffer = buffer << 1. Page | 24 . // start timer0 while(TF0 == 0){} // wait TR0 = 0.

j. IE = 0x83. // display on cursor off //2 line & 5*7 matrix also valid for 4 line lcdcmd(0x06).k. P3_2 = 1. INT0 = 1. // enabling timer0 overflow interrupt and enabling INT0 1000 0011 TCON = 0x01. lcd Millisecdelay(1). Millisecdelay(1). // clear display screen Millisecdelay(1). Millisecdelay(1). for(j =0. } next interrupt void main (void) { unsigned char i. // increment cursor. lcdcmd(0x38). shift cursor ????? RESTART: CLRSCR. // enabling return. rxdigitcounter = 0. // desabledtimer to run and enabling edge trigger INT0 TMOD = 0x01. } if(rxdigitcounter == 4 && currentlowbyte == 0) { cmpflag = 1. // mode 1 16 bit counter for timer0 0000 0001 P2 = 0xFF. lcdcmd(0x0C). lcddata('*'). j++) Page | 25 . rxdigitcounter++. j<4. } } END: EX0 = 1.previouslowbyte = currentlowbyte.

// cmpflag is set in interrupt function //********************************** new block1 starts // setting initial line address lcdcmd(initial_line_add[0] ). 0. cmpflag = 0. } if(i==4) break. // not in the range 0 to 9 0. rxdigitcounter = 0. BUZZER = 1. previouslowbyte previoushighbyte currentlowbyte currenthighbyte = = = = 10. } //********************************** new block1 ends while(codeisnotcorrect) { if(cmpflag == 1) // cmpflag is set in interrupt subroutine { for(memberno =0. i++) { if( (userpassword[memberno][i]) != (rxpassword[i] + 48) ) break. Millisecdelay(1). memberno<4. //Buzzer off codeisnotcorrect = TRUE.rxpassword[j] = 0. k++) { lcddata(prompt[k]). i<4. Page | 26 . isfirstdigit = YES. // not in the range 0 to 9 10. LOCK = CLOSE.memberno++) { for(i = 0. Millisecdelay(1). // displaying prompt for(k =0. k<16.

Millisecdelay(1). } */ // Buzzer on Page | 27 . // displaying access denined for(k =0.} if(i == 4) { LOCK = OPEN. k<16. codeisnotcorrect = FALSE. } cmpflag = 0. Millisecdelay(1). k<16. while(next == NO) { . k++) { lcddata(welcome[memberno][k]). } } // if(i < 4) if(memberno == 4) { // setting initial line address lcdcmd(initial_line_add[0] ). // setting initial line address lcdcmd(initial_line_add[0] ). Millisecdelay(1). // displaying of welcome for(k =0. } } /* next = NO. Millisecdelay(1). } BUZZER = 0. k++) { lcddata(accessdenined[k]).

j. en = 0. j<100. i++) { for(j=0. // strobe the enable pin Millisecdelay(1). for(i=0. i<k. en = 0. return. // strobe the enable pin Millisecdelay(1). return. en = 1.Millisecdelay(10000). } void lcdcmd (unsigned char ldata) { P0 = ldata. } void lcddata (unsigned char ldata) { P0 = ldata. } void Millisecdelay (unsigned int k) { unsigned int i. // put data on the pins rs = 0.} } } Page | 28 . rw = 0. en = 1. j++) {. goto RESTART. // put the data on the pins rs = 1. rw = 0.

It allows for such software to be written either in assembly or C programming languages and for that software to be simulated on a computer before being loaded onto the microcontroller.2 Simulator KEIL Micro Vision is an integrated development environment used to create software to be run on embedded systems (like a microcontroller).4. The software used is c programming Page | 29 .

Under the “Output” tab of the resulting options dialog. Micro Vision was instructed to generate a HEX file upon program compilation. In the “Project Workspace” pane at the left. Add/Files. prompting the user to select a target device. simply start micro vision and select “Project”=>”New Project” from the pull–down menus. a filename and directory was chosen for the project.Options and set the tool options. Once the project has been named. Select Project . 7. 3. Select a directory and enter the name of the project file. To create our project in uVision3: 1. 2. Note that when the target device is selected from the Device Database all-special options are set automatically.Kiel μVision3 is an IDE (Integrated Development Environment) that helps write.New Project. and debug embedded programs. The chip being used is the “AT89S52. 6. Page | 30 .” which is listed under the heading “Atmel”. To create a new project. It is recommended that a new directory be created for each project. right–click on “Target 1” and select “Options for ‘Target 1’ ”. Default memory model settings are optimal for most applications. Create source files to add to the project 5. Groups. In the file dialog that appears. It encapsulates the following components: • • • • A project manager. A powerful debugger. Next. and add the Source files to the project. Select Project . select Source Group1. Select Project –Select Device and select a device from Device Database. A make facility. as several files will be generated. Tool configuration Editor. Select Project . Select Project . A HEX file is a standard file format for storing executable code that is to be loaded onto the Microcontroller.Rebuild all target files or Build target. the dialog shown in the figure below will appear.Targets. 4. Then click “OK”. ensure that both the “Create Executable” and “Create HEX File” options are checked. Compile. and Files.

a file must be added to the project that will contain the project code. At the left side of the debugger window. Double-click on the newly created file to open it in the editor. To start the debugger. they will be displayed in the output window at the bottom of the screen. there are several buttons that control code execution. most notably the elapsed time (circled in the figure below). a table is displayed containing several key parameters about the simulated microcontroller. and click “Add. select “Debug”=>”Start/Stop Debug Session” from the pull–down menus. right–click on the “Source Group 1” folder. and then click on the “Rebuild All Target Files” to compile the program as shown in the figure below. When the program has been successfully compiled. expand the “Target 1” heading. Just above that.Next.c”). it can be simulated using the integrated debugger in Kiel Micro Vision. To do this. If any errors or warnings occur during compilation. Page | 31 . and select “Add files…” Create a new blank file (the file name should end in “. The “Run” button will cause the program to run continuously until a breakpoint is reached. first save all source files by clicking on the “Save All” button. whereas the “Step Into” button will execute the next line of code and then pause (the current position in the program is indicated by a yellow arrow to the left of the code). select it. All errors and warnings will reference the line and column number in which they occur along with a description of the problem so that they can be easily located.” The new file should now appear in the “Project Workspace” pane under the “Source Group 1” folder. To compile the program.

3 Hardware of project Page | 32 .4.

• Relay driver circuit • Receiver circuit Page | 33 .

Page | 34 . etc.CHAPTER: 5 CONCLUSION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ • From this project we can understand that security becomes high rather than older security system.V remote. Due to use of RC5 protocol transmitter there is no interference with T. we also can handle this system from as far as 10 meters.There cannot be hack this system due to use of password system. so that it becomes easy to use and it becomes very comfortable then older security system. • It is useful where there is high security required like bank offices. due to this we can save time. Due to use of infrared rays there is no interference in transmission. For every user there are predefined passwords.

com/dd/docs/datashts/atmel/at89s52_ds.REFERENCES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WEBSITE: 1.wikipedia.pdf 2. http://en.org/wiki/Diode Page | 35 .keil.http://www.org/wiki/Transformer 3. http://en.wikipedia.

00 300.00 5.) 130.00 Page | 36 .00 12. 12. 9.00 1250. 16. 18. 3. 15. 13. 10.00 6.00 5. 7. Name of the components IC AT89S52 (with socket) MCT2E(with socket) 12 V DC single cont relay Resistor Transistor(BC547) Diode Capacitor(1000µf/35V) Capacitor(100µf/25V) Capacitor(10µf/16V) Capacitor(0.00 160.00 9.00 36.00 8.1µf) Crystal(11. 4.00 28. 19.00 10.00 2. 17. 8. 20. 14. 2.00 5.00 4.0592MHz) IC LM 7805 LED(3mm) Push Button Switch(Micro) Connector(10 pin Rely mate type) Adaptor 12V (DC) / 1 Amp PCB mounted 3 pin connector Microcontroller Card Relay card(Automation Engineers) Bridge Rectifier (1 Amp) Quantity 1 4 4 15 5 10 1 1 2 5 1 1 5 1 1 1 4 1 1 1 Price(Rs.APPENDIX-COSTING OF PROJECT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ No 1.00 4.00 1. 11.00 32. 6. 5.00 25.

24. 25. 28.00 35.00 3. 23.00 10.00 100.) Page | 37 .00 25. 26.21.00 120.00 80. 10 pin Rely mate connector Sensor TSOP 1738 TV remote with battery 5 m Flexible wire 2 pin plug Acrylic plate 3 mm (16" * 16") Pull up resistor Bulbs 1 1 1 1 1 1 1 4 10. 27.00 TOTAL: 2410 (Rs. 22.

Sign up to vote on this title
UsefulNot useful