You are on page 1of 68

A project report on

HOME SECURITY SYSTEM USING MICROCONTROLLER 8051


Submitted for partial fulfillment of award of BACHELOR OF ENGINEERING
in

ELECTRONICS &COMMUNICATION ENGINEERING By


NAVEEN GARG ANKIN DOSHI AKHIL CHUG

Name of Guide

Ms. VIMLESH SINGH

MANAV RACHNA INTERNATIONAL UNIVERSITY FARIDABAD, HARYANA

Certificate

Certified that NAVEEN, ANKIN and AKHIL has carried out the project work presented in this report entitled HOME SECURITY SYSTEM USING MICROCONTROLLER 8051. for the award of Bachelor of Engineering (in Electronics & Communication Engineering) from Faculty of Engineering & Technology , Manav Rachna International university, Faridabad under my Supervision. The project report embodies result of original work and studies carried out by Naveen, Ankin & Akhil and the contents of the report do not form the basis for the award of any other degree to the candidate or to anybody else.

Name of Supervisor: Designation: Date:

Head of Department Electronics & Communication

ABSTRACT
This project is used to prevent a building from fire. This is used to prevent our major as well as minor equipments from fire. This is totally automatic system. By this we can save equipments when we are not in the building. When we are in any corner of the world we can easily save our equipments from fire. In this project a fire senser (Thermister) is used which sense the fire. Then by the use of DTMF IC a signal is transmitted to a mobile phone through a landline phone which is connected with the circuit. Then by this mobile phone the equipments of the building are switched of by the use of DTMF IC. All the programming is stored in the MICROCONTROLLER IC 8051 and all the equipments are drive through driver IC ULN2003 IC. All the equipments are connected through relays. Relays are used as switching device. Due to high power requirement relays are used. A buzzer is also used there to alert the people about the fire.

ACKNOWLEDGEMENT
I take this opportunity to express my profound sense of gratitude and respect to all those who helped throughout the duration of this project. I would like to thank Ms. Vimlesh Singh, project coordinator, MRIU Faridabad, for her valuable suggestions, able guidance and constant encouragement regarding this project. I also thank Mr. Umesh , lecturer of MRIU Faridabad, for answering my Mundane queries and helping me in every way possible at every stage of this project.

NAVEEN(029) ANKIN(008) AKHIL(001) MRIU, Faridabad

TABLE OF CONTENTS 1. CHAPTER 1-INTRODUCTION 1.1 1.2 1.3 1.4 2 Principal of working Description Block diagram Circuit Diagram

CHAPTER 2-MICROCONTROLLER 89S51 2.1 2.2 2.3 2.4 Architecture Pin Description Programming the Flash Special Function Registers IC 8870/9170 Features Operating information & Applications Pin description & Specifications IC ULN 2003 Features Description & Logic diagram Specifications & Electrical characterstics Overview of PCB Soldering Transister & Resistors Transformer Two Crystals (3.MHZ,11.5MHZ) Head Phone & Buzzer

CHAPTER 3-DTMF SECTION 3.1 3.2 3.3

CHAPTER 4-DRIVER SECTION 4.1 4.2 4.3

CHAPTER 5-PCB & OTHER COMPONENTS 5.1 5.2 5.3 5.4 5.5 5.6

6.

CHAPTER 6- PROGRAMMING OF 8051

CHAPTER1. INTRODUCTION

Studying The Basic Principles Of Home Security


The security of your home and your loved ones is something that should never be sacrificed as as soon as it's been jeopardized you'll never be able to rebuild the sense of security you used to have. Nowadays, thieves take advantage of pretty state-of-the-art equipment to get into your home. Therefore, it can be very critical to grasp most of the house security requirements as they will make you truly feel safe. At this time, virtually anybody is able to afford a home security system because the price tags have gone down a lot. Most of the time, people never look into investing in a home burglar alarm until they land in an unpleasant and dangerous conditions. Don't wait around for something similar to this to take place and undertake all the vital steps to provide your house with strong protection. The collection of house protection essentials contains a keypad, a main control component, a siren, entry detectors, and also a movement detector.

Mainly we are employing landline telephone to know wether the fire is happening or not. BLOCK DIAGRAM

230 V AC

Step Down T/F

Full Wave Bridge Rectifier

Voltage Regulator

+5VDC/500mA +9VDC/250mA

POWER SUPPLY

DTMF IC 9170

Microcontroller AT89S51

Driver Circuit ULN2003

CABLE

Relays 6V , 5V

Amplifier Circuit stage

APPLIANCES

LANDLINE

CIRCUIT DIAGRAM:-

CHAPTER 2.MICROCONTROLLER AT89S51


Architecture of 8051 family:-

Features
Compatible with MCS-51 Products

