Vous êtes sur la page 1sur 66

INFRA-RED BEAM BANK SECURITY

A MINI PROJECT REPORT Submitted to the Faculty of Engineering of

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, KAKINADA.

In partial fulfillment of the requirements for the award of degree of

BACHELOR OF TECHNOLOGY
In

ELECTRONICS & COMMUNICATION ENGINEERING


SUBMITTED BY D.JITENDRA(08R81A0491) KUMAR(08R81A04C7) N.S.S.S.C.RAJA SEKHAR(09R85A0408) G.NAGARJUNA(08R81A04A6) UNDER THE ESTEEMED GUIDANCE OF V.V.SIVA

L.SUNEEL

B.TECH.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING SRI SUNFLOWER COLLEGE OF ENGINEERING &TECHNOLOGY
(Approved by AICTE, Affiliated to JNTU K)

LANKAPALLI-521131.

SRI SUNFLOWER COLLEGE OF ENGINEERING


&TECHNOLOGY LANKAPALLI(CHALLAPALLI)

Department of Electronics & Communication Engineering

CERTIFICATE
This is to certify that the project title INFRA RED BEAM BANK SECURITY is a bonafied record of work done jointly by
D.JITENDRA V.V.SIVA KUMAR N.S.S.S.C.RAJA SEKHAR G.NAGARJUNA (08R81A0491) (08R81A04C7) (09R85A0408) (08R81A04A6)

Under my guidance and supervision and is submitted in partial fulfillment of the requirements for the award of the degree of Bachelor of Technology in Electronics & Communication Engineering by Jawaharlal Nehru Technology University during the year 2011-12.
2

ASOC.PROF.Y.R.K.PARAMA HAMSA
B.TECH.

M.TECH.

ASST.PROF.L.SUNEEL

Head of the Department, E.C.E Guide, E.C.E

Project

ACKNOWLEDGEMENT

First and foremost we sincerely salute our esteemed institution SRI SUNFLOWER COLLEGE OF ENGINEERING AND TECHNOLOGY for giving this golden opportunity for fulfilling our warm dreams of becoming engineers. We here by express our sincere gratitude to our principal Dr.G.V.Raju, who has rendered us his constant encouragement and valuable suggestions in making our project. We are also thankful to Mr.Y.R.K.Paramahamsa, M.Tech Head of Electronics and Communication Dept. for his constant encouragement and valuable support throughout the course of our project. We are glad to express our deep sense of gratitude to Mr.L.SUNEEL, B.Tech, and our guide for his guidance and co -operation in completing this project. We thank one and all who have rendered help to us in the completion of this work.

Project Associates.
D.JITENDRA (08R81A0491) V.V.SIVA KUMAR (08R81A04C7) N.S.S.S.C.RAJA SEKHAR (09R85A0408)

G.NAGARJUNA (08R81A04A6)

ABSTRACT
INFRARED BEAM BANK SECURITY
Infrared radiation is electromagnetic radiation of a wavelength longer than that of visible light, but shorter than that of radio waves. The name means "below red" red being the color of visible light with the longest wavelength. Infrared radiation has wavelengths between about 750 nm and 1 mm, spanning three orders of magnitude. The uses of infrared include military, such as: target acquisition, surveillance, homing and tracking and non-military, such as thermal efficiency analysis, remote temperature sensing, short-ranged wireless communication, spectroscopy, and weather forecasting. Infrared astronomy uses sensor-equipped telescopes to penetrate dusty regions of space, such as molecular clouds; detect cool objects such as planets, and to view highly red-shifted objects from the early days of the universe.

The goal of this project is to build an Infrared security system for access control of a door, window or lockers in banks and theyre by providing threshold crossing alert. A retro-reflective photoelectric beam sensor built into the emitter detects when the passing of a person or the presence of an object in the path of the infrared beam breaks the infrared beam. A buzzer is used to alert that a security breech has occurred or that an object has entered or passed through the infrared beam.

Module: Embedded Micro controller IR Unit LCD Buzzer

Language:
Embedded c

INDEX

Chapter.No
1. 2. 3. 4. 5. 6. 7.

Topic Introduction Block Diagram Block Diagram Description Circuit Diagram Circuit Diagram Description AT89S52 Micro Controller Power Supply

Page Number 1 2 3 4 5 6

16
8.

IR PAIR

23
9.

Relays (Liquid Crystal Display)

28 35 44 46 48 49 54 55

10. LCD 11. Keil 12. IR

Software

Advantages & Disadvantages Chart Code

13. Flow

14. Source

15. Conclusion 16. Future

Scope

17. Bibliography

56

List of figures

FIGURE No.
1 2 3

FIGURE DESCRIPTION

PAGE NUMBER 2
4

Block diagram
Circuit Diagram

Internal Architecture 4 5 6 7 8 9 10 21 11 22 Voltage Regulator internal block diagram Pin diagram Oscillator Connections Power supply block diagram Power supply Circuit diagram An ideal step-down transformer Ideal power equation Voltage Regulator

8 9 13 16 17 18 20

12 13 14 15 16 28 17 18 29 19 20 21 22 23

Frequency band IR LED QED234 Emitter/Detector Alignment Buzzer Driver Relay Internal Block diagram

23 24 25 27

Relay 6v DC Basic block diagram of Relay

28

Pin diagram of MAX 232 LCD Address locations for a 1x16 line Shapes and sizes of different LCDs Pin diagram of 1x16 lines LCD
Different codes for LCD

