Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Project report on bidirectional visitor counter & home automation

24,203 views

Published on

Project Report On Bi-Directional Visitor Counter & Home Automation

Published in: Engineering
  • Be the first to comment

Project report on bidirectional visitor counter & home automation

  1. 1. Roshan Mani-GCET Bikaner 1 A Project Report on ‘BI-DIRECTIONAL VISITOR COUNTER & HOME AUTOMATION’ Submitted to Rajasthan Technical University, Kota In Partial Fulfillment of the requirement for the award of the degree of Bachelor of Technology In “Electronics & Communication Engineering” Session: 2014-2015 SUBMITTED BY: GUIDED BY: Roshan Mani(11ECTEC047) Ms. Neelam Swami Rahul Purohit(11ECTEC040) Assistant Professor Chhavi Sharma(11ECTEC012) (Department of Electronics & Harshita Gupta(11ECTEC020) Communication Engineering) GOVERNMENT COLLEGE OF ENGINEERING & TECHNOLOGY BIKANER
  2. 2. Roshan Mani-GCET Bikaner 2 GOVERNMENT COLLEGE OF ENGINEERING & TECHNOLOGY BIKANER Session 2014-2015 CERTIFICATE This is to certify that the project entitled “BI-DIRECTIONAL VISITOR COUNTER & HOME AUTOMATION” has been submitted to the Rajasthan Technical University, Kota for fulfillment of the requirement for the award of the degree of Bachelor of Technology in “Electronics & Communication Engineering” by following student of final year B.Tech. (Electronics & Communication Engineering). Roshan Mani(11ECTEC047) Rahul Purohit(11ECTEC040) Chhavi Sharma(11ECTEC12) Harshita Gupta(11ECTEC020) Guide: Mr. Arvind Sirvee (Ms. Neelam Swami) (H.O.D.,E.C.E. Deptt.)
  3. 3. Roshan Mani-GCET Bikaner iii ACKNOWLEDGEMENT We are deeply thankful to “CMC Academy” as it has given us golden opportunities to go through remarkable training on “Embedded System”. Here we have got valuable and detailed knowledge on real time Projects. We owe our gratitude to our Faculty cum Trainer “Mr. Vishwesh Kumar Sharma” for his unmatched support, guidance and inspiration without which we would not have learned so many new & innovative things in such a short span of time. We would also like to thank our Department i.e., Department of Electronics & Communication Engineering of our College especially our H.O.D. “Mr. Arvind Sirvee” and all our teachers who have suggested us to join this beneficial summer training. Our special thanks goes to “Ms. Neelam Swami” without whose support we would not have completed this Project Report on time in such a good way. We are highly obliged that we have received all of yours support whenever we needed. Place:Bikaner Submitted by: Date:08th of January, 2015 Roshan Mani(11ECTEC047) Rahul Purohit(11ECTEC040) Chhavi Sharma(11ECTEC012) Harshita Gupta(11ECTEC020)
  4. 4. Roshan Mani-GCET Bikaner iv ABSTRACT Title: Bi-Directional Visitor Counter & Home Automation Objective: The objective of this project is to make a Microcontroller based model to count number of persons visiting particular room and accordingly light up the room. Materials & Method: The Project “Bi-directional Visitor Counter and Home Automation” is made using Microcontroller AT89S52 that takes over the task of controlling the room lights as well as counting number of persons/ visitors in the room very accurately. The model will receive the signals from the sensors, and this signal will be operated under the control of software which is stored in ROM. Results: This Project is a real-life model which have the ability to perform the task of counting in both direction. Not only it will increase it’s counter when any person will enter the house but also when any person leaves the house, counter’s value reduce considerably. Conclusion: In today’s world, there is a continuous need for automatic appliances with the increase in standard of living, there is a sense of urgency for developing circuits that would ease the complexity of life. Also if at all one wants to know the number of people present in room so as not to have congestion, this circuit prove to be helpful.
  5. 5. Roshan Mani-GCET Bikaner v TABLE OF CONTENTS S.No. Topic Page No. Certificate ii Acknowledgement Iii Abstract Iv List of Figures vi-vii 1. Project Overview 1 2. Circuit Components 2 2.1 Resistor 3 2.2 Diode 4 2.3 Potentiometer 4 2.4 Electrolytic Capacitor 5 2.5 Ceramic Capacitor 5 2.6 11.0592 MHz Crystal Oscillator 6 2.7 AT89C51 7 2.7.1 Description 7 2.7.2 AT89S52 Pin Description 8-14 2.8 78XX IC 15 2.8.1 7805 IC 15 2.8.2 7812 IC Voltage Regulator Circuit 15 2.9 LED 16 2.10 Relay 17 2.11 ULN2803 Relay Driver IC 17-19 2.12 LM324 IC (OP-AMP) 19-20 2.13 IR LED Tx & Rx 20
  6. 6. Roshan Mani-GCET Bikaner vi 2.14 Transformer 20-21 2.15 7-Segment Display 21-22 3. Circuit Design 23 4. Operation 23-24 5. Software 25-26 6. Applications 27 7. Limitations 27 8. Advantages 27 Conclusion 27 References 28 List of Figures 1. Block Diagram 1 2. Circuit Diagram 2 3. Resistor Color Coding 3 4. Diode 4 5. Potentiometer 4 6. Electrolytic Capacitor 5 7. Ceramic Capacitor 5 8. 11.0592 MHz Crystal Oscillator 6 9. Crystal oscillator Schematic 6 10. AT89C51 7 11. Pin Diagram & Architecture of AT89C51 8 12. ROM & RAM in 8051 Microcontroller 11
  7. 7. Roshan Mani-GCET Bikaner vii 13. Some 8-bit registers & some 16-bit registers 13 14. AT89S52 14 15. AT89S52 Pin Description 15 16. 12V regulated power supply using 7812 16 17. LED 16 18. Relay Description 17 19. Relay 17 20. ULN2 803 18 21. Darlington Pair 18 22. LM324 IC 19 23. Line of Sight Tx-Rx Circuit 20 24. Transformer 21 25. Common Anode & Common Cathode 7-Segment Display 22 26. 0 to 9 on 7-Segment Display 22 27. Hex-Code of 0 to 9 22 28. Layout of Bidirectional Visitor Counter 23 29. Flow-Chart 24 30. Working Model 25
  8. 8. Roshan Mani-GCET Bikaner 1 1) PROJECT OVERVIEW: This Project “Bi-directional Visitor Counter and Home Automation” using Microcontroller is a reliable circuit that takes over the task of controlling the room lights as well as counting number of persons/ visitors in the room very accurately. When somebody enters into the room then the counter is incremented by one and the light in the room will be switched ON and when any one leaves the room then the counter is decremented by one. The light will be only switched OFF until all the persons in the room go out. The total number of persons inside the room is also displayed on the seven segment displays. The microcontroller does the above job. It receives the signals from the sensors, and this signal is operated under the control of software which is stored in ROM. Microcontroller AT89S52 continuously monitor the Infrared Receivers, When any object pass through the IR Receiver’s then the IR Rays falling on the receiver are obstructed , this obstruction is sensed by the Microcontroller. Fig. 1 Block Diagram
  9. 9. Roshan Mani-GCET Bikaner 2 Fig. 2 Circuit Diagram 2) Circuit Components:  5 Resistor of 330 ohms  Diode  2 Variable Resistor of 20 Kohms  2 Variable Resistor of 50Kohms  2 Electrolytic Capacitor  4 Ceramic Capacitor 104  2 Ceramic Capacitor 33 pF  11.0592 MHz crystal Oscillator  AT89S52  7805  7812  3 LED
  10. 10. Roshan Mani-GCET Bikaner 3  Reset Key  2 Relay  ULN2803 Relay Driver IC  LM324 IC  IR LED  IR Phototransistor  Transformer  7 segment Display 2.1)RESISTOR: Resisitors restrict the flow of electric current, for example a resistor is placed in series with a light emitting diode(LED) to limit the current passing through the LED. Fig. 3 Resistor Color Coding
  11. 11. Roshan Mani-GCET Bikaner 4 2.2)Diode:. A diode is a specialized electronic component with two electrodes called the anode and the cathode. Most diodes are made with semiconductor materials such as silicon, germanium, or selenium Fig. 4 Diode 2.3)Potentiometer: A potentiometer informally a pot, is a three-terminal resistor with a sliding or rotating contact that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a variable resistor or rheostat. Fig. 5 Potentiometer
  12. 12. Roshan Mani-GCET Bikaner 5 2.4)Electrolytic Capacitor: An electrolytic capacitor is a capacitor in which one electrode is made of a special metal on which an oxide layer is formed. This thin oxide layer acts as the dielectric of the capacitor. An electrolyte covers the surface of the oxide layer and serves as the second electrode of the capacitor. Fig. 6 Electrolytic Capacitors 2.5)Ceramic Capacitor: A ceramic capacitor is a fixed value capacitor in which ceramic material acts as the dielectric. It is constructed of two or more alternating layers of ceramic and a metal layer acting as the electrodes. The composition of the ceramic material defines the electrical behavior and therefore applications. Fig.7 Ceramic Capacitor
  13. 13. Roshan Mani-GCET Bikaner 6 2.6)11.0592MHz Crystal Oscillator: It provide clock pulses of 11.0592 Mhz frequency. It is a common clock for Intel 8051 microprocessors It uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time, to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits incorporating them became known as crystal oscillators. The crystal oscillator circuit sustains oscillation by taking a voltage signal from the quartz resonator, amplifying it, and feeding it back to the resonator. The rate of expansion and contraction of the quartz is the resonant frequency, and is determined by the cut and size of the crystal. When the energy of the generated output frequencies matches the losses in the circuit, an oscillation can be sustained. Fig.8 11.592 MHZ Oscillator Fig.9 Crystal Oscillator Schematic
  14. 14. Roshan Mani-GCET Bikaner 7 2.7)AT89C51: Fig. 10 AT89C51 2.7.1)Description: The AT89C51 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 Atmel’s high density nonvolatile memory technology and is compatible with the industry standard MCS-51™ instruction set and pinout. 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 AT89C51 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications.
  15. 15. Roshan Mani-GCET Bikaner 8 Fig. 11 Pin Diagram and Architecture of AT89C51 2.7.2) 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
  16. 16. Roshan Mani-GCET Bikaner 9 pull ups. Port 1 also receives the low-order address bytes 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 use 16-bit addresses (MOVX @DPTR). In this application it uses strong internal pull ups when emitting 1s. During accesses to external data memory that use 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 AT89C51 as listed below: 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) 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
  17. 17. Roshan Mani-GCET Bikaner 10 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 microcontroller is in external execution mode. PSEN Program Store Enable is the read strobe to external program memory. When the AT89C51 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. MEMORY SPACE ALLOCATION: The 8051 has three very general types of memory. To effectively program the 8051 it is necessary to have a basic understanding of these memory types. The memory types are illustrated in the following graphic. They are: On-Chip Memory, External Code Memory, and External RAM. Onchip ROM The 89C51 has a 4K bytes of on-chip ROM. This 4K bytes ROM memory has memory addresses of 0000 to 0FFFh. Program addresses higher than 0FFFh, which exceed the internal ROM capacity will cause the microcontroller to automatically fetch code bytes from external memory. Code bytes can also be fetched exclusively from an external memory, addresses 0000h to FFFFh, by connecting the external access pin to ground. The program counter doesn’t care where the code is: the circuit designer decides whether the code is found totally in internal ROM, totally in external ROM or in a combination of internal and external ROM.
  18. 18. Roshan Mani-GCET Bikaner 11 Onchip RAM The 1289 bytes of RAM inside the 8051 are assigned addresses 00 to 7Fh. These 128 bytes can be divided into three different groups as follows: A total of 32 bytes from locations 00 to 1Fh are set aside for register banks and the stack. A total of 16 bytes from locations 20h to 2Fh are set aside for bit addressable read/write memory and instructions. A total of 80 bytes from locations 30h to 7Fh are used for read and write storage, or what is normally called a scratch pad. These 80 locations of RAM are widely used for the purpose of storing data and parameters by 8051 programmers. Fig. 12 ROM & RAM in 8051 Microcontroller External Code Memory : External Code Memory is code (or program) memory that resides off-chip. This is often in the form of an external EPROM. External RAM : External RAM is RAM memory that resides off-chip. This is often in the form of standard static RAM or flash refers to any memory (Code, RAM, or other) that
  19. 19. Roshan Mani-GCET Bikaner 12 physically exists on the microcontroller itself. On-chip memory can be of several types, but we'll get into that shortly. External RAM As an obvious opposite of Internal RAM, the 8051 also supports what is called External RAM. As the name suggests, External RAM is any random access memory which is found off-chip. Since the memory is off-chip it is not as flexible in terms of accessing, and is also slower. For example, to increment an Internal RAM location by 1 requires only 1 instruction and 1 instruction cycle. To increment a 1-byte value stored in External RAM requires 4 instructions and 7 instruction cycles. In this case, external memory is 7 times slower! Code Memory : Code memory is the memory that holds the actual 8051 program that is to be run. This memory is limited to 64K and comes in many shapes and sizes: Code memory may be found on-chip, either burned into the microcontroller as ROM or EPROM. Code may also be stored completely off-chip in an external ROM or, more commonly, an external EPROM. Flash RAM is also another popular method of storing a program. Various combinations of these memory types may also be used-- that is to say, it is possible to have 4K of code memory on-chip and 64k of code memory off-chip in an EPROM. Registers: In the CPU, registers are used to store information temporarily. That information could be a byte of data to be processed, or an address pointing to the data to be fetched. In the 8051 there us only one data type: 8 bits. With an 8- bit data type, any data larger than 8 bits has to be broken into 8-bit chunks before it is processed. The most commonly used registers of the 8051 are A(accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer) and PC (program counter). All the above registers are 8-bit registers except DPTR and the program counter. The accumulator A is used for all arithmetic and logic instructions.
  20. 20. Roshan Mani-GCET Bikaner 13 Fig. 13 Some 8-bit registers & some 16-bit registers Program Counter and Data Pointer The program counter is a 16- bit register and it points to the address of the next instruction to be executed. As the CPU fetches op-code from the program ROM, the program counter is incremented to point to the next instruction. Since the PC is 16 bit wide, it can access program addresses 0000 to FFFFH, a total of 64K bytes of code. However, not all the members of the 8051 have the entire 64K bytes of on-chip ROM installed. The DPTR register is made up of two 8-bit registers, DPH and DPL, which are used to furnish memory addresses for internal and external data access. The DPTR is under the control of program instructions and can be specified by its name, DPTR. DPTR does not have a single internal address, DPH and DPL are assigned an address each. Flag bits and the PSW Register Like any other microprocessor, the 8051 have a flag register to indicate arithmetic conditions such as the carry bit. The flag register in the 8051 is called the program status word (PSW) register. The program status word (PSW) register is an 8-bit register. It is also referred as the flag register. Although the PSW register is 8-bit wide, only 6 bits of it are used by the microcontroller. The two unused bits are user definable flags. Four of the flags are conditional flags, meaning they indicate some conditions that resulted after an instruction was executed. These four are CY (carry), AC (auxiliary carry), P (parity), and OV (overflow). The bits of the PSW register are shown below: CY PSW.7 Carry flag AC PSW.6 Auxiliary carry flag -- PSW.5 Available to the user for general purpose RS1 PSW.6 Register bank selector bit 1 RS0 PSW.3 Register bank selector bit 0
  21. 21. Roshan Mani-GCET Bikaner 14 OV PSW.2 Overflow flag F0 PSW.1 User definable bit P PSW.0 Parity flag CY, the carry flag This flag is set whenever there is a carry out from the d7 bit. This flag bit is affected after an 8-bit addition or subtraction. It can also be set to 1 or 0 directly by an instruction such as “SETB C” and “CLR C” where “SETB C” stands for set bit carry and “CLR C” for clear carry. AC, the auxiliary carry flag If there is carry from D3 to D4 during an ADD or SUB operation, this bit is set: otherwise cleared. This flag is used by instructions that perform BCD arithmetic. P, the parity flag The parity flag reflects the number of 1s in the accumulator register only. If the register A contains an odd number of 1s, then P=1. Therefore, P=0 if Ahas an even number of 1s. OV, the overflow flag This flag is set whenever the result of a signed number operation is too large, causing the high order bit to overflow into the sign bit. In general the carry flags is used to detect errors in unsigned arithmetic operations Fig.14 AT89S52
  22. 22. Roshan Mani-GCET Bikaner 15 Fig.15 AT89S52 Pin Description 2.8)78XX The 78xx (sometimes L78xx, LM78xx, MC78xx...) is a family of self-contained fixed linear voltage regulator integrated circuits. The 78xx family is commonly used in electronic circuits requiring a regulated power supply due to their ease-of- use and low cost. For ICs within the family, the xx is replaced with two digits, indicating the output voltage (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx line are positive voltage regulators: they produce a voltage that is positive relative to a common ground. There is a related line of 79xx devices which are complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to provide positive and negative supply voltages in the same circuit. IC 7805 (Voltage Regulator IC) 7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.
  23. 23. Roshan Mani-GCET Bikaner 16 Pin Description: Fig.16 12V Regulated Power Supply Using 7812 2.9)LED A light-emitting diode (LED) is a two-lead semiconductor light source. It is a basic pn-junction diode, which emits light when activated.When a suitable voltage is applied to the leads, electrons are able to recombine with electron holes within the device, releasing energy in the form of photons. This effect is called electroluminescence, and the color of the light (corresponding to the energy of the photon) is determined by the energy band gap of the semiconductor. Fig.17 LED Pin No Function Name 1 Input voltage (5V-18V) Input 2 Ground (0V) Ground 3 Regulated output; 5V (4.8V-5.2V) Output
  24. 24. Roshan Mani-GCET Bikaner 17 2.10)Relay A relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a switch, but other operating principles are also used, such as solid-state relays. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal. Fig18. Relay description Fig.19 Relay 2.11)ULN2803 IC ULN2803 consists of octal high voltage, high current darlington transistor arrays. The eight NPN Darlington connected transistors in this family of arrays are ideally suited for interfacing between low logic level digital circuitry (such as TTL, CMOS or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays, printer hammers or other similar loads for a broad range of computer, industrial, and consumer applications.
  25. 25. Roshan Mani-GCET Bikaner 18 Fig.20 ULN2803 The ULN 2803 IC consists of eight NPN Darlington connected transistors (often called a Darlington pair). Darlington pair consists of two bipolar transistors such that the current amplified by the first is amplified further by the second to get a high current gain β or hFE. The figure shown below is one of the eight Darlington pairs of ULN 2803 IC. Fig.21 Darlington Pair Now 2 cases arise:- Case 1: When IN is 0 volts. Q1 and Q2 both will not conduct as there is no base current provided to them. Thus, nothing will appear at the output (OUT). Case 2: When IN is 5 volts.
  26. 26. Roshan Mani-GCET Bikaner 19 Input current will increase and both transistors Q1 and Q2 will begin to conduct. Now, input current of Q2 is combination of input current and emitter current of Q1, so Q2 will conduct more than Q1 resulting in higher current gain which is very much required to meet the higher current requirements of devices like motors, relays etc. Output current flows through Q2 providing a path (sink) to ground for the external circuit that the output is applied to. Thus, when a 5V input is applied to any of the input pins (1 to 8), output voltage at corresponding output pin (11 to 18) drops down to zero providing GND for the external circuit. Thus, the external circuit gets grounded at one end while it is provided +Vcc at its other end. So, the circuit gets completed and starts operating. 2.12)LM324 IC: It is a 14pin IC consisting of four independent operational amplifiers (op-amps) compensated in a single package. Op-amps are high gain electronic voltage amplifier with differential input and, usually, a single-ended output. The output voltage is many times higher than the voltage difference between input terminals of an op-amp. These op-amps are operated by a single power supply LM324 and need for a dual supply is eliminated. They can be used as amplifiers, comparators, oscillators, rectifiers etc. The conventional op-amp applications can be more easily implemented with LM324. Fig.22 LM 324 IC Pin Description: Pin No Function Name 1 Output of 1st comparator Output 1 2 Inverting input of 1st comparator Input 1- 3 Non-inverting input of 1st comparator Input 1+ 4 Supply voltage; 5V (up to 32V) Vcc 5 Non-inverting input of 2nd comparator Input 2+
  27. 27. Roshan Mani-GCET Bikaner 20 6 Inverting input of 2nd comparator Input 2- 7 Output of 2nd comparator Output 2 8 Output of 3rd comparator Output 3 9 Inverting input of 3rd comparator Input 3- 10 Non-inverting input of 3rd comparator Input 3+ 11 Ground (0V) Ground 12 Non-inverting input of 4th comparator Input 4+ 13 Inverting input of 4th comparator Input 4- 14 Output of 4th comparator Output 4 Pin Description of LM 324 IC 2.13)IR LED TRANSMITTER & RECEIVER An IR LED, also known as IR transmitter, is a special purpose LED that transmits infrared rays in the range of 760 nm wavelength. Such LEDs are usually made of gallium arsenide or aluminium gallium arsenide. They, along with IR receivers, are commonly used as sensors. The appearance is same as a common LED. Since the human eye cannot see the infrared radiations, it is not possible for a person to identify whether the IR LED is working or not, unlike a common LED. To overcome this problem, the camera on a cellphone can be used. The camera can show us the IR rays being emanated from the IR LED in a circuit. Fig.23 Line of Sight Tx & Rx 2.14)Transformer Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. The two types of transformers
  28. 28. Roshan Mani-GCET Bikaner 21 Step-up transformers increase voltage, Step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils, instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage. Fig.24 Transformer 2.15)7-Segment Display The LTS 542 is a 0.52 inch digit height single digit seven-segment display. This device utilizes Hi-eff. Red LED chips, which are made from GaAsP on GaP substrate, and has a red face. Features: • Common Anode • 0.52 Inch Digit Height • Continuous Uniform Segments • Low power Requirement • Excellent Characters Appearance • High Brightness & High Contrast • Wide Viewing Angle
  29. 29. Roshan Mani-GCET Bikaner 22 Fig.25 Common Cathode & Common Anode 7-Segment Display Fig.26 0 to 9 on 7-Segment Display Fig.29 Hex Code of 0 to 9
  30. 30. Roshan Mani-GCET Bikaner 23 3) Circuit Design: The heart of the circuit design lies in designing the microcontroller interface. Here we use the microcontroller AT89S52. The microcontroller AT89S52 is interfaced to the IR sensor pairs at two ports pins – P1.0 and P1.1 respectively. The 7 segment display is interfaced to the microcontroller at port P2.Another important aspect of the design involves designing the oscillator circuit and the reset circuit. The oscillator circuit is designed by selecting a 11.0592MHz quartz crystal and two ceramic capacitors-each 33pF. The reset circuit is designed by selecting an electrolyte capacitor of 10uF to ensure a reset pulse width of 100ms and reset pin voltage drop of 1.2V.The sensor circuit is designed by selecting appropriate value of resistors for both the LED and the phototransistor. Fig.28 Layout of Bidirectional Visitor Counter & Home Automation 4) Operation: When the system is powered, the compiler initially initializes the stack pointer and all other variables. It then scans the input ports (PortP1.0 first). In the meantime, when there is no interruption between the IR LED and the phototransistor of the first sensor pair, the output of the phototransistor is always at low voltage. In other words port P1.0 is at logic low level. Now when a transition takes place, i.e. a logic high level is received at port P1.0, the compiler sees this as an interruption to sense the passage of a person or an object between the IR LED and the
  31. 31. Roshan Mani-GCET Bikaner 24 phototransistor. As per the program, the count value is increased and this value is displayed on the Counter. Now the compiler starts scanning the other input pin- P1.1. Similar to the first sensor pair, for this sensor pair also the phototransistor conducts in absence of any interruption and P1.1 is at logic low level. In case of an interruption, the pin P1.1 goes high and this interruption is perceived by decreasing the value of count.The program ensures that the scanning of both the port pins is done at certain delays so as to avoid confusion of reading. For instance port P1.0 is scanned for two or three interruptions so as to ensure the count value is above 1 or 2. 5) Flow Chart Fig.29 Flow Chart
  32. 32. Roshan Mani-GCET Bikaner 25 Fig.30 Working Model 5)Software: #include<reg51.h> #define seg P2 sbit s1=P1^0; sbit s2=P1^1; sbit r1=P1^2; sbit r2=P1^3; unsigned char a[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
  33. 33. Roshan Mani-GCET Bikaner 26 void main() { unsigned char z; seg=a[0]; r1=r2=0; while(1) while(s1==1 && s2==0); while(s1==1 && s2==1); while(s1==0 && s2==1); z--; } seg=a[z]; if(z<=5) { r1=1;r2=0; } else if(z<=9) {
  34. 34. Roshan Mani-GCET Bikaner 27 6) Applications: 1. This circuit can be used domestically to get an indication of number of persons entering a party. 2. It can be used at official meetings. 3. It can be used at homes and other places to keep a check on the number of persons entering a secured place. 4. It can also be used as home automation system to ensure energy saving by switching on the loads and fans only when needed. 7) Limitations: 1. It is a theoretical circuit and may require few changes in practical implementation. 2. It is a low range circuit and cannot be implemented at large areas. 3. More than one candidate should not enter or exit the room. If it happens it will count it as a single person. 4. With frequent change in the count value, after a certain time the output may look confusing 5. In this Module we are using a room having capacity of 9 candidates. So we are using only one segment that can show from 0 to 9 only. For a large room we will use a no. of segments. For example for 9999 candidate we will use 4 segments. 8)Advantages: 1. The Most advantage is that it will help to save electricity. When no one is there in room the appliances will be off. 2.For School/colleges/companies it will help to check if somebody is there in the zone or not. If the data on display unit is zero the peons or security guards can shut the gate easily. 3.Whole system will work automatically so it reduces the human work. Conclusion In our project We have designed and implemented a Bi-Directional Counter & Home Automation using the concept of Embedded System. The target users of the project can be any one right from a common man to any organization. Lets say if any one uses our project for Seminar Purpose then the track record of the persons attending the seminar will give the exact idea about the no. of candidate attending and leaving the seminar and accordingly the Project Model will control the Electronics Gadget of the Seminar Hall. In making this project We all team mates have to really give our best and it was all possible due to unmatched guidelines of our mentor “Ms Neelam Swami”. We will be highly obliged to you for this kind support.
  35. 35. Roshan Mani-GCET Bikaner 28 Bibliography Reference Site: 1.www.google.co.in 2.www.wikipedia.com 3.www.cmcjaipur.com 4.www.electronicsforyou.com 5.www.encyclpedia.com Reference Books: 1.E BALAGURUSAMY, “Programming in ANSI C”, Tata McGraw Hill, May 2010. 2.MUHAMMAD ALI, MAZID JANICE, GILLISPIE MAZIDI, “The 8051microcontroller and embedded systems”, Pearson Education, April 2009.

×