4K Bytes of In-System Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles Fully Static Operation: 0 Hz to 24 MHz Three-Level Program Memory Lock 128 x 8-Bit Internal RAM 32 Programmable I/O Lines Two 16-Bit Timer/Counters

Six Interrupt Sources Programmable Serial Channel Low Power Idle and Power Down Modes Description The AT89S51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash Programmable and Erasable Read Only Memory (PEROM). The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industry standard MCS-51 instruction set and pin out. 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 Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five vector two-level interrupt architecture, a full duplex serial port, and on-chip oscillator and clock circuitry. In addition, the AT89S51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. Pin Description VCC Supply voltage.

GND Ground. Port 0 Port 0 is an 8-bit open drain bidirectional I/O port. As an output port each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may 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 pull-ups are required during program verification.

Port 1 Port 1 is an 8-bit bidirectional 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. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2 Port 2 is an 8-bit bidirectional 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 the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. 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 it uses strong internal pullups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI); Port 2 emits 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 bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 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 AT89S51.Port 3 also receives some control signals for Flash programming and verification. 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 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 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. 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 ALEdisable bit has no effect if the microcontroller is in external execution mode. PSEN Program Store Enable is the read strobe to external program memory. Port Pin Alternate Functions P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) P3.7 RD (external data memory read strobe) When the AT89S51 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. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP. 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 which 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.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.

Idle Mode In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled Interrupt or by hardware reset. It should be noted that when idle is terminated by a hard Hardware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. Onchip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory. Status of External Pins during Idle and Power down Modes Mode Program Memory ALE PSEN PORT0 PORT1 PORT2 PORT3 Idle Internal 1 Data

Idle External 1 Float Data Address Data Power down Internal 0 Data Power down External 0 Float Data Power down Mode In the power down mode the oscillator is stopped, and the instruction that invokes power down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power down mode is terminated. The only exit from power down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. Program Memory Lock Bits On the chip are three lock bits which can be left un-programmed (U) or can be programmed (P) to obtain the additional features listed in the table below: When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value, and holds that value until reset is activated. It is necessary that the latched value of EA be in agreement with The current logic level at that pin in order for the device to function properly. Lock Bit Protection Modes Program Lock Bits Protection Type LB1 LB2 LB3 1 U No program lock features. 2 P U MOVC instructions executed from external program memory are disabled from fetching code

Bytes from internal memory, EA is sampled and latched on reset, and further programming of the Flash is disabled. 3 P U Same as mode 2, also verify is disabled. 4 P same as mode 3, also external execution is disabled. Programming the Flash The AT89S51 is normally shipped with the on-chip Flash memory array in the erased state (that is, contents = FFH) and ready to be programmed. The programming interface accepts either a high-voltage (12-volt) or a low-voltage (VCC) program enable signal. The low voltage programming mode provides a convenient way to program the AT89S51 inside the users system, while the highvoltage programming mode is compatible with conventional third party Flash or EPROM programmers. The AT89S51 is shipped with either the high-voltage or low-voltage programming mode enabled. The respective top-side marking and device signature codes are listed in the following table. The AT89S51 code memory array is programmed byte-by byte. In either programming mode. To program any nonblank byte in the on-chip Flash Memory, the entire memory must be erased using the Chip Erase Mode.

Programming Algorithm: Before programming the AT89S51, the address, data and control signals should be set up according to the Flash programming mode table and Figures 3 and 4. To program the AT89S51, take the following steps. 1. Input the desired memory location on the address lines. 2. Input the appropriate data byte on the data lines.

3. Activate the correct combination of control signals. 4. Raise EA/VPP to 12V for the high-voltage programming mode. 5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-write cycle is self-timed and typically takes no more than 1.5 Ms. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached. Data Polling: The AT89S51 features Data Polling to indicate the end of a write cycle. During a write cycle, an attempted read of the last byte written will result in the complement of the written datum on PO.7. Once the write cycle has been completed, true data are valid on all outputs, and the next cycle may begin. Data Polling may begin any time after a write cycle has been initiated. Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal. P3.4 is pulled low after ALE goes high during programming to indicate BUSY. P3.4 is pulled high again when programming is done to indicate READY.

Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed code data can be read back via the address and data lines for verification. The lock bits cannot be verified directly. Verification of the lock bits is achieved by observing that their features are enabled.

Chip Erase: The entire Flash array is erased electrically by using the proper combination of control signals and by holding ALE/PROG low for 10 ms. The code array is written with all 1s. The chip erase operation must be executed before the code memory can be re-programmed. Reading the Signature Bytes: The signature bytes are read by the same procedure as a normal verification of locations 030H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows. (030H) = 1EH indicates manufactured by Atmel (031H) = 51H indicates 89C51 (032H) = FFH indicates 12V programming (032H) = 05H indicates 5V programming Programming Interface Every code byte in the Flash array can be written and the entire array can be erased by using the appropriate combination of control signals. The write operation cycle is self timed and once initiated, will automatically time itself to completion. All major programming vendors offer worldwide support for the Atmel microcontroller series. Please contact your local programming vendor for the appropriate software revision. Flash Programming Modes Note: 1. Chip Erase requires a 10-ms PROG pulse.