33 36 37 38
42

List of tables
TABLE No. 1 2 3 4 5 6 7 TABLEDESCRIPTION Port 1 pins Port 3 pins Interrupt Register TCON Register TMOD Register MAX 232 Voltage levels Pin Description of LCD PAGE NUMBER 10 11
13

14 14 34 38

1. Introduction:
Infrared radiation is electromagnetic radiation of a wavelength longer than that of visible light, but shorter than that of radio waves. The name means "below red" red being the color of visible light with the longest wavelength. Infrared radiation has wavelengths between about 750 nm and 1 mm, spanning three orders of magnitude. The uses of infrared include military, such as: target acquisition, surveillance, homing and tracking and non-military, such as thermal efficiency analysis, remote temperature sensing, short-ranged wireless communication, spectroscopy, and weather forecasting. Infrared astronomy uses sensor-equipped telescopes to penetrate dusty regions of space, such as molecular clouds; detect cool objects such as planets, and to view highly red-shifted objects from the early days of the universe.

2. Block Diagram:
1

Power supply

IR module Microcontroll er Buzze r

Rela y

Loc k

LCD

Figure-1

3. Block Diagram Description:


2

The block diagram consists of IR module, power supply, buzzer, micro controller, relay and LCD.

This power supply section is required to convert AC signal to DC signal and also to reduce the amplitude of the signal. The available voltage signal from the mains is 230V/50Hz which is an AC voltage, but the required is DC voltage (no frequency) with the amplitude of +5V and +12V for various applications.

Here the IR receiver receives IR frequency from transmitter generates a bit 0 while IR frequency focused on the IR detector, generates bit 1 when there is no IR signal. This IR data is given to the RXD pin of the micro controller used in the receiver. . The micro controller will take the input data and compare with the internal data with respect to the output data. Then the corresponding information about the detection of object is display on the display.

When the signal is received at the receiver on the LCD we get a display that OBJECT IS DETECTED and simultaneously the buzzer rings continuously giving the indication that threat or object is detected till we reset the micro controller.

A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. A relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.

4. Circuit Diagram:
3

Figure-2

5. Circuit Diagram Description:


4

From the circuit 5v dc and 12 v dc is required to drive the all the components. The mains give the 230v ac so first we step down the 230v ac in to 12v ac by using step down transformer. Then the output is given to the bridge rectifier as given in the circuit diagram. The rectifier is eliminating the negative peak voltage of the input voltage the output of the rectifier is the pulsating dc. The dc error pulses are eliminated by using capacitor filter. Then the output at the parallel of the capacitor is the 12v dc. But the Micro Controller is work on 5v dc so convert the 12v dc in the 5v dc by using voltage regulator the output of the regulator is constant irrespective of the input voltage. The Micro Controller requires the reset logic circuit for protection of the internal program and internal clock when in the power failure. A sudden change in the power may cause data error. These types of the errors will corrupt the internal program. The reset logic circuit contains one capacitor and a resistor. This arrangement is shown in the Micro Controller circuit. XTAL1 and XTAL2 are the input and output, respectively. An inverting amplifier which is configured an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed. The display will be the construction of 2 rows and 16 columns of matrix pixels. This display was also having the two types of data input modes one is parallel data input and another one is series input data type. In the first type the data will given in the form of parallel from the micro controller it need not to require the parallel to series conversion but in the series input mode the Micro Controller can require the parallel to the series converter to convert the parallel data to the corresponding serial data. This display requires the 5 volts power supply for back light. Here the IR receiver receives IR frequency from transmitter generates a bit 0 while IR frequency focused on the IR detector, generates bit 1 when there is no IR signal. This IR data is given to the RXD pin of the micro controller used in the receiver. . The micro controller will take the input data and compare with the internal data with respect to the output data. Then the corresponding information about the detection of object is displayed on the LCD. When the signal is received at the receiver on the LCD we get a display that OBJECT IS DETECTED and simultaneously the buzzer rings continuously giving the indication that threat or object is detected till we reset the micro controller.

6. AT89S52 MICRO CONTROLLER


Microprocessors vs. Microcontrollers:
5

Microprocessors are single-chip CPUs used in microcomputers.

Microcontrollers and microprocessors are different in three main aspects: hardware architecture, applications, and instruction set features. Hardware architecture: A microprocessor is a single chip CPU while a microcontroller is a single IC contains a CPU and much of remaining circuitry of a complete computer (e.g., RAM, ROM, serial interface, parallel interface, timer, and interrupt handling circuit). Applications: Microprocessors are commonly used as a CPU in computers while microcontrollers are found in small, minimum component designs performing control oriented activities. Microprocessor instruction sets are processing Intensive. Their instructions operate on nibbles, bytes, words, or even double words. Addressing modes provide access to large arrays of data using pointers and offsets. They have instructions to set and clear individual bits and perform bit operations. They have instructions for input/output operations, event timing, enabling and setting priority levels for interrupts caused by external stimuli. Processing power of a microcontroller is much less than a microprocessor.

Difference between 8051 and 8052:


The 8052 microcontroller is the 8051's "big brother." It is a slightly more powerful microcontroller, sporting a number of additional features which the developer may make use of:

256 bytes of Internal RAM (compared to 128 in the standard 8051). A third 16-bit timer, capable of a number of new operation modes and 16-bit reloads. Additional SFRs to support the functionality offered by the third timer.