SPECIAL FUNCTION REGISTER (SFR) ADDRESSES: ACC B PSW SP DPTR DPL DPH P0 P1 P2 P3 TMOD TCON TH0 TLO TH1 TL1 SCON SBUF PCON ACCUMULATOR B REGISTER PROGRAM STATUS WORD STACK POINTER DATA POINTER 2 BYTES LOW BYTE OF DPTR HIGH BYTE OF DPTR PORT0 PORT1 PORT2 PORT3 TIMER/COUNTER MODE CONTROL TIMER COUNTER CONTROL TIMER 0 HIGH BYTE TIMER 0 LOW BYTE TIMER 1 HIGH BYTE TIMER 1 LOW BYTE SERIAL CONTROL SERIAL DATA BUFFER POWER CONTROL 82H 83H 80H 90H 0A0H 0B0H 89H 88H 8CH 8AH 8DH 8BH 98H 99H 87H 0E0H 0F0H 0D0H 81H

TMOD (TIMER MODE) REGISTER

Both timers are the 89S51 share the one register TMOD. 4 LSB bit for the timer 0 and 4 MSB for the timer 1. In each case lower 2 bits set the mode of the timer Upper two bits set the operations. GATE: Gating control when set. Timer/counter is enabled only while the INTX pin is high and the TRx control pin is set. When cleared, the timer is enabled whenever the TRx control bit is set C/T: Timer or counter selected cleared for timer operation (input from internal system clock) M1 M0 M1 0 0 1 1 M0 0 1 0 1 Mode bit 1 Mode bit 0 MODE 0 1 2 3 OPERATING MODE 13 BIT TIMER/MODE 16 BIT TIMER MODE 8 BIT AUTO RELOAD SPLIT TIMER MODE

PSW (PROGRAM STATUS WORD)

CY AC

PSW.7 PSW.6

CARRY FLAG AUXILIARY CARRY

F0

PSW.5

AVAILABLE FOR THE USER FRO GENERAL REGISTER BANK SELECTOR BIT 1 REGISTER BANK SELECTOR BIT 0 OVERFLOW FLAG USER DEFINABLE BIT PARITY FLAG SET/CLEARED BY HARDWARE

PURPOSE RS1 PSW.4 RS0 PSW.3 0V -P PSW.2 PSW.1 PSW.0

PCON REGISATER (NON BIT ADDRESSABLE)

If the SMOD = 0 (DEFAULT ON RESET) TH1 = CRYSTAL FREQUENCY 256---____________________ 384 X BAUD RATE If the SMOD IS = 1 CRYSTAL FREQUENCY TH1 = 256-------------------------------------192 X BAUD RATE There are two ways to increase the baud rate of data transfer in the 8051 1. 2. To use a higher frequency crystal To change a bit in the PCON register

PCON register is an 8 bit register. Of the 8 bits, some are unused, and some are used for the power control capability of the 8051. The bit which is used for the

serial communication is D7, the SMOD bit. When the 8051 is powered up, D7 (SMOD BIT) OF PCON register is zero. We can set it to high by software and thereby double the baud rate BAUD RATE COMPARISION FOR SMOD = 0 AND SMOD =1 TH1 (DECIMAL) -3 -6 -12 -24 XTAL = 11.0592 MHZ IE (INTERRUPT ENABLE REGISTOR) FD FA F4 E8 HEX 9600 4800 2400 1200 SMOD =0 SMOD =1 19200 9600 4800 2400

EA

IE.7 Disable all interrupts if EA = 0, no interrupts is acknowledged If EA is 1, each interrupt source is individually enabled or disabled By sending or clearing its enable bit. IE.6 NOT implemented

ET2 IE.5 enables or disables timer 2 overflag in 89S51 only ES IE.4 Enables or disables all serial interrupt ET1 IE.3 Enables or Disables timer 1 overflow interrupt EX1 IE.2 Enables or disables external interrupt ET0 IE.1 Enables or Disables timer 0 interrupt. EX0 IE.0 Enables or Disables external interrupt 0 INTERRUPT PRIORITY REGISTER

If the bit is 0, the corresponding interrupt has a lower priority and if the bit is 1 the corresponding interrupt has a higher priority IP.7 NOT IMPLEMENTED, RESERVED FOR FUTURE USE. IP.6 NOT IMPLEMENTED, RESERVED FOR FUTURE USE PT2 IP.5 DEFINE THE TIMER 2 INTERRUPT PRIORITY LELVEL PS IP.4 DEFINES THE SERIAL PORT INTERRUPT PRIORITY LEVEL PT1 IP.3 DEFINES THE TIMER 1 INTERRUPT PRIORITY LEVEL PX1 IP.2 DEFINES EXTERNAL INTERRUPT 1 PRIORITY LEVEL PT0 IP.1 DEFINES THE TIMER 0 INTERRUPT PRIORITY LEVEL PX0 IP.0 DEFINES THE EXTERNAL INTERRUPT 0 PRIORITY LEVEL SCON: SERIAL PORT CONTROL REGISTER, BIT ADDRESSABLE SCON

SM0 : SM1 : SM2 : REN : TB8 :

SCON.7 Serial Port mode specified SCON.6 Serial Port mode specifier SCON.5 SCON.4 Set/cleared by the software to Enable/disable reception SCON.3 the 9th bit that will be transmitted in modes 2 and 3,

Set/cleared by software RB8: SCON.2 In modes 2 &3, is the 9th data bit that was received. In mode 1, If SM2 = 0, RB8 is the stop bit that was received. In mode 0 RB8 is not used T1: SCON.1 Transmit interrupt flag. Set by hardware at the end of the 8th bit time in mode 0, or at the beginning of the stop bit in the other Modes. Must be cleared by software

R1:

SCON.0 Receive interrupt flag. Set by hardware at the end of the 8th bit

time in mode 0, or halfway through the stop bit time in the other Modes must be cleared by the software. TCON : TIMER COUNTER CONTROL REGISTER Timer 1 overflows flag. Set by hardware when the Overflows. Cleared by hardware as processor Timer 1 run control bit. Set/cleared by software to turn Timer Counter 1 On/off. TF0 TCON.5 TR0 TCON.4 IE1 ITI IE0 IT0 TCON.3 TCON.2 TCON.1 TCON.0 Timer 0 overflows flag. Set by hardware when the Timer 0 run control bit. Set/cleared by software to turn timer Counter 0 on/off. External interrupt 1 edge flag Interrupt 1 type control bit External interrupt 0 edge Interrupt 0 type control bit. timer/counter 0. Overflow cleared by hardware as processor This is a bit addressable TF1 TCON.7 Timer/Counter 1 TR1 TCON.6

CHAPTER3. DTMF 8870/9170


The KT3170 is a complete Dual Tone Multiple Frequency (DTMF) receiver that is fabricated by low power CMOS and the Switched-Capacitor Filter technology. This LSI consists of band split filters, which seperates counting section which verifies the frequency and duration of the received tones before passing the corresponding code to the output bus.

It decodes all 16 DTMF tone pairs into a 4bits digital code. The externally required components are minimized by on chip provision of a differential input AMP, clock oscillator and latched three state interface. The on chip clock generator requires only a low cost TV cystal as an external component. FEATURES: Detects all 16 standard tones. Low power consumption : 15mW (Typ) Single power supply : 5V Uses inexpensive 3.58MHz crystal 67. Three state outputs for microprocessor interface Good quality and performance for using in exchange system Power down mode/input inhibit

18-DIP-300A

PIN CONFIGURATION 68.

OPERATING INNFORMATION:-

APPLICATIONS: PABX Central Office Paging Systems Remote Control Credit Card Systems Key Phone System Answering Phone Home Automation System Mobile Radio Remote Data Entry 69. PIN DESCRIPTION:-

70. ABSOLUTE MAXIMUM RATINGS:-

71.

ELECTRICAL CHARACTERSTICS:-

72. AC ELECTRICAL CHARACTERSTICS:-

73. Notes :1. Digit sequence consists of all 16 DTMF tones.

2. Tone duration = 40mS, Tone pause = 40mS. 3. Nominal DTMF frequencies are used. 4. Both tones in the composite signal have an equal Amplitude. 5. Tone pair is deviated by 1.5% 2Hz. 6. Bandwidth limited (3KHz) Gaussian Noise. 7. The precise dial tone frequencies are (350Hz and 440Hz) 2%. 8. For an error rate of better than 1 in 10000. 9. Referenced to lowest level frequency component in DTMF signal. 10. Minimum signal acceptance level is measured with specitied maximum frequency deviation. 11. This item also applies to a third tone injected onto the power supply. 12. Referenced to Fig. 1 Input DTMF tone level at 28dBm. 74. TEST CIRCUIT:-

75. TIMING DIAGRAM:-

76. DIGITAL OUTPUT:Outputs Q1-Q4 are CMOS push pull when enabled (EO = High) and open circuited (high impedance) when disabled by pulling EO = Low. These digital outputs provide the hexadecimal code corresponding to the DTMF signals. The table below describes the hexadecimal.

77. APPLICATION CIRCUITS:-

78.

79.

CHAPTER 4. DRIVER SECTION