AT89S52:
Features:
6

Compatible with MCS-51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256K Internal RAM 32 Programmable I/O Lines 3 16-bit Timer/Counters Eight Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag

DESCRIPTION OF MICROCONTROLLER 89S52:


The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable Flash memory. The device is manufactured Using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 micro controller. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable flash one monolithic chip; the Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and cost-effective solution to many embedded control applications.
7

Figure-3

PIN CONFIGURATIONS: PDIP

Figure-4

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for perationdown 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 interrupt or hardware reset.

PIN DESCRIPTION OF MICROCONTROLLER 89S52: VCC


9

Supply voltage.

GND Ground. Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pullups are required during program verification Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 Output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input. (P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification. Port Pin P.1.0 P.1.1 P.1.5 P.1.6 P.1.7 Alternate functions T2 (External count input to timer/counter) clock-out. T2EX (Timer/counter 2 capture/reload trigger and direction control. MOSI(used for in-system programming) MOSO(used for in-system programming) SCK(used for in-system programming)

Table-1 Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by 10

the internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are writ 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification. Port Pin P.3.0 P.3.1 P.3.2 P.3.3 P.3.4 P.3.5 P.3.6 P.3.7

Alternate functions RXD(Serial input port) TXD(Serial output port ) INT0'(External interrupt 0) INT1'(External interrupt 1) T0(Timer 0 external input) T1(Timer 1 external input) WR'(External data memory write strobe) RD'(External data memory read strobe)

Table-2 RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during 11

Flash programming. In normal operation, ALE is emitted at a constant rate of1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the micro controller is in external execution mode.

PSEN
Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP
External Access Enable. 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.Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to VCC for internal program executions. This pin also receives the 12voltProgramming enables voltage (VPP) during Flash programming.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2
Output from the inverting oscillator amplifier.

Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an External clock source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 2.

12

Figure 5. Oscillator Connections

Interrupt Registers: The individual interrupt enable bits are in the IE


register. Two priorities can be set for each of the six interrupt sources in the IP register.
Symbol EA ETS ES ET1 EX1 ET0 EX0 Positio n IE.7 IE.6 IE.5 IE.4 IE.3 IE,2 IE.1 IE.0 Function Disables all interrupts Reserved Timer 2 interrupt enable bit Serial port interrupt enable bit Timer 1 interrupt enable bit External interrupt 1 enable bit Timer 0 interrupt enable bit External interrupt 0 enable bit

Table-3

TCON REGISTER : Timer/counter Control Register

7 TF1

6 TR1

5 TF0

4 TR0

3 IE1 13

2 IT1

1 IE0

0 IT0

BIT NUMBER

BIT MNEMONIC

DESCRIPTION

TF1

TR1

TF0

TR0

Timer 1 overflow flag. Cleared by hardware when processor vectored to interrupt routine. Set by hardware on timer/counter overflows, when the timer1 register overflows. Timer 1 run control bit. Cleared to turn off timer/counter 1. Set to turn on timer/counter 1. Timer 0 overflows flag. Cleared by hardware when processor vectors to interrupt routine. Set by hardware on timer/counter overflow, when the timer 0 register overflows. Timer 0 run control bit. Cleared to turn off timer/counter 0. Set to turn on timer/counter 0. Interrupt 1 edge flag. Cleared by hardware when interrupt is processed if edge triggered (IT1). Set by hardware when external input is detected on NT1 pin. Interrupt 1 type control bit. Clear to select low level active (level triggered) for external interrupt (NT1)1. Set to select falling edge active (edge triggered) for external interrupt 1. Interrupt 0 edge flag. Cleared by hardware when interrupt is processed if edge triggered (IT0). Set by hardware when external input is detected on NT1 pin. Interrupt 0 type control bit. Clear to select low level active (level triggered) for external interrupt (NT0)1. Set to select falling edge active (edge triggered) for external interrupt 1.

IE1

IT1

IE0

IT0

Table-4

TMOD REGISTER: Timer/Counter 0 and 1 Modes

7 GATE1
BIT NUMBER

6 C/T'
BIT MNEMONIC

5 M11

4 M01

3 GATE0

2 C/T'

1 M10

0 M00

DESCRIPTION

14

GATE1

C/T'

Timer 1 gating control bit. Clear to enable the timer 1 whenever the TR1 bit is set. Set to enable the timer 1 only while the INT1' pin is high and TR1 bit is set. Timer 1 counter/timer select bit. Cleared for timer operation. Set for counter operation. M11 M10 0 0 0 1 1 0 8-bit auto-reload timer/counter. 1 1 timer/counter 1 stopped Timer 0 gating control bit. Clear to enable the timer 0 whenever the TR0 bit is set. Set to enable the timer 1 only while the INT0' pin is high and TR0 bit is set. Timer 0 counter/timer select bit. Cleared for timer operation. Set for counter operation. M10 0 0 1 1 M00 0 1 0 1 Timer 0 mode select bit Operating mode timer/counter 1 stopped 13-bit timer/counter. 8-bit auto-reload timer/counter. TLO is an 8-bit timer/counter. Timer 1 mode select bit Operating mode 13-bit timer 13-bit timer/counter.

M11

M10

GATE0

C/T'

M01

M00

Table-5

7.POWER SUPPLY:
The Power Supply is a Primary requirement for the project work. The required DC power supply for the base unit as well as for the recharging unit is derived from the mains line. For this purpose center tapped secondary of 12V-012V transformer is used. From this transformer we getting 5V power supply. In this +5V output is a regulated output and it is designed using 7805 positive voltage regulator. This is a 3 Pin voltage regulator, can deliver current up to 800 milliamps. Rectification is a process of rendering an alternating current or voltage into a unidirectional one. The component used for rectification is called Rectifier. A 15

rectifier permits current to flow only during positive half cycles of the applied AC voltage. Thus, pulsating DC is obtained to obtain smooth DC power additional filter circuits required. BLOCK DIAGRAM:

Figure-6-Power supply CIRCUIT DIAGRAM: Component Used (a) Capacitors

(i)

1000F/25v

for +12v

(b) Step down transformer

(i)

230v / 12v- 0 -12v/ 500mA Transformer

(c)

Diodes: 1N4007

16

Figure-7-Circuit diagram A diode can be used as rectifier. There are various types of diodes. However, semiconductor diodes are very popularly used as rectifiers. A semiconductor diode is a solid-state device consisting of two elements is being an electron emitter or cathode, the other an electron collector or anode. Since electrons in a semiconductor diode can flow in one direction only-form emitter to collector-the diode provides the unilateral conduction necessary for rectification. The rectified Output is filtered for smoothening the DC, for this purpose capacitor is used in the filter circuit. The filter capacitors are usually connected in parallel with the rectifier output and the load. The AC can pass through a capacitor but DC cannot, the ripples are thus limited and the output becomes smoothed. When the voltage across the capacitor plates tends to rise, it stores up energy back into voltage and current. Thus, the fluctuation in the output voltage is reduced considerable

Circuit Explanation 1) 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:

17

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.

Figure-8.An ideal step-down transformer showing magnetic flux in the core

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, NS 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
18

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

Ideal power equation


If the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly efficient; all the incoming energy is transformed from the primary circuit to the magnetic field and into the secondary circuit. If this condition is met, the incoming electric power must equal the outgoing power.

Pincoming = IPVP = Poutgoing = ISVS


giving the ideal transformer equation

Figure-9

Pin-coming = IPVP = Pout-going = ISVS


giving the ideal transformer equation
19

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. 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

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

REGULATOR (LM7805):
A variable regulated power supply, also called a variable bench power supply, is one where you can continuously adjust the output voltage to your requirements. Varying the output of the power supply is the recommended way to test a project after having double checked parts placement against circuit drawings and the parts placement guide. This type of regulation is ideal for having a simple variable bench power supply. Actually this is quite important because one of the first projects a hobbyist should undertake is the construction of a variable regulated power supply. While a dedicated supply is quite handy e.g. 5V or 12V, its much handier to have a variable supply on hand, especially for testing. Most digital logic circuits and processors need a 5 volt power supply. To use these parts we need to build a regulated 5 volt source. Usually you start with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12 volt power supply is included with the Beginner Kit and the Microcontroller Beginner Kit.). To make a 5 volt power supply, we use a LM7805 voltage regulator IC (Integrated Circuit). The IC is shown below.