It is a linear integrated circuit. It is a high voltage and current darlington transistor array. It is a driver IC. It is connected with Microcontroller IC 8051.whole program of 8051 IC is derived by ULN 2003. One port of 8051 IC provide input to ULN 2003 IC. The output of this is connected with equipments through relays. Relays are used for high voltage. It behaves like automatic switch to on of the equipments according to the 8051 IC command. 56. It is a 16 pin IC. It consists of seven npn darlington pairs that features high voltage outputswith common cathode clamp diode for switching inductive loads.Pins 1 to 7 are input pins and pins 10 to 16 are output pins. Pin no. 9 is common pin. Pin no. 8 is Enable pin. DESCRIPTION:The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It consists of seven NPN darlington pairs that features highvoltage outputs with common-cathode clamp diode for switching inductive loads. The collector-current rating of a single darlington pair is 500mA. The darlington pairs may be parrlleled for higher current capability. Applications include relay drivers, hammer drivers,lampdrivers,display drivers(LED gas discharge),line drivers, and logic buffers. The ULN2003 has a 2.7kW series base resistor for each darlington pair for operation directly with TTL or 5V CMOS devices. 57. FEATURES:* 500mA rated collector current(Single output) * High-voltage outputs: 50V * Inputs compatibale with various types of logic.

* Relay driver application.

SCHEMATIC(EACH DARLINGTON PAIR):-

58.

LOGICAL DIAGRAM:-

59.

60.

61.

62.

63.

64.

65.

CHAPTER 5. PCB & OTHER COMPONENTS

Overview of Printed Circuit Board


First of all let us consider a few basics in building electronic circuits on a printed circuit board. The board is made of a thin insulating material clad with a thin layer of conductive copper that is shaped in such a way as to form the necessary conductors between the various components of the circuit. The use of a properly designed printed circuit board is very desirable as it speed.

Construction up considerably and reduces the possibility of making errors. Smart Kit boards also come predrilled and with the outline of the components and their identification printed on the component side to make construction easier. To protect the board during storage from oxidation and assure it gets to you in perfect condition the copper is tinned during manufacturing and covered with a special varnish that protects it from getting oxidized and also makes soldering easier.

Soldering
The components to the board are the only way to build your circuit and from the way you do it depends greatly your success or failure. This work is not very difficult and if you stick to a few rules you should have no problems. The soldering iron that you use must be light and its power should not exceed the

25 Watts. The tip should be fine and must be kept clean at all times. For this purpose come very handy specially made sponges that are kept wet and from time to time you can wipe the hot tip on them to remove all the residues that tend to accumulate on it. DO NOT file or sandpaper a dirty or worn out tip. If the tip cannot be cleaned, replace it. There are many different types of solder in the market and you should choose a good quality one that contains the necessary flux in its core, to assure a perfect joint every time. DO NOT use soldering flux apart from that which is already included in your solder. Too much flux can cause many problems and is one of the main causes of circuit malfunction.

If nevertheless you have to use extra flux, as it is the case when you have to tin copper wires, clean it very thoroughly after you finish your work. In order to solder a component correctly you should do the following: 1.Clean the component leads with a small piece of emery paper. 2. Bend them at the correct distance from the components body and insert the component in its place on the board. 3. You may find sometimes a component with heavier gauge leads than usual, that are too thick to enter in the holes of the p.c. board. 4. In this case use a mini drill to enlarge the holes slightly. Do not make the holes too large as this is going to make soldering difficult afterwards.

5. Take the hot iron and place its tip on the component lead while holding the end of the solder wire at the point where the lead emerges from the board. The iron tip must touch the lead slightly above the p.c. board. 6. When the solder starts to melt and flow wait till it covers evenly the area around the hole and the flux boils and gets out from underneath the solder. The whole operation should not take more than 5 seconds. Remove the iron and allow the solder to cool naturally without blowing on it or moving the component. If everything was done properly the surface of the joint must have a bright metallic finish and its edges should be smoothly ended on the component lead and the board track. If the solder looks dull, cracked, or has the shape of a blob then you have made a dry joint and you should remove the solder (with a pump, or a solder wick) and redo it. 7. Take care not to overheat the tracks as it is very easy to lift them from the board and break them. 8. When you are soldering a sensitive component it is good practice to hold the lead from the component side of the board with a pair of long-nose pliers to divert any heat that could possibly damage the component. 9. Make sure that you do not use more solder than it is necessary as you are running the risk of short-circuiting adjacent tracks on the board, especially if they are very close together. 10. When you finish your work cut off the excess of the component leads and clean the board thoroughly with a suitable solvent to remove all flux residues that may still remain on it. 11. There are quite a few components in the circuit and you should be careful to avoid mistakes that will be difficult to trace and repair afterwards. Solder first the pins and the IC sockets and then following if that is possible the parts list the resistors the trimmers and the capacitors paying particular attention to the correct orientation of the electrolytic. 12. Solder then the transistors and the diodes taking care not to overheat them during soldering. The transducers should be positioned in such a way as they do not affect each other directly because this will reduce the efficiency of the circuit. When you finish soldering, check your work to make sure that you