20

Figure-10-Voltage Regulator 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.

Regulator Block diagram:

21

Figure-11-Regulator Block diagram

8.IR PAIR:INFRARED (IR) TECHNOLOGY


Introduction:
Technically known as "infrared radiation", infrared light is part of the electromagnetic spectrum located just below the red portion of normal visible light the opposite end to ultraviolet. Although invisible, infrared follows the same principles as regular light and can be reflected or pass through transparent objects, such as glass. Infrared remote controls use this invisible light as a form of communications between themselves and home theater equipment, all of which have infrared receivers positioned on the front. Essentially, each time you press a button on a remote, a small infrared diode at the front of the remote beams out pulses of light at high speed to all of your equipment. When the equipment recognizes the signal as its own, it responds to the command.
22

But much like a flashlight, infrared light can be focused or diffused, weak or strong. The type and number of emitters can affect the possible angles and range your remote control can be used from. Better remotes can be used up to thirty feet away and from almost any angle, while poorer remotes must be aimed carefully at the device being controlled. The light our eyes see is but a small part of a broad spectrum of electromagnetic radiation. On the immediate high energy side of the visible spectrum lies the ultraviolet, and on the low energy side is the infrared. The portion of the infrared region most useful for analysis of organic compounds is not immediately adjacent to the visible spectrum, but is that having a wavelength range from 2,500 to 16,000 nm, with a corresponding frequency range from 1.9*1013 to 1.2*1014 Hz(The frequency of infrared ranges from 0.003 - 4 x 1014 Hz or about 300 gigahertz to 400 terahertz.).

Figure-12 Infrared imaging is used extensively for both military and civilian purposes. Military applications include target acquisition, surveillance, night vision, homing and tracking. Non-military uses include thermal efficiency analysis, remote temperature sensing, short-ranged wireless communication, spectroscopy, and weather forecasting. Infrared astronomy uses sensor-equipped telescopes to penetrate dusty regions of space, such as molecular clouds; detect cool objects such as planets, and to view highly red-shifted objects from the early days of the universe IR LED QED234:

23

Figure-13- IR LED QED234

FEATURES:
Wave length is 940 nm

Chip material =GaAs with AlGaAs window Package type: T-1 3/4 (5mm lens diameter) Matched Photo sensor: QSD122/123/124 Medium Emission Angle, 40 High Output Power Package material and color: Clear, untainted, plastic Ideal for remote control applications