have done everything properly, and then insert the ICs in their sockets paying attention to their correct orientation and handling IC3 with great care as it is of the CMOS type and can be damaged quite easily by static discharges. Do not take it out of its aluminium foil wrapper till it is time to insert it in its socket, ground the board and your body to discharge static electricity and then insert the IC carefully in its socket. In the kit you will find a LED and a resistor of 560 which will help you to make the necessary adjustments to the circuit. Connect the resistor in series with the LED and then connect them between point 9 of the circuit and the positive supply rail (point 1). Connect the power supply across points 1 (+) and 2 (-) of the p.c. board and put P1 at roughly its middle position. Turns then P2 slowly till the LED lights when you move your fingers slightly in front of the transducers. If you have a frequency counter then you can make a much more accurate adjustment of the circuit. Connect the frequency counter across the transducer and adjust P2 till the frequency of the oscillator is exactly the same as the resonant frequency of the transducer. Adjust then P1 for maximum sensitivity. Connecting together pins 7 & 8 on the p.c. board will make the circuit to stay triggered till it is manually reset after an alarm. This can be very useful if you want to know that there was an attempt to enter in the places which are protected by the radar.

TRANSISTOR
The name is transistor derived from transfer resistors indicating a solid state Semiconductor device. In addition to conductor and insulators, there is a third class of material that exhibits proportion of both. Under some conditions, it acts as an insulator, and under other conditions its a conductor. This phenomenon is called Semi-conducting and allows a variable control over electron flow. So, the transistor is semi conductor device used in electronics for amplitude. 81.

Transistor has three terminals, one is the collector, one is the base and other is the emitter, (each lead must be connected in the circuit correctly and only then the transistor will function). Electrons are emitted via one terminal and collected on another terminal, while the third terminal acts as a control element. Each transistor has a number marked on its body. Every number has its own specifications. There are mainly two types of transistor (i) NPN & (ii) PNP NPN Transistors:When a positive voltage is applied to the base, the transistor begins to conduct by allowing current to flow through the collector to emitter circuit. The relatively small current flowing through the base circuit causes a much greater current to pass through the emitter / collector circuit. The phenomenon is called current gain and it is measure in beta. 82.

PNP Transistor:It also does exactly same thing as above except that it has a negative voltage on its collector and a positive voltage on its emitter.

Transistor is a combination of semi-conductor elements allowing a controlled current flow. Germanium and Silicon is the two semi-conductor elements used for making it. There are two types of transistors such as POINT CONTACT and JUNCTION TRANSISTORS. Point contact construction is defective so is now out of use. Junction triode transistors are in many respects analogous to triode electron tube. A junction transistor can function as an amplifier or oscillator as can a triode tube, but has the additional advantage of long life, small size, ruggedness and absence of cathode heating power. 83. Junction transistors are of two types which manufacturing.The two types are: can be obtained while

1) PNP TYPE:-This is formed by joining a layer of P type of to an N-P Junction.

germanium

P TYPE: N type

2) NPN -This is formed by joining a layer of germanium to a P-N Junction.

Both types are shown in figure, with their symbols for representation. 84. The centre section is called the base, one of the outside sectionsthe emitter and the other outside section-the collector. The direction of the arrowhead gives the direction of the conventional current with the forward bias on the emitter. The conventional flow is opposite in direction to the electron flow. OPERATION OF PNP TRANSISTOR:A PNP transistor is made by sand witching two PN germanium or silicon diodes, placed back to back. The centre of N-type portion is extremely thin in comparison to P region. The P region of the left is connected to the positive terminal and N-region to the negative terminal i.e. PN is biased in the forward direction while P region of right is biased negatively i.e. in the reverse direction as shown in Fig. The P region in the forward biased circuit is called the emitter and P region on the right, biased negatively is called collector. The centre is called base. 85.

The majority carriers (holes) of P region (known as emitter) move to N region as they are repelled by the positive terminal of battery while the electrons of N region are attracted by the positive terminal. The holes overcome the barrier and cross the emitter junction into N region. As the width of base region is extremely thin, two to five percent of holes recombine with the free electrons of N-region

which result in a small base current while the remaining holes (95% to 98%) reach the collector junction. The collector is biased negatively and the negative collector voltage aids in sweeping the hole into collector region. As the P region at the right is biased negatively, a very small current should flow but the following facts are observed:1) A substantial current flows through it when the emitter junction is biased in a forward direction. 2) The current flowing across the collector is slightly less than that of the emitter. 3) The collector current is a function of emitter current i.e. with the decrease or increase in the emitter current a corresponding change in the collector current is observed.