Emitter/Detector Alignment:
Good alignment of the emitter and detector is important for good operation, especially if the gap is large. This can be done with a piece of string stretched between and in line with LED and phototransistor. A length of dowel or stiff wire

24

could be used to set the alignment. Another method that can be used for longer distances is a laser pointer shone through one of the mounting holes. For best results the height of the "beam" should be at coupler height and at an angle across the tracks. The emitter could also be mounted above the track with the phototransistor placed between the rails in locations such as hidden yards. Placing the emitter and detector at an angle would again be helpful.

Figure-14

Infrared Emitters
IR Emitters generally "stick" onto the front of the device you want to control. Therefore you need one emitter for each device. "Dual" emitters have two emitters and one plug, so they only take up one jack of the connecting block. "Blink" emitters blink visibly as well as infrared, so they are easier to troubleshoot. All emitters come with long cords and extra double-stick tape. "Blast" style emitters, where one emitter blinks into several devices, are usually less reliable but can be used when the environment is tightly controlled .

Applications: Infrared Filters Night vision Thermography Other imaging


25

Tracking Heating Communications Spectroscopy Meteorology Climatology Astronomy Art history Biological systems Photo bio modulation Health hazard

BUZZER:

A buzzer or beeper is a signalling device, usually electronic, typically used in automobiles, household appliances such as a microwave oven, or game shows. It most commonly consists of a number of switches or sensors connected to a control unit that determines if and which button was pushed or a preset time has lapsed, and usually illuminates a light on the appropriate button or control panel, and sounds a warning in the form of a continuous or intermittent buzzing or beeping sound. Initially this device was based on an electromechanical system which was identical to an electric bell without the metal gong (which makes the ringing noise). Often these units were anchored to a wall or ceiling and used the ceiling or wall as a sounding board. Another implementation with some AC-connected devices was to implement a circuit to make the AC current into a noise loud enough to drive a loudspeaker and hook this circuit up to a cheap 8-ohm speaker. Now-a-days, it is more popular to use a ceramicbased piezo-electric sounder like a Sonalert which makes a high-pitched tone. Usually these were hooked up to driver circuits which varied the pitch of the sound or pulsed the sound on and off.

Buzzer Driver:

26

V C

C 1 2 V

+ B u z Q ? B C

D ? 4 0 0 7

5 4 7

C PORT

Figure-15

The circuit is designed to control the buzzer. The buzzer ON and OFF is controlled by the pair of switching transistors (BC 547). The buzzer is connected in the Q2 transistor collector terminal. When high pulse signal is given to base of the Q1 transistors, the transistor is conducting and close the collector and emitter terminal so zero signals is given to base of the Q2 transistor. Hence Q2 transistor and buzzer is turned OFF state. When low pulse is given to base of transistor Q1, the transistor is turned OFF. Now 12V is given to base of Q2 transistor so the transistor is conducting and buzzer is energized and produces the sound signal.

9.RELAYS
Introduction:
27

A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. A relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.

Figure-16-Relay Internal Block diagram Relays are usually SPDT (single pole double through switch)or DPDT (double pole double through switch) but they can have many more sets of switch contacts, for example relays with 4 sets of changeover contacts are readily available.

Figure-17

Basic operation of a relay:


An electric current through a conductor will produce a magnetic field at right angles to the direction of electron flow. If that conductor is wrapped into a coil shape, the magnetic field produced will be oriented 28

along the length of the coil. The greater the current, the greater the strength of the magnetic field, all other factors being equal.

Figure-18 Inductors react against changes in current because of the energy stored in this magnetic field. When we construct a transformer from two inductor coils around a common iron core, we use this field to transfer energy from one coil to the other. However, there are simpler and more direct uses for electromagnetic fields than the applications we've seen with inductors and transformers. The magnetic field produced by a coil of current-carrying wire can be used to exert a mechanical force on any magnetic object, just as we can use a permanent magnet to attract magnetic objects, except that this magnet (formed by the coil) can be turned on or off by switching the current on or off through the coil. If we place a magnetic object near such a coil for the purpose of making that object move when we energize the coil with electric current, we have what is called a solenoid. The movable magnetic object is called an armature, and most armatures can be moved with either direct current (DC) or alternating current (AC) energizing the coil. The polarity of the magnetic field is irrelevant for the purpose of attracting an iron armature. Solenoids can be used to electrically open door latches, open or shut

29

valves, move robotic limbs, and even actuate electric switch mechanisms and is used to actuate a set of switch contacts Relays can be categorized according to the magnetic system and operation:

Neutral Relays:
This is the most elementary type of relay. The neutral relays have a magnetic coil, which operates the relay at a specified current, regardless of the polarity of the voltage applied.

Biased Relays:
Biased relays have a permanent magnet above the armature. The relay operates if the current through the coil winding establishes a magneto-motive force that opposes the flux by the permanent magnet. If the fluxes are in the same direction, the relay will not operate, even for a greater current through the coil.

Polarized Relays:
Like the biased relays, the polarized relays operate only when the current through the coil in one direction. But there the principle is different. The relay coil has a diode connected in series with it. This blocks the current in the reverse direction. The major difference between biased relays and polarized relays is that the former allows the current to pass through in the reverse direction, but does the not operate the relay and the later blocks the current in reverse direction. You can imagine how critical these properties when relays are connected in series to form logic circuits.

Magnetic Stick Relays or Perm polarized Relays:


These relays have a magnetic circuit with high permanence. Two coils, one to operate (pick up) and one to release (drop) are present. The relay is activated by a current in the operate coil. On the interruption of the current the armature remains in picked up position by the residual magnetism. The relay is released by a current through the release coil.
30

Slow Release Relays:


These relays have a capacitor connected in parallel to their coil. When the operating current is interrupted the release of relay is delayed by the stored charge in the capacitor. The relay releases as the capacitor discharges through the coil.

Relays for AC:


These are neutral relays and picked up for a.c. current through their coil. These are very fast in action and used on power circuits of the point motors, where high current flows through the contacts. A normal relay would be slow and make sparks which in turn may weld the contacts together. All relays have two operating values (voltages), one pick-up and the other other drop away. The pick-up value is higher than the drop away value.

Applications:

To control a high-voltage circuit with a low-voltage signal, as in some types of modems or audio amplifiers, To control a high-current circuit with a low-current signal, as in the starter solenoid of an automobile, To detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers (protection relays), To isolate the controlling circuit from the controlled circuit when the two are at different potentials, for example when controlling a mains-powered device from a low-voltage switch. The latter is often applied to control office lighting as the low voltage wires are easily installed in partitions, which may be often moved as needs change. They may also be controlled by room occupancy detectors in an effort to conserve energy,

To perform logic functions. For example, the boolean AND function is realised by connecting NO relay contacts in series, the OR function by connecting NO contacts in parallel. The change-over or Form C contacts perform the XOR (exclusive or) function. Similar functions for NAND and
31

NOR are accomplished using NC contacts. The Ladder programming language is often used for designing relay logic networks.
o

Early computing. Before vacuum tubes and transistors, relays were used as logical elements in digital computers. See ARRA (computer), Harvard Mark II, Zuse Z2, and Zuse Z3. Safety-critical logic. Because relays are much more resistant than semiconductors to nuclear radiation, they are widely used in safetycritical logic, such as the control panels of radioactive waste-handling machinery.

To perform time delay functions. Relays can be modified to delay opening or delay closing a set of contacts. A very short (a fraction of a second) delay would use a copper disk between the armature and moving blade assembly. Current flowing in the disk maintains magnetic field for a short time, lengthening release time. For a slightly longer (up to a minute) delay, a dashpot is used. A dashpot is a piston filled with fluid that is allowed to escape slowly. The time period can be varied by increasing or decreasing the flow rate. For longer time periods, a mechanical clockwork timer is installed

MAX 232:

MAX 232C is used to interface the transmitter and receiver circuit to the PC. It issued to match between the RS232C and TTL levels. The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply
32

RS232C voltage levels from a single5V supply. Each receiver converts RS232C inputs to 5V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept 30V inputs. Each driver converts TTL/CMOS input levels into RS232C levels.

Pin Diagram for MAX 232:

Figure-19

VOLTAGE LEVELS :

It is helpful to understand what occurs to the voltage levels. When a MAX232. IC receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15V, and changes TTL Logic 1 to between -3 to -15V, and vice versa for converting from RS232 to TTL.

This can be confusing when you realize that the RS232 Data Transmission voltages at a certain logic state are opposite from the RS232 Control Line voltages at the same logic state. To clarify the matter, see the table below.

33

RS232 Line Type & Logic Level Data Transmission (Rx/Tx) Logic 0 Data Transmission (Rx/Tx) Logic 1 Control Signals (RTS/CTS/DTR/DSR) Logic 0 Control Signals (RTS/CTS/DTR/DSR) Logic 1

RS232 Voltage +3V to +15V -3V to -15V -3V to -15V

TTL Voltage to/from MAX232 0V 5V 5V

+3V to +15V

0V

Table-6

34

10.LCD (Liquid Crystal Display)


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. Features: (1) Interface with either 4-bit or 8-bit microprocessor. (2) Display data RAM (3) 80x8 bits(80 characters). (4) Character generator ROM
35

available. Line lengths of 8, 16, 20, 24, 32 and 40 charact ers are all standar d, in one, two

(5). 160different 5 dot-matrix character patterns. 7 (6). Character generator RAM (7) 8 different user programmed 5 7 dot-matrix patterns. (8).Display data RAM and character generator RAM may be accessed by the microprocessor. (9) Numerous instructions (10) Clear Display, Cursor Home, Display ON/OFF, Cursor ON/OFF, Blink Character, Cursor Shift, Display Shift. (11).Built-in reset circuit is triggered at power ON. (12). Built-in oscillator.

Data can be placed at any location on the LCD. For 161 LCD, the address locations are:

Figure-20: Address locations for a 1x16 line LCD

36

Shapes and sizes:

Figure-21

Even limited to character based modules, there is still a wide variety of shapes and sizes available. Line lengths of 8,16,20,24,32 and 40 characters are all standard, in one, two and four line versions. Several different LC technologies exists. supertwist types, for example, offer Improved contrast and viewing angle over the older twisted nematic types. Some modules are available with back lighting, so so that they can be viewed in dimly-lit conditions. The back lighting may be either electro-luminescent, requiring a high voltage inverter circuit, or simple LED illumination.

PIN DESCRIPTION:

Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in both for back-light LED connections).

37

Figure-22: pin diagram of 1x16 lines LCD

Pin 1 2 3 4 5 6 7 14 15 16