The facts can be explained as follows:1. As already discussed that 2 to 5% of the holes are lost in recombination with the electron n base region, which result in a small base current and hence the collector current is slightly less than the emitter current. 2. 3. The collector current increases as the holes reaching the collector junction are attracted by negative potential applied to the collector. When the emitter current increases, most holes are injected into the base region, which is attracted by the negative potential of the collector and hence results in increasing the collector current. In this way emitter is analogous to the control of plate current by small grid voltage in a vacuum triode.

Hence we can say that when the emitter is forward biased and collector is negatively biased, a substantial current flows in both the circuits. Since a small emitter voltage of about 0.1 to 0.5 volts permits the flow of an appreciable emitter current the input power is very small. The collector voltage can be as high as 45 volts.

RESISTOR

Resistance is the opposition of a material to the current. It is measured in Ohms ( All conductors represent a certain amount of resistance, ). since no conductor is 100% efficient. To control the electron flow (current) in a predictable manner, we use resistors. Electronic circuits use calibrated lumped resistance to control the flow of current. Broadly speaking, resistor can be divided into two groups viz. fixed & adjustable (variable) resistors. In fixed resistors, the value is fixed & cannot be varied. In variable resistors, the resistance value can be varied by an adjuster knob. It can be divided into (a) Carbon composition (b) Wire wound (c) Special type. The most common type of resistors used in our projects is carbon type. The resistance value is normally indicated by colour bands. Each resistance has four colours, one of the band on either side will be gold or silver, this is called fourth band and indicates the tolerance, others three band will give the value of resistance (see table). For example if a resistor has the following marking on it say red, violet, gold. Comparing these coloured rings with the colour code, its value is 27000 ohms or 27 kilo ohms and its tolerance is 5%. Resistor comes in various sizes (Power rating). The bigger, the size, the more power rating of 1/4 watts. The four colour rings on its body tells us the value of resistor value as given below. COLOURS CODE

Black---------------------------------------------0 Brown--------------------------------------------1 Red-----------------------------------------------2 Orange-------------------------------------------3 Yellow-------------------------------------------4 Green---------------------------------------------5 Blue-----------------------------------------------6 Violet---------------------------------------------7 Grey----------------------------------------------8 White---------------------------------------------9

The first rings give the first digit. The second ring gives the second digit. The third ring indicates the number of zeroes to be placed after the digits. The fourth ring gives tolerance (gold 5%, silver 10%, No colour 20%). In variable resistors, we have the dial type of resistance boxes. There is a knob with a metal pointer. This presses over brass pieces placed along a circle with some space b/w each of them.

Resistance coils of different values are connected b/w the gaps. When the knob is rotated, the pointer also moves over the brass pieces. If a gap is skipped over, its resistance is included in the circuit. If two gaps are skipped over, the resistances of both together are included in the circuit and so on. A dial type of resistance box contains many dials depending upon the range, which it has to cover. If a resistance box has to read upto 10,0000, it will have three dials each having ten gaps i.e. ten resistance coils each of resistance 10. The third dial will have ten resistances each of 10000. The dial type of resistance boxes is better because the contact resistance in this case is small & constant.

TRANSFORMER PRINCIPLE OF THE TRANSFORMER:Two coils are wound over a Core such that they are magnetically coupled. The two coils are known as the primary and secondary windings. In a Transformer, an iron core is used. The coupling between the coils is source of making a path for the magnetic flux to link both the coils. A core as in fig.2 is used and the coils are wound on the limbs of the core. Because of high permeability of iron, the flux path for the flux is only in the iron and hence the flux links both windings. Hence there is very little leakage flux. This term leakage flux denotes the part of the flux, which does not link both the coils, i.e., when coupling is not perfect. In the high frequency transformers, ferrite core is used. The transformers may be step-up, step-down, frequency matching, sound output, amplifier driver etc. The basic principles of all the transformers are same.

MINIATURE TRANSFORMER

CONVENTIONAL POWER TRANSFORMER

TWO CRYSTALS (33.5MHZ, 11.5MHZ)


There are two crystals are used two give clock pulse to the Microcontroller 8051 and DTMF 9170. Crystal 11.5MHZ is used for Microcontroller 8051 and crytal 33.5MHZ is used for DTMF 9170.

HEAD PHONE
Head phone is used to connect the circuit with the phone because mobile is used to generate dual tone frequencies to operate DTMF IC.

BUZZER
Buzzer is used to alert the people about the fire.

CHAPTER 6. PROGRAMMING OF 8051

CODE OF GSM BASED HOME APLIANCE:#include<AT89X52.h> sbit dtmfin1=P1^0; sbit dtmfin2=P1^1; sbit dtmfin3=P1^2; sbit dtmfin4=P1^3; sbit relay1=P2^0; sbit relay2=P2^1; sbit relay3=P2^2; sbit relay4=P2^3; sbit relay5=P2^4;