Symbol Vss Vdd Vo RS R/W E DB0DB7 A K

Function Power supply(GND) Power supply(+5v) Contrast adjust Introduction/data register sheet Data bus line Enable signal Data bus line Power supply for LED B/L(+) Power supply for LED B/L(-)

Table-7 CONTROL LINES: EN: Line is called "Enable." This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should make sure this line is low (0) and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN high (1) and wait for the minimum amount of time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again. RS:
38

Line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is text data which sould be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high. RW: Line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands, so RW will almost always be low. Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7. Logic status on control lines: E - 0 Access to LCD disabled - 1 Access to LCD enabled
R/W - 0 Writing data to LCD - 1 Reading data from LCD RS - 0 Instructions 1 Character

Writing data to the LCD: 1) Set R/W bit to low 2) Set RS bit to logic 0 or 1 (instruction or character) 3) Set data to data lines (if it is writing) 4) Set E line to high 5) Set E line to low
39

Read data from data lines (if it is reading)on LCD: 1) Set R/W bit to high 2) Set RS bit to logic 0 or 1 (instruction or character) 3) Set data to data lines (if it is writing) 4) Set E line to high 5) Set E line to low Entering Text: First, a little tip: it is manually a lot easier to enter characters and commands in hexadecimal rather than binary (although, of course, you will need to translate commands from binary couple of sub-miniature hexadecimal rotary switches is a simple matter, although a little bit into hex so that you know which bits you are setting). Replacing the d.i.l. switch pack with a of re-wiring is necessary. The switches must be the type where On = 0, so that when they are turned to the zero position, all four outputs are shorted to the common pin, and in position F, all four outputs are open circuit. All the available characters that are built into the module are shown in Table 3. Studying the table, you will see that codes associated with the characters are quoted in binary and hexadecimal, most significant bits (left-hand four bits) across the top, and least significant bits (right-hand four bits) down the left. Most of the characters conform to the ASCII standard, although the Japanese and Greek characters (and a few other things) are obvious exceptions. Since these intelligent modules were designed in the Land of the Rising Sun, it seems only fair that their Katakana phonetic symbols should also be incorporated. The more extensive Kanji character set, which the Japanese share with the Chinese, consisting of several thousand different characters, is not included! Using the switches, of whatever type, and referring to Table 3, enter a few characters onto the display, both letters and numbers. The RS switch (S10) must be up (logic 1) when sending the characters, and switch E (S9) must be pressed for each
40

of them. Thus the operational order is: set RS high, enter character, trigger E, leave RS high, enter another character, trigger E, and so on. The first 16 codes in Table 3, 00000000 to 00001111, ($00 to $0F) refer to the CGRAM. This is the Character Generator RAM (random access memory), which can be used to hold user-defined graphics characters. This is where these modules really start to show their potential, offering such capabilities as bar graphs, flashing symbols, even animated characters. Before the user-defined characters are set up, these codes will just bring up strange looking symbols. Codes 00010000 to 00011111 ($10 to $1F) are not used and just display blank characters. ASCII codes proper start at 00100000 ($20) and end with 01111111 ($7F). Codes 10000000 to 10011111 ($80 to $9F) are not used, and 10100000 to 11011111 ($A0 to $DF) are the Japanese characters.

41

Figure-23

42

Initialization by Instructions:

Figure-24

If the power conditions for the normal operation of the internal reset circuit are not satisfied, then executing a series of instructions must initialize LCD unit. The procedure for this initialization process is as above show.

11.Keil Software
43

Keil Software
Installation:
Installing the Keil software on a Windows PC Insert the CD-ROM in your computers CD drive On most computers, the CD will auto run, and you will see the Keil installation menu. If the menu does not appear, manually double click on the Setup icon, in the root directory: you will then see the Keil menu. On the Keil menu, please select Install Evaluation Software. (You will not require a license number to install this software). Follow the installation instructions as they appear.

Loading the Projects:


The example projects for this book are NOT loaded automatically when you install the Keil compiler.

These files are stored on the CD in a directory /Pont. The files are arranged by chapter: for example, the project discussed in Chapter 3 is in the directory /Pont/Ch03_00-Hello. Rather than using the projects on the CD (where changes cannot be saved), please copy the files from CD onto an appropriate directory on your hard disk. Note: you will need to change the file properties after copying: file transferred from the CD will be read only. Configuring the Simulator:

Open the Keil Vision2 Go to Project Open Project and browse for Hello in Ch03_00 in Pont and open it. Go to Project Select Device for Target Target1 Select 8052(all variants) and click OK

Now we need to check the oscillator frequency: Go to project Options for Target Target1

Make sure that the oscillator frequency is 12MHz.


Running the Simulation

Having successfully built the target, we are now ready to start the debug session and run the simulator. First start a debug session
44

The flashing LED we will view will be connected to Port 1. We therefore want to observe the activity on this port To ensure that the port activity is visible, we need to start the periodic window update flag Go to Debug - Go While the simulation is running, view the performance analyzer to check the delay durations. Go to Debug Performance Analyzer and click on it Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button

12.IR Advantages:
1. Low power requirements: therefore ideal for laptops, telephones, personal

digital assistants 2. Low circuitry costs: $2-$5 for the entire coding/decoding circuitry
45

3. Simple circuitry: no special or proprietary hardware is required, can be

incorporated into the integrated circuit of a product


4. Higher security: directionality of the beam helps ensure that data isn't leaked

or spilled to nearby devices as it's transmitted 5. Portable 6. Few international regulatory constraints: IrDA (Infrared Data Association) functional devices will ideally be usable by international travelers, no matter where they may be 7. High noise immunity: not as likely to have interference from signals from other devices

IR Disadvantages:
1. Line of sight: transmitters and receivers must be almost directly aligned (i.e. 2. 3. 4. 5.

able to see each other) to communicate Blocked by common materials: people, walls, plants, etc. can block transmission Short range: performance drops off with longer distances Light, weather sensitive: direct sunlight, rain, fog, dust, pollution can affect transmission Speed: data rate transmission is lower than typical wired transmission

Applications:
1.Object Detection using IR light:
It is the same principle in ALL Infra-Red proximity sensors. The basic idea is to send infra red light through IR-LEDs, which is then reflected by any object in front of the sensor and pick-up the reflected IR light

we are going to use another IR-LED, to detect the IR light that was emitted from another led of the exact same type.

2. Wheel Encoder:

46

This is a simple wheel encoder based on the idea that white stripes will reflect IR light, while black ones will absorb it. this will result in a series of electrical pulses as the wheel is rotating, providing the microcontroller with precious information that can be used to calculate displacement, velocity or even acceleration. It is now clear that this kind of sensor has to be Always ON, to detect every single white stripe passing in front of it, to achieve accurate results.

Contact-Less tachometer:
This is a tachometer, that counts the revolutions per minute of a rotating object, given that the object has a reflective stripe glued on it, that will pass in front of the IR sensor for each and every revolution, giving a pulse per revolution. Again a microcontroller will have to be used to 'understand' the data provided by the sensor and display it.

These are some of the applications of IR technology.

13. Flow Chart:

47

14.Source Code:
#include<reg51.h>
48

#include<string.h>

sbit ir=P0^0; sbit buzz=P0^1; sbit relay=P0^2; sfr LCD=0xA0; P0(P1.4, P1.5, P1.6, P1.7) and its address is 90 */ sbit RW=LCD^1; sbit RS=LCD^0; sbit EN=LCD^2; /* RS Connected to P1.2*/ /* E Connected to P1.3 */ /* LCD is connected to Port

void cmd_lcd(unsigned char ); void display_lcd(unsigned char ); void delay(unsigned int ); void lcd_init(void); void display_string(char*); void set_status(int count);

char *welcome="BANK SECURITY";

/* Start of Main */ void main()


49

{ lcd_init(); cmd_lcd(0x01); display_string(welcome); delay(100);

if(ir==0) { goto end; } else { buzz=0; relay=0; cmd_lcd(0x01); display_string("secure"); while(ir); }

end: { buzz=1; relay=1;


50

cmd_lcd(0x01); display_string("object detected"); } while(1); }

/* Initialise LCD module */ void lcd_init(void) { delay(10); cmd_lcd(0x28); // cmd_lcd(0x28); /* Function set 4-bit*/

//cmd_lcd(0x28); cmd_lcd(0x0e); cmd_lcd(0x01); cmd_lcd(0x06); cmd_lcd(0x80); } /* Commands set for LCD */ void cmd_lcd(unsigned char x) { unsigned char y;
51

/* Display on cursor on */ /* Clear display */ /* Entry mode */ /* First Line Address */

y=x>>4; LCD=y<<4|0x04; LCD=0; LCD=x<<4|0x04; LCD=0; delay(2); } /* Display on LCD each character*/ void display_lcd(unsigned char x) { unsigned char y; y=x>>4; LCD=y<<4|0x05; LCD=0; LCD=x<<4|0x05; LCD=0; delay(2); } /* String to display on LCD */ void display_string(char *str) { int x=strlen(str),i; cmd_lcd(0x80);
52

for(i=0;i<x;i++) display_lcd(str[i]); /* Iterating to display each character*/ }

/* Delay routine */ void delay(unsigned int n) { unsigned short i; unsigned short j; for(j=0;j<n;j++) for(i=0;i<=1000;i++); }

15.Conclusion:
The goal of this project is to build an Infrared security system for access control of a door, window or lockers in banks and theyre by providing threshold crossing alert. A retro-reflective photoelectric beam sensor built into the emitter detects when the passing of a person or the presence of an object in the path of the infrared beam breaks the infrared beam. A buzzer is used to alert that a security breech has occurred or that an object has entered or passed through the infrared beam

53

16. Future scope:


Due to rapid advances in infrared detector technology, the development of adaptive optics for ground based work and the commitment to infrared missions from space organizations such as NASA, ESA and ISAS, the future of infrared astronomy is extremely bright. Within the next decade, infrared astronomy will bring us exciting discoveries about new planets orbiting nearby stars, how planets, stars and galaxies are formed, the early universe, starburst galaxies, brown dwarfs, quasars and interstellar matter

54

17. Bibliography:
The 8051 Micro controller and Embedded Systems -Muhammad Ali Mazidi Janice Gillispie Mazidi The 8051 Micro controller Architecture, Programming & Applications -Kenneth J.Ayala Fundamentals of Micro processors and Micro computers -B.Ram
55

Micro processor Architecture, Programming & Applications -Ramesh S.Gaonkar Electronic Components -D.V.Prasad

References on the Web:


www.national.com www.atmel.com www.microsoftsearch.com www.geocities.com
http://tycho.usno.navy.mil/gpscurr.html

56

Vous aimerez peut-être aussi