sbit relay6=P2^5; bit dtmf1flag; bit dtmf2flag; bit dtmf3flag; bit dtmf4flag; bit dtmf5flag; bit dtmf6flag; bit dtmf7flag; bit flag1; bit flag2; bit flag3; bit flag4; bit flag5; bit flag6; void delay() { unsigned char i,j; for(i=0;i<80;i++) { for(j=0;j<120;j++) {} }} void dtmfout1chk() { if(dtmfin1==0 && dtmfin2==1 && dtmfin3==1 && dtmfin4==1) dtmf1flag=1; } void dtmfout2chk() { if(dtmfin1==1 && dtmfin2==0 && dtmfin3==1 && dtmfin4==1) dtmf2flag=1; } void dtmfout3chk() { if(dtmfin1==0 && dtmfin2==0 && dtmfin3==1 && dtmfin4==1) dtmf3flag=1; } void dtmfout4chk() { if(dtmfin1==1 && dtmfin2==1 && dtmfin3==0 && dtmfin4==1)

dtmf4flag=1; } void dtmfout5chk() { if(dtmfin1==0 && dtmfin2==1 && dtmfin3==0 && dtmfin4==1) { dtmf5flag=1; }} void dtmfout6chk() { if(dtmfin1==1 && dtmfin2==0 && dtmfin3==0 && dtmfin4==1) { dtmf6flag=1; }} /**********STARTING OF THE DTMF ENCODER PROJECT********************************/ void main() { dtmfin1=1; dtmfin2=1; dtmfin3=1; dtmfin4=1; relay1=0; relay2=0; relay3=0; relay4=0; relay5=0; relay6=0; flag1=1; flag2=1; flag3=1; flag4=1; flag5=1; flag6=1; /************STARTING OF THE MAIN LOOP**********************************************/ while(1) { dtmfout1chk(); delay();

dtmfout2chk(); delay(); dtmfout3chk(); delay(); dtmfout4chk(); delay(); dtmfout5chk(); delay(); dtmfout6chk(); delay(); //***************************************************************** ************************ if(dtmf1flag) { dtmf1flag=0; if(flag1) { dtmf1count++; if(dtmf1count==1) { flag1=0; flag2=1; flag3=1; flag4=1; flag5=1; flag6=1; relay1=1; } if(dtmf1count==2) { flag1=0; flag2=1; flag3=1; flag4=1; flag5=1; flag6=1; dtmf1count=0; relay1=0; } }}

//***************************************************************** ***************** if(dtmf2flag) { dtmf2flag=0; if(flag2) { dtmf2count++; if(dtmf2count==1) { flag1=1; flag2=0; flag3=1; flag4=1; flag5=1; flag6=1; relay2=1; } if(dtmf2count==2) { flag1=1; flag2=0; flag3=1; flag4=1; flag5=1; flag6=1; dtmf2count=0; relay2=0; } }} //***************************************************************** ******************* if(dtmf3flag) { dtmf3flag=0; if(flag3) { dtmf3count++; if(dtmf3count==1) {

flag1=1; flag2=1; flag3=0; flag4=1; flag5=1; flag6=1; relay3=1; } if(dtmf3count==2) { flag1=1; flag2=1; flag3=0; flag4=1; flag5=1; flag6=1; dtmf3count=0; relay3=0; } }} //***************************************************************** ************************ if(dtmf4flag) { dtmf4flag=0; if(flag4) { dtmf4count++; if(dtmf4count==1) { flag1=1; flag2=1; flag3=1; flag4=0; flag5=1; flag6=1; relay4=1; } if(dtmf4count==2)

{ flag1=1; flag2=1; flag3=1; flag4=0; flag5=1; flag6=1; dtmf4count=0; relay4=0; } }} //***************************************************************** ****************** if(dtmf5flag) { dtmf5flag=0; if(flag5) { dtmf5count++; if(dtmf5count==1) { flag1=1; flag2=1; flag3=1; flag4=1; flag5=0; flag6=1; relay5=1; } if(dtmf5count==2) { flag1=1; flag2=1; flag3=1; flag4=1; flag5=0; flag6=1; dtmf5count=0; relay5=0; }

}} //***************************************************************** ***************** if(dtmf6flag) { dtmf6flag=0; if(flag6) { dtmf6count++; if(dtmf6count==1) { flag1=1; flag2=1; flag3=1; flag4=1; flag5=1; flag6=0; } if(dtmf6count==2) { flag1=1; flag2=1; flag3=1; flag4=1; flag5=1; flag6=0; dtmf6count=0; relay6=0; } }} //***************************************************************** ******************** }}

You might also like