You are on page 1of 75

Passive keyless lock

MAJOR PROJECT REPORT ON

PASSIVE KEYLESS LOCK


SUBMITTED TO PUNJAB TECHNICAL UNIVERSITY IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE AWARD OF THE DEGREE OF

BACHELOR OF TECHNOLOGY In ELECTRONICS & COMMUNICATION ENGINEERING


SUBMITTED BY: PRITIKA BHATT RAJWANT KAUR SHEENU RANA SUKHMANI BAJWA 81008108079 81008108082 81008108086 81008108091

GUIDED BY: Er. PARDEEP KAUR Er. PRIYA

DEPTT. OF ELECTRONICS & COMMUNICATION ENGINEERING DOABA WOMEN INSTITUTE OF ENGINEERING & TECHNOLOGY KHARAR 2008-2012

Passive keyless lock

Candidates Declaration
We hereby declare that the major project which is presented in this report entitled Passive Keyless Lock submitted in the partial fulfillment of the requirements for the award of the degree of Bachelor of Technology in ECE to the PTU, Jalandhar, is an authentic record of our own work carried out at DWIET campus. The material embodied in this project work has not been submitted to any other university or institute for the award of any degree. PRITIKA BHATT RAJWANT KAUR SHEENU RANA SUKHMANI BAJWA Place: Date:

This is to certify that above statement made by the candidate(s) is correct to the best of my knowledge. Guided by: Er. Pardeep Kaur Er. Priya Department of ECE Approved by: HOD (ECE) DWIET

Passive keyless lock

Acknowledgement
Technology is like an ocean & engineer is like a pearl driver in search of a treasure beneath the sea. Today technology is very vast and there is no end of technical studies. We are submitting our report on the project entitled Passive Keyless Lock. We are very thankful to all the persons who with their views and participation helped us to carry this project and report successfully. It is with pleasure that we find ourselves penning down these lines to express my sincere thanks to various people to help me along the way in completing the project. With deep sense of gratitude, we express our sincere thanks to Ms. Pardeep Kaur for her precious guidance and for taking extra pain to seek through our problems. We are also thankful to Er. Parminder Singh, Er. Priya, Er. Karamjit Kaur. They were always a pillar of strength to infuse encouragement during our disheartening failures. I thank all my friends who helped me readily and most gladly as when requires.

Pritika Bhatt Rajwant Kaur Sheenu Rana Sukhmani Bajwa

Passive keyless lock

Abstract
Though now-a-days, radar finds its application in many fields, the basic radar was used to detect the presence of target, its distance, location and velocity if moving. Radar can detect the target even in conditions like rain, snow, haze, fog and darkness. MCU based Ultrasonic based Radar and Distance Finder is a system of gathering information about distant objects (target) by transmitting Electromagnetic Waves towards target and receiving back and analyzing echoes. It will calculate: Distance Time Angle

Passive keyless lock

Contents
PAGE NO. Candidates Declaration Acknowledgement Abstract Contents

Chapter 1: Introduction Chapter 2: Hardware Description Chapter 3: Sensors Chapter 4: Optocoupler Chapter 5: LCD interfacing Chapter 6: MAX232 Chapter 7: Interfacing of switiches with microcontroller Chapter 8: Optoisolators and optointerrupters Chapter 9: LCD interfqacing with microcontroller Chapter 10: LED interfacing Chapter 11: Stepper Motor Chapter 12:Flow chart Chapter 13:Key Coding Chapter 14:Vechile coding Conclusion

Passive keyless lock

INTRODUCTION

Hardware blocks on the passive keyless lock The system works by having a series of LF (low frequency 125 kHz) transmitting antennas both inside and outside the vehicle. The external antennas are located in the door handles. When the vehicle is triggered either by pulling the handle or touching the handle an LF signal is transmitted from the antennas to the key. The key becomes activated if it is sufficiently close and it transmits its ID back to the vehicle via RF (Radio frequency >300 MHz) to a receiver located in the vehicle. If the key has the correct ID the PASE module unlocks the vehicle. The hardware blocks of passive keyless lock are based on its functionality: transmitting low frequency LF signals via the 125 kHz power amplifier block receiving radio frequency RF signals (> 300 MHz) from the built-in receiver block encrypting and decrypting all relevant data signals (security) communicating relevant interface signals with other electronic control units microcontroller

Passive keyless lock

CHAPTER-1
BLOCK DIAGRAM OF PROJECT a. TRANSPONDER CIRCUIT b. BASE STATION

Passive keyless lock

Passive keyless lock

CIRCUIT DIAGRAM

Passive keyless lock

10

Passive keyless lock

LIST OF COMPONENTS USED

S.NO
1

Name
Transreciver chip

Quantity
2

Colour
Green

Pins

Buzzer

black

Led

Transparent

4 5 6 7

Stepper motor Resistance Step-down transformer Lcd

1 22 2 1

Green-brown Black Black 2 14 16

Opto-coupler

Black

9 10

Designed PCB Microcontroller 8051

1 2 Black

40 11 Voltage regulator 7805 1 Black 3

11

Passive keyless lock

12 13 14 15 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29.

Nut-Bolt Pair Jumper Wire ( Single Stand Wire) IC Base ( 8,14,16,40 pin) Cermic capacitor Electrolytic Capacitor Bridge Rectifier Crystal Oscilattor Reset button 10k ohm resistance 10 microfarad capacitor 33 picofarad capacitor Crystal 11.0592 MHz Transistor Ribbon wires General purpose PCB Buzzer DIPTRACE PCB SOFTWARE KEIL COMPILER

3 13 6 1 2 2 1 1 1 1 4

Black Brown Blue Black Silver Black

2 2 2 2 2 2

Black

1 1 Black 2

12

Passive keyless lock

30.

Burner

Black

HARDWARE PARTS
The project consists of three main parts:

8051 microcontroller
Power Supply (Regulated) Clock Generator LCD Stepper motor Isolation Circuit Opto-Coupler Buzzer

1).SOFTWARES USEDx:
1.

For PCB Designing:

Some of the softwares available in the market for pcb designing are: Protal Orcad Dip trace

But due to its more availability in the market, we are going to use dip trace software.

2.

For microcontroller 89c51:

there are many types of microcontrollers available in the market, some of them are: PIC microcontroller 13

Passive keyless lock

Dallas microcontroller Atmel 89c51 microcontroller

But, we have planned to continue our project using Atmel 89c51 microcontroller, as it is the most easily available in the market

also, this is the most economical and easy to understand and has all its functions limited to 40 pins. Also, for programming the microcontroller, we require useful software. Many types of software are available but we are going to use the keil software because of its more availability, flexibility and easy operations

CHAPTER-2 8051 MICRO-CONTROLLER 2.1.1 INTRODUCTION:


A microcontroller is a kind of miniature computer that you can find in all kinds of gizmos. Some examples of common, every-day products that have microcontrollers built-in are shown in Figure 1-1. If it has buttons and a digital display, chances are it also has a programmable microcontroller brain. Figure 1-1. Every-Day Examples of Devices that Contain Microcontrollers Try making a list and counting how many devices with microcontrollers you use in a typical day. Here are some examples: if your clock radio goes off, and you hit the snooze button a few times in the morning, the first thing you do in your day is interact with a microcontroller. Heating up some food in the microwave oven and making a call on a cell phone also involve operating microcontrollers. Thats just the beginning. Here are a few more examples: turning on the television with a handheld remote, playing a handheld game, using a calculator, and checking your digital wristwatch. All those devices have microcontrollers inside them that interact with you.

14

Passive keyless lock

Figure 2.2: Every-Day Examples of Devices that Contain Microcontrollers Atmel 89c51 microcontroller module shown in Figure 4 has a microcontroller built onto it. Its the black chip with lettering on it that reads Atmel 89c51. The rest of the components on the microcontroller module are also found in consumer appliances you use every day. All together, they are correctly called an embedded computer system. This Name is almost always shortened to just embedded system. Frequently, such modules are commonly just called microcontrollers.

Fig 2.3: 40 Pins Atmel 89c51 microcontroller module (Internal structure) ( copy right protected)

15

Passive keyless lock

Fig 2.3: 40 Pins Atmel 89c51 microcontroller module

2.2 TYPES OF MICROCONTROLLER 2.2.1 INTEL 8051 AND ITS FAMILY


In 1981, Intel Corporation introduces an 8-bit microcontroller called 8051. The Intel 8051 became widely popular and allowed other companies to produce any flavor of 8051 but with condition that code remains compatible with 8051. Other two members in 8051 family of microcontroller are 8052 & 8031 Some other companies producing member of 8051 family are: 1. 2. 3. 4. 5. Intel Atmel Dallas Semiconductors Philips/ Signetics Siemens

2.2.2 PIC MICROCONTROLLER (Microchip Technology)

16

Passive keyless lock

Fig 2.4:basic microcontroller module

2.3 AMAZING INVENTIONS WITH MICROCONTROLLERS:1. Consumer appliances arent the only things that contain microcontrollers. Robots, machinery, aerospace designs and other high-tech devices are also built with microcontrollers. Lets take a look at some examples that were created with Atmel 89c51 microcontroller module. Robots have been designed to do everything from helping students learn more about microcontrollers, to mowing the lawn, to solving complex mechanical problems. Figure1-4 shows two example robots. On each of these robots, students use the Atmel 89c51 microcontroller module to read sensors, control motors, and communicate with other computers.

17

Passive keyless lock

Fig 2.5: Applications of microcontroller 2. Microcontrollers are also used in scientific, high technology, and aerospace projects. The weather station shown on the left of Figure 1-7 is used to collect environmental data related to coral reef decay. The Atmel 89c51 microcontroller inside it gathers this data from a variety of sensors and stores it for later retrieval by scientists. The submarine in the center is an undersea exploration vehicle, and its thrusters, cameras and lights are all controlled by Atmel 89c51 microcontroller. The rocket shown on the right is one that was part of a competition to launch a privately owned rocket into space. Nobody won the competition, but this rocket almost made it! Atmel 89c51 microcontroller controlled just about every aspect of the launch sequence.

18

Passive keyless lock

Figure 2.6: High-tech and Aerospace Microcontroller Examples Ecological data collection by EME Systems (left), undersea research by Harbor Branch Institute

3.)From common household appliances all the way through scientific and aerospace applications, the microcontroller basics you will need to get started on projects like these are introduced here. By working through the activities in this book, you will get to experiment with and learn how to use a variety of building blocks found in all these hightech inventions. You will build circuits for displays, sensors, and motion controllers. You will learn how to connect these circuits to the Atmel 89c51 microcontroller, and then write computer programs that make it control displays, collect data from the sensors, and control motion. Along the way, you will learn many important electronic and computer programming concepts and techniques. By the time youre done, you might find yourself well on the way to inventing a gizmo of your own design.

2.4 INSIDE 8051

ROM

P1 P0

FILTER FOR P2 INPUT VOLTAGE. Internal Oscilattor


19

Passive keyless lock

P3

P2

Fig2.7: Inside 8051

2.5 8051 PIN DIAGRAM

20

Passive keyless lock

Fig 2.8: Pin Description 2.6 Pin Description: 1.)VCC: Supply voltage.
21

Passive keyless lock

2.)GND: Ground.

3.) Port 1:

Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull-ups. P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port 1 output buffers can sink 20 mA and can drive LED displays directly. When 1s are written to Port 1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled low, they will source current (IIL) because of the internal pull-ups. Port 1 also receives code data during Flash programming and verification.

4.)Port 3:

Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups. P3.6 is hard-wired as an input to the output of the on-chip comparator and is not accessible as a general-purpose I/O pin. The Port 3 output buffers can sink 20 mA. 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 AT89S2051/S4051 as listed below: Port 3 also receives some control signals for Flash programming and verification.

5.) RST:Reset input. Holding the RST pin high for two machine cycles while the is
running resets the device. Each machine cycle takes 6 or clock cycles. 22

Passive keyless lock

6.) XTAL1: Input to the inverting amplifier and input to the internal clock operating circuit. 7.) XTAL2: Output from the inverting amplifier. Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip . Either a quartz crystal or ceramic resonator may be used. To drive the device from an extern al clock source, XTAL2 should be left unconnected while XTAL1 . 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

CHAPTER-3 POWER SUPPLY DESCRIPTION:

TRANSFO

BRIDGE RECTIFIER

SHUNT CAPACITOR

VOLTAGE REGULATOR 23

Passive keyless lock

The power supply circuit comprises of four basic parts: The transformer steps down the 220 V a/c. into 12 V a/c. The transformer work on the principle of magnetic induction, where two coils: primary and secondary are wound around an iron core. The two coils are physically insulated from each other in such a way that passing an a/c. current through the primary coil creates a changing voltage in the primary coil and a changing magnetic field in the core. This in turn induces a varying a/c. voltage in the secondary coil.

The a/c. voltage is then fed to the bridge rectifier. The rectifier circuit is used in most electronic power supplies is the single-phase bridge rectifier with capacitor filtering, usually followed by a linear voltage regulator. A rectifier circuit is necessary to convert a signal having zero average value into a non-zero average value. A rectifier transforms alternating current into direct current by limiting or regulating the direction of flow of current. The output resulting from a rectifier is a pulsating D.C. voltage. This voltage is not appropriate for the components that are going to work through it.

7812 1N4007 12-0-12 V


7805

24

Passive keyless lock

1000uF TRANSFORMER

The ripple of the D.C. voltage is smoothened using a filter capacitor of 1000 microF 25V. The filter capacitor stores electrical charge. If it is large enough the capacitor will store charge as the voltage rises and give up the charge as the voltage falls. This has the effect of smoothing out the waveform and provides steadier voltage output. A filter capacitor is connected at the rectifier output and the d.c voltage is obtained across the capacitor. When this capacitor is used in this project, it should be twice the supply voltage. When the filter is used, the RC charge time of the filter capacitor must be short and the RC discharge time must be long to eliminate ripple action. In other words the capacitor must charge up fast, preferably with no discharge.

When the rectifier output voltage is increasing, the capacitor charges to the peak voltage Vm. Just past the positive peak, the rectifier output voltage starts to fall but at this point the capacitor has +Vm voltage across it. Since the source voltage becomes slightly less than Vm, the capacitor will try to send current back through the diode of rectifier. This reverse biases the diode. The diode disconnects or separates the source the source form load. The capacitor starts to discharge through load. This prevents the load voltage from falling to zero. The capacitor continues to discharge until source voltage becomes more than capacitor voltage. The diode again starts conducting and the capacitor is again charged to peak value Vm. When capacitor is charging the rectifier supplies the charging through capacitor branch as well as load current, the capacitor sends currents through the 25

Passive keyless lock

load. The rate at which capacitor discharge depends upon time constant RC. The longer the time constant, the steadier is the output voltage. An increase in load current i.e. decrease in resistance makes time constant of discharge path smaller. The ripple increase and d.c output voltage V dc decreases. Maximum capacity cannot exceed a certain limit because the larger the capacitance the greater is the current required to charge the capacitor,The voltage regulator regulates the supply if the supply if the line voltage increases or decreases. The series 78xx regulators provide fixed regulated voltages from 5 to 24 volts. An unregulated input voltage is applied at the IC Input pin i.e. pin 1 which is filtered by capacitor. The out terminal of the IC i.e. pin 3 provides a regular output. The third terminal is connected to ground. While the input voltage may vary over some permissible voltage range, and the output voltage remains constant within specified voltage variation limit. The 78xx ICs are positive voltage regulators whereas 79xx ICs are negative voltage regulators. These voltage regulators are integrated circuits designed as fixed voltage regulators for a wide variety of applications. These regulators employ current limiting, thermal shutdown and safe area compensation. With adequate heat sinking they can deliver output currents in excess of 1 A. These regulators have internal thermal overload protection. It uses output transistor safe area compensation and the output voltage offered is in 2% and 4% tolerance.

CHAPTER-4

RELAY:A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism, but other operating principles are also used. Relays find applications where it is necessary to control a circuit by a low-power signal, or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits, repeating the signal coming in from one circuit and re-transmitting it to another. Relays found extensive use in telephone exchanges and early computers to perform logical operations. A type of relay that can handle the high power required to directly drive an electric motor is called a contactor. Solid-state relays control power circuits with no moving parts, instead using a semiconductor device triggered by light to perform switching. Relays with calibrated operating characteristics and sometimes multiple operating coils are used to protect electrical 26

Passive keyless lock

circuits from overload or faults; in modern electric power systems these functions are performed by digital instruments still called "protection relays".

Basic design and operation


A simple electromagnetic relay, such as the one taken from a car in the first picture, is an adaptation of an electromagnet. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a movable iron armature, and a set, or sets, of contacts; two in the relay pictured. The armature is hinged to the yoke and mechanically linked to a moving contact or contacts. It is held in place by a spring so that when the relay is de-energised there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the moving contacts on the armature, and the circuit track on the printed circuit board (PCB) via the yoke, which is soldered to the PCB. When an electric current is passed through the coil, the resulting magnetic field attracts the armature, and the consequent movement of the movable contact or contacts either makes or breaks a connection with a fixed contact. If the set of contacts was closed when the relay was de-energised, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured 27

Passive keyless lock

to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing. If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to circuit components. Some automotive relays already include that diode inside the relay case. Alternatively a contact protection network, consisting of a capacitor and resistor in series, may absorb the surge. If the coil is designed to be energized with AC, a small copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small out-of-phase current, which increases the minimum pull on the armature during the AC cycle.[1] By analogy with the functions of the original electromagnetic device, a solid-state relay is made with a thyristor or other solid-state switching device. To achieve electrical isolation an optocoupler can be used which is a light-emitting diode (LED) coupled with a photo transistor.

Types
Latching relay, dust cover removed, showing pawl and ratchet mechanism. The ratchet operates a cam, which raises and lowers the moving contact arm, seen edge-on just below it. The moving and fixed contacts are visible at the left side of the image. A latching relay has two relaxed states (bistable). These are also called "impulse", "keep", or "stay" relays. When the current is switched off, the relay remains in its last state. This is achieved with a solenoid operating a ratchet and cam mechanism, or by having two opposing coils with an over-center spring or permanent magnet to hold the armature and contacts in position while the coil is relaxed, or with a remanent core. In the ratchet and cam example, the first pulse to the coil turns the relay on and the second pulse turns it off. In the two coil example, a pulse to one coil turns the relay on and a pulse to the opposite coil turns the relay off. This type of relay has the advantage that it consumes power only for an instant, while it is being switched, and it retains its last setting across a power outage. A remanent core latching relay requires a current pulse of opposite polarity to make it change state.

28

Passive keyless lock

Reed relay
A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube, which protects the contacts against atmospheric corrosion. The contacts are closed by a magnetic field generated when current passes through a coil around the glass tube. Reed relays are capable of faster switching speeds than larger types of relays, but have low switch current and voltage ratings. See also reed switch.

Mercury-wetted relay
A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted with mercury. Such relays are used to switch low-voltage signals (one volt or less) because of their low contact resistance, or for high-speed counting and timing applications where the mercury eliminates contact bounce. Mercury wetted relays are position-sensitive and must be mounted vertically to work properly. Because of the toxicity and expense of liquid mercury, these relays are rarely specified for new equipment. See also mercury switch.

Polarized relay
A polarized relay placed the armature between the poles of a permanent magnet to increase sensitivity. Polarized relays were used in middle 20th Century telephone exchanges to detect faint pulses and correct telegraphic distortion. The poles were on screws, so a technician could first adjust them for maximum sensitivity and then apply a bias spring to set the critical current that would operate the relay.

Machine tool relay


A machine tool relay is a type standardized for industrial control of machine tools, transfer machines, and other sequential control. They are characterized by a large number of contacts (sometimes extendable in the field) which are easily converted from normally-open to normally-closed status, easily replaceable coils, and a form factor that allows compactly installing many relays in a control panel. Although such relays once were the backbone of automation in such industries as automobile assembly, the programmable logic controller (PLC) mostly displaced the machine tool relay from sequential control applications.

Contactor relay
A contactor is a very heavy-duty relay used for switching electric motors and lighting loads. Continuous current ratings for common contactors range from 10 amps to several hundred amps. High-current contacts are made with alloys containing silver. The unavoidable arcing causes the contacts to oxidize; however, silver oxide is still a good conductor.[2] Such devices are often used for motor starters. A motor starter is a contactor with overload protection devices attached. The overload sensing devices are a form of heat operated relay where a coil heats a bi-metal strip, or where a solder pot melts, releasing a spring to operate auxiliary contacts. These auxiliary contacts are in series with the coil. If the overload senses excess current in the load, the coil is de-energized. 29

Passive keyless lock

Contactor relays can be extremely loud to operate, making them unfit for use where noise is a chief concern.

Solid-state relay

Solid state relay, which has no moving parts

25 A or 40 A solid state contactors A solid state relay (SSR) is a solid state electronic component that provides a similar function to an electromechanical relay but does not have any moving components, increasing long-term reliability. With early SSR's, the tradeoff came from the fact that every transistor has a small voltage drop across it. This voltage drop limited the amount of current a given SSR could handle. As transistors improved, higher current SSR's, able to handle 100 to 1,200 Amperes, have become commercially available. Compared to electromagnetic relays, they may be falsely triggered by transients.

Solid state contactor relay


A solid state contactor is a very heavy-duty solid state relay, including the necessary heat sink, used for switching electric heaters, small electric motors and lighting loads; where frequent on/off cycles are required. There are no moving parts to wear out and there is no contact bounce due to vibration. They are activated by AC control signals or DC control signals from Programmable logic controller (PLCs), PCs, Transistortransistor logic (TTL) sources, or other microprocessor and microcontroller controls.

30

Passive keyless lock

Buchholz relay
A Buchholz relay is a safety device sensing the accumulation of gas in large oil-filled transformers, which will alarm on slow accumulation of gas or shut down the transformer if gas is produced rapidly in the transformer oil.

Forced-guided contacts relay


A forced-guided contacts relay has relay contacts that are mechanically linked together, so that when the relay coil is energized or de-energized, all of the linked contacts move together. If one set of contacts in the relay becomes immobilized, no other contact of the same relay will be able to move. The function of forced-guided contacts is to enable the safety circuit to check the status of the relay. Forced-guided contacts are also known as "positive-guided contacts", "captive contacts", "locked contacts", or "safety relays".

Overload protection relay


One type of electric motor overload protection relay is operated by a heating element in series with the electric motor . The heat generated by the motor current operates a bimetal strip or melts solder, releasing a spring to operate contacts. Where the overload relay is exposed to the same environment as the motor, a useful though crude compensation for motor ambient temperature is provided.

Pole and throw

Circuit symbols of relays. "C" denotes the common terminal in SPDT and DPDT types.

31

Passive keyless lock

The diagram on the package of a DPDT AC coil relay Since relays are switches, the terminology applied to switches is also applied to relays. A relay will switch one or more poles, each of whose contacts can be thrown by energizing the coil in one of three ways:

Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called a Form A contact or "make" contact. Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called a Form B contact or "break" contact. Change-over (CO), or double-throw (DT), contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called a Form C contact or "transfer" contact ("break before make"). If this type of contact utilizes a "make before break" functionality, then it is called a Form D contact.

The following designations are commonly encountered:

SPST Single Pole Single Throw. These have two terminals which can be
connected or disconnected. Including two for the coil, such a relay has four terminals in total. It is ambiguous whether the pole is normally open or normally closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the ambiguity. SPDT Single Pole Double Throw. A common terminal connects to either of two others. Including two for the coil, such a relay has five terminals in total. DPST Double Pole Single Throw. These have two pairs of terminals. Equivalent to two SPST switches or relays actuated by a single coil. Including two for the coil, such a relay has six terminals in total. The poles may be Form A or Form B (or one of each). DPDT Double Pole Double Throw. These have two rows of change-over terminals. Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has eight terminals, including the coil.

The "S" or "D" may be replaced with a number, indicating multiple switches connected to a single actuator. For example 4PDT indicates a four pole double throw relay (with 14 terminals).

Applications
32

Passive keyless lock

Relays are used to and for:


Control a high-voltage circuit with a low-voltage signal, as in some types of modems or audio amplifiers, Control a high-current circuit with a low-current signal, as in the starter solenoid of an automobile, Detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers (protection relays),

A DPDT AC coil relay with "ice cube" packaging

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, Logic functions. For example, the boolean AND function is realised by connecting normally open relay contacts in series, the OR function by connecting normally open contacts in parallel. The change-over or Form C contacts perform the XOR (exclusive or) function. Similar functions for NAND and NOR are accomplished using normally closed 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. o Safety-critical logic. Because relays are much more resistant than semiconductors to nuclear radiation, they are widely used in safety-critical logic, such as the control panels of radioactive waste-handling machinery. 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 33

Passive keyless lock

increasing or decreasing the flow rate. For longer time periods, a mechanical clockwork timer is installed.

Relay application considerations


A large relay with two coils and many sets of contacts, used in an old telephone switching system.

Several 30-contact relays in "Connector" circuits in mid 20th century 1XB switch and 5XB switch telephone exchanges; cover removed on one Selection of an appropriate relay for a particular application requires evaluation of many different factors:

Number and type of contacts normally open, normally closed, (double-throw) Contact sequence "Make before Break" or "Break before Make". For example, the old style telephone exchanges required Make-before-break so that the connection didn't get dropped while dialing the number. Rating of contacts small relays switch a few amperes, large contactors are rated for up to 3000 amperes, alternating or direct current Voltage rating of contacts typical control relays rated 300 VAC or 600 VAC, automotive types to 50 VDC, special high-voltage relays to about 15 000 V Coil voltage machine-tool relays usually 24 VAC, 120 or 250 VAC, relays for switchgear may have 125 V or 250 VDC coils, "sensitive" relays operate on a few milliamperes Coil current Usually in the range of 40200 mA for 024 VDC coils.[3] Package/enclosure open, touch-safe, double-voltage for isolation between circuits, explosion proof, outdoor, oil and splash resistant, washable for printed circuit board assembly Assembly Some relays feature a sticker that keeps the enclosure sealed to allow PCB post soldering cleaning agents. Which is removed once assembly is complete. Mounting sockets, plug board, rail mount, panel mount, through-panel mount, enclosure for mounting on walls or equipment 34

Passive keyless lock

Switching time where high speed is required "Dry" contacts when switching very low level signals, special contact materials may be needed such as gold-plated contacts Contact protection suppress arcing in very inductive circuits Coil protection suppress the surge voltage produced when switching the coil current Isolation between coil circuit and contacts Aerospace or radiation-resistant testing, special quality assurance Expected mechanical loads due to acceleration some relays used in aerospace applications are designed to function in shock loads of 50 g or more Accessories such as timers, auxiliary contacts, pilot lamps, test buttons Regulatory approvals Stray magnetic linkage between coils of adjacent relays on a printed circuit board.

Protective relay
A protective relay is a complex electromechanical apparatus, often with more than one coil, designed to calculate operating conditions on an electrical circuit and trip circuit breakers when a fault was found. Unlike switching type relays with fixed and usually illdefined operating voltage thresholds and operating times, protective relays had wellestablished, selectable, time/current (or other operating parameter) curves. Such relays were very elaborate, using arrays of induction disks, shaded-pole magnets, operating and restraint coils, solenoid-type operators, telephone-relay style contacts, and phase-shifting networks to allow the relay to respond to such conditions as over-current, over-voltage, reverse power flow, over- and under- frequency, and even distance relays that would trip for faults up to a certain distance away from a substation but not beyond that point. An important transmission line or generator unit would have had cubicles dedicated to protection, with a score of individual electromechanical devices. The various protective functions available on a given relay are denoted by standard ANSI Device Numbers. For example, a relay including function 51 would be a timed over current protective relay. These protective relays provide various types of electrical protection by detecting abnormal conditions and isolating them from the rest of the electrical system by circuit breaker operation. Such relays may be located at the service entrance or at major load centers. Design and theory of these protective devices is an important part of the education of an electrical engineer who specializes in power systems. Today these devices are nearly entirely replaced (in new designs) with microprocessor-based instruments (numerical relays) that emulate their electromechanical ancestors with great precision and convenience in application. By combining several functions in one case, numerical relays also save capital cost and maintenance cost over electromechanical relays. However, due to their very long life span, tens of thousands of these "silent sentinels" are still protecting transmission lines and electrical apparatus all over the world. Protective Device Coordination. 35

Passive keyless lock

Top, middle: reed switches, bottom: reed relay

Overcurrent relay
An "Overcurrent Relay" is a type of protective relay which operates when the load current exceeds a preset value. The ANSI Device Designation Number is 50 for an Instantaneous OverCurrent (IOC), 51 for a Time OverCurrent (TOC). In a typical application the overcurrent relay is used for overcurrent protection, connected to a current transformer and calibrated to operate at or above a specific current level. When the relay operates, one or more contacts will operate and energize a trip coil in a Circuit Breaker and trip (open) the Circuit Breaker.

Induction disc overcurrent relay


These robust and reliable electromagnetic relays use the induction principle discovered by Ferraris in the late 19th century. The magnetic system in induction disc overcurrent relays is designed to detect over currents in a power system and operate with a pre determined time delay when certain overcurrent limits have been reached. In order to operate, the magnetic system in the relays produces rotational torque that acts on a metal disc to make contact, according to the following basic current/torque equation: T = K x 1 x 2 Sin Where K is a constant 1 and 2 are the two fluxes is the phase angle between the fluxes The relay's primary winding is supplied from the power systems current transformer via a plug bridge, which is also commonly known as the plug setting multiplier (psm). The variations in the current setting are usually seven equally spaced tappings or operating bands that determine the relays sensitivity. The primary winding is located on the upper electromagnet. The secondary winding has connections on the upper electromagnet that are energised from the primary winding and connected to the lower electromagnet. Once the upper and lower electromagnets are energised they produce eddy currents that are induced onto the metal disc and flow through the flux paths. This relationship of eddy currents and fluxes creates rotational torque proportional to the input current of the primary winding, due to the two flux paths been out of phase by 90. 36

Passive keyless lock

Therefore in an overcurrent condition a value of current will be reached that overcomes the control spring pressure on the spindle and the breaking magnet causing the metal disc to rotate moving towards the fixed contact. This initial movement of the disc is also held off to a critical positive value of current by small slots that are often cut into the side of the disc. The time taken for rotation to make the contacts is not only dependent on current but also the spindle backstop position, known as the time multiplier (tm). The time multiplier is divided into 10 linear divisions of the full rotation time. Providing the relay is free from dirt, the metal disc and the spindle with its contact will reach the fixed contact, thus sending a signal to trip and isolate the circuit, within its designed time and current specifications. Drop off current of the relay is much lower than its operating value, and once reached the relay will be reset in a reverse motion by the pressure of the control spring governed by the braking magnet.

Distance relay
The most common form of protection on high voltage transmission systems is distance relay protection. Power lines have set impedance per kilometre and using this value and comparing voltage and current the distance to a fault can be determined. The ANSI standard device number for a distance relay is 21. The main types of distance relay protection schemes are:

Three step distance protection Switched distance protection Accelerated or permissive intertrip protection Blocked distance protection

In three step distance protection, the relays are separated into three separate zones of impedance measurement to accommodate for over reach and under reach conditions. Zone 1 is instantaneous in operation and has a purposely set under reach of 80% of the total line length to avoid operation for the next line. This is due to measurements of impedance of lines not being entirely accurate, errors in voltage and current transformers and relay tolerances. These errors can be up to 20% of the line impedance, hence the zones 80% reach. Zone 2 covers the last 20% of the feeder line length and provides backup to the next line by having a slight over reach. To prevent mal-operation the zone has a 0.5 second time delay. Zone 3 provides backup for the next line and has a time delay of 1 second to grade with zone 2 protection of the next line.

Motor protection relay


AC motors need overcurrent protection against short circuits from external faults in connecting cables and from internal faults in motor windings. In addition, motors are thermally rated and limited, and protective relays must be applied to prevent overheating during operating conditions where no fault is present.[4]

Railway signalling

37

Passive keyless lock

General

Railway signalling relays are very big and cumbersome compared to the mostly small voltages and currents that they switch. Contacts are widely spaced to prevent dangerous flashovers and short circuits over a lifetime that may exceed fifty years. The Q-series of plug-in relays are widely used on railways following English practice. These are 120mm high, 180mm deep and 56mm wide and weigh about 1400 g.

Double switching
In railway signalling, relays energise to give a green light, so that if the power fails or a wire breaks, the signal goes to red. This is called "fail-safe". To protect against false feeds relay circuits are often cut on both the positive and negative side, so that two false feeds are needed to cause a false green.

Proving
In railway signalling, many relays are proved down before a signal is allowed to show green. For example, before a point's normal detector is allowed to pick up (and allow that signal to show green) the corresponding point's reverse detector must be proved in the deenergized position. Not all relays can be proved, for example repeat relays in distant locations, so there is reliance on other features such as carbon to silver contacts to resist lightning induced contact welding and AC immunity

38

Passive keyless lock

CHAPTER-5 LCD INTERFACING


A liquid crystal display (LCD) is an electro-optical amplitude modulator realized as a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. It is often utilized in battery-powered electronic devices because it uses very small amounts of electric power.

5.1 Pin Description


The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 charachers, whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers. 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). Pin description is shown in the table below.

39

Passive keyless lock

Figure 5.1: Character LCD type HD44780 Pin diagram

Pin No. Pin no. 1 Pin no. 2 Pin no. 3 Pin no. 4

Name VSS VCC VEE RS

Description Power supply (GND) Power supply (+5V) Contrast adjust 0 = Instruction input 1 = Data input 0 = Write to LCD module 1 = Read from LCD module Enable signal Data bus line 0 (LSB) Data bus line 1 Data bus line 2 Data bus line 3 Data bus line 4 Data bus line 5 Data bus line 6 Data bus line 7 (MSB)

Pin no. 5 Pin no. 6 Pin no. 7 Pin no. 8 Pin no. 9 Pin no. 10 Pin no. 11 Pin no. 12 Pin no. 13 Pin no. 14

R/W EN D0 D1 D2 D3 D4 D5 D6 D7

Table 5.2: Character LCD pins with 1 Controller 40

Passive keyless lock

Important factors to consider when evaluating an LCD :

Resolution: The horizontal and vertical size expressed in pixels (e.g.,


1024x768). Unlike monochrome CRT monitors, LCD monitors have a nativesupported resolution for best display effect. Dot pitch: The distance between the centers of two adjacent pixels. The smaller the dot pitch size, the less granularity is present, resulting in a sharper image. Dot pitch may be the same both vertically and horizontally, or different (less common). Viewable size: The size of an LCD panel measured on the diagonal (more specifically known as active display area). Response time: The minimum time necessary to change a pixel's color or brightness. Response time is also divided into rise and fall time. For LCD Monitors, this is measured in btb (black to black) or gtg (gray to gray). These different types of measurements make comparison difficult. Input ports (e.g., DVI, VGA, LVDS, Display Port, or even S-Video and HDMI).

Fig 5.3: LCD Display

Features:1.16 Characters x 2 Lines 2. 5x7 Dot Matrix Character + Cursor 3. HD44780 Equivalent LCD Controller/driver Built-In 4. 4-bit or 8-bit MPU Interface 5. Uses HD44780 Controller. 6. Works with almost any Microcontroller. 7. Low cost 5.2 INTERFACING Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose. These LCD's are very simple to interface with the controller as well as are cost effective. The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line). 41

Passive keyless lock

The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines + 3 control lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are required. How do we decide which mode to use? Its simple if you have sufficient data lines you can go for 8 bit mode & if there is a time constrain i.e. display should be faster then we have to use 8-bit mode because basically 4bit mode takes twice as more time as compared to 8-bit mode. When RS is low (0), the data is to be treated as a command. When RS is high (1), the data being sent is considered as text data which should be displayed on the screen. When R/W is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively reading from the LCD. Most of the times there is no need to read so this line can connected to one controller from the LCD directly be Gnd thus saving line.

Fig 5.4: LCD interfacing

The EN pin is used to latch the data present on the data pins. A HIGH - LOW signal is required to latch the data. The LCD interprets and executes our command at the instant 42

Passive keyless lock

the EN line is brought low. If you never bring EN low, your instruction will never be executed.

CHAPTER-6 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. Nowadays, it is more popular to use a ceramic-based piezoelectric 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. In game shows it is also known as a "lockout system," because when one person signals ("buzzes in"), all others are locked out from signalling. Several game shows have large buzzer buttons which are identified as "plungers". The word "buzzer" comes from the rasping noise that buzzers made when they were electromechanical devices, operated from stepped-down AC line voltage at 50 or 60 43

Passive keyless lock

cycles. Other sounds commonly used to indicate that a button has been pressed are a ring or a beep.

CHAPTER-7

INTERFACING OF SWITCHES WITH MICROCONTROLLER:


There are three micro switches in the circuit connected to the microcontroller pin no. p0.5 to p0.7. One end of each switch is grounded and other is connected to the microcontroller port with a 10K pull-up, as in Figure4.12. When switch is pressed that particular port is grounded. The microcontroller always monitors these switches in real time (i.e. in continuous mode) The configuration of the micro switches is as follows: Switch1 (S1): Increment Switch2 (S2): Decrement Switch3 (S3): Set

44

Passive keyless lock

Figure : a) Interfacing of switches with c

45

Passive keyless lock

CHAPTER-8 OPTOISOLATORS AND OPTOINTERRUPTERS


As more electronic devices were used to form circuits, the demand to connect circuits with differing voltage potentials and differing impedances together became more prevalent. For example, as computers and programmable controllers became more usable on the factory floor, it became evident that some type of interface would be needed that could isolate the 220 volt AC and 110 volt AC signals that most machinery used from the small DC bus voltages found in computers. Isolation is also a problem when larger AC and DC voltages need to be interfaced to TTL logic circuits. FIGURE : A comparison of the power devices. The following abbreviations are used: HVT (high-voltage transistor), J-FET (J-type field effect transistor), MOS (metal-oxide semiconductor), THY (thyristor), GTO (gate turn-off device), and IGBT (insulated gate bipolar transistor). (Courtesy of Philips Semiconductors.) HVT V(ON) Positive 1 DriveJ-FET MOS THY 10 + 5 + 1.5 + GTO 3 + IGBT slow 2 + IGBT fast 4 + Unit V + = Simple to 46

Passive keyless lock

Requirement Turn-Off requirement 0.1 ++ 12 20 10 1000 10 3 + + + + 0.1 ++ 20 10 10 1000 100 5 (--) (-) + + 5 200 0.5 1 5000 5000 15 1 100 1.5 0.3 4000 3000 10 + + 2 50 3 10 1000 400 3 + + 0.5 50 10 10 1000 400 3 Drive circuit complexity Technology Complexity + Device Protection Delay time (ts, tq) Switching Losses Current Density Max dv/dt (Vin = 0) dl/dt Vmax Imax Over Current factor 2 50 3 1 1500 1000 5

implement + = Simple to implement - = complex - = complex + = Simple to implement ms +=good A/cm2 V/ns A/ns V A

FIGURE : Electrical block diagram and physical layout of a typical opto-coupler. The optocoupler is also called an optoisolator and it is usually packaged as a six-pin 1C chip. (Copyright of Motorola, Used by Permission.)

47

Passive keyless lock

The simple solution to this problem is to combine an LED with a phototransistor. The new device is totally encapsulated so that the light from the LED is focused directly on the opening in the phototransistor, and no other forms of light could be detected. The input signal is connected to the LED and the output signal is connected to the transistor. The device is called an optocoupler or optoisolator. Fig. 3-25 shows a block diagram of an optocoupler that shows an LED shining light directly on a photodector, which is usually a phototransistor. The second diagram in the figure shows how the LED is located so its light is focused directly on the phototransistor. Fig. 3-26 shows the six-pin 1C package for an optocoupler and the electronic diagram of its pin outline. The 1C package may also be called an 1C or a chip. From this diagram you can see that the anode of the LED is pin 1 and the cathode is pin 2. The emitter of the phototransistor is pin 4, the collector is pin 5, and the base is pin 6. It is important to note that each type of optocoupler may use different pin assignments, so you must be sure to check the manufacturer's pin outline diagrams.

FIGURE : Pin outline for an optocoupler for a six-pin 1C. A sketch of a six-pin 1C is also shown. (Copyright of Motorola, Used by Permission.)

48

Passive keyless lock

FIGURE : Electrical diagram of an optocoupler used to interface an annunciator horn to a computer. The relay coil is connected to the output stage of the optocoupler.

APPLICATIONS FOR OPTOCOUPLERS


Fig. shows an optocoupler interfacing a computer output signal to a relay coil and the contacts of the relay are used to energize a 110 volt alarm lamp and annunciator. This circuit allows the small-voltage signal from the computer to safely energize the highvoltage lamp and horn without the fear of allowing any high-voltage spikes to get back into the computer. Optocouplers are also used in programmable logic controller (PLC) 110 volt input and output modules to provide isolation between the 110 volt signals and PLC bus. In industrial applications a limit switch on a machine is wired for 110 volt AC so that it is not bothered by induced electrical noise. The 110 volt AC signal is connected to the programmable controller input module circuit consisting of a bridge rectifier that converts the AC signal to DC, a resistor, and the LED for the optocoupler. The transistor

side of the optocoupler is connected to the input bus of the PLC. Since the signal emitted by the LED is transferred by light, the high and low voltages of the circuit are isolated.

49

Passive keyless lock

FIGURE 3-28 Optocoupler used in a PLC input module. When the switch closes, 110 volts AC is provided to terminal 1. The phototransistor in the Optocoupler is connected to the PLC input bus.

OPTOISOLATION RELAYS (SOLID-STATE RELAYS)


The industrial applications that require Optoisolation circuits are so prevalent that several companies make plug-in and stand-alone Optoisolation circuits called solid-state relays (SSRs). The SSR provides the Optocoupler circuit in an encapsulated module that has larger terminals available so that it can be used in industrial circuits and requires 3-32 volts dc to turn it on. The LED section of the Optocoupler acts like the coil of a traditional relay. This part of the SSR requires dc voltage because the LED must be forward biased to produce light. The phototransistor section of the Optocoupler inside the SSR is equivalent to the contacts in a relay. If a traditional phototransistor is used, the SSR will be rated for dc voltages. If the SSR is rated for ac voltages, it will use photosensitive solid-state devices to trigger other devices such as triacs or two inverse parallel SCRs for switching, or it can trigger the phototriac directly. Fig. 3-29 shows examples of SSRs used in conjunction with several types of transistor circuits to provide interface capabilities with TTL circuits. The internal diagram of the SSR is shown in Fig. 3-29c. In this diagram you can see that the SSR is an Optocoupler that uses an LED and a phototransistor. A 1000 ft resistor is connected internally in series with the LED so that the user does not need to worry about needing additional resistance to prevent excessive current. It should be noted that if the voltage of the input signal is too low, there may be insufficient current to properly illuminate the LED.

50

Passive keyless lock

FIGURE 3-29 (a-f) Examples of solid-state relays and their electrical diagrams. The diagrams show pnp and npn transistors used in the output stage Figure 6-21c shows a typical load connected to the relay. (Courtesy of Opto 22, Remecula, CA.)

FIGURE 3-30 Typical rack with solid-state relays mounted in it. A wide variety of relays is available to provide interfaces to dc, ac, and analog signals. (Courtesy of Opto 22, Remecula, CA.) 51

Passive keyless lock

Since the SSRs are available as stand-alone or plug-in devices, they provide the advantage of being removed and replaced very quickly. If they are the plug-in type, they can be removed and replaced by someone with minimal technical knowledge, since the wiring for this type is connected to the socket which is soldered directly to a printed circuit board. You will find SSRs in a variety of applications, such as in microprocessor controlled systems like the high-speed weighing system and the single-point temperature controllers where they provide a simple interface for alarms and other outputs. Fig. 3-30 shows the relays plugged into a module board.

OPTOCOUPLERS USED IN INPUT AND OUTPUT MODULE CIRCUITS


Optocouplers are also commonly used to provide isolation for input and output modules that are used to interface between programmable logic controllers (PLCs) or for other computer-type systems. The companies that make the SSRs also provide generic input and output circuits so that a designer can interface a wide variety of ac and dc circuits to the inputs and output bus of a common desktop-type computer. This allows the computer to be used to run a variety of software and still have the ability to read inputs and write outputs (turn them on or off) through its parallel or serial port. Fig. 3-31 shows the typical circuit for an input module. This circuit is similar to a typical PLC input module.

FIGURE 3-31 (a) Electrical diagram of typical solid-state relay used to interface input signals. The diagram shows the terminals in the rack allow for either ac or dc signals to be connected. If an ac signal is used, an ac relay must be installed in the rack, and if a dc signal is used, a dc relay must be used. (b) The diagram for an ac relay, (c) The diagram for a dc relay. (Courtesy of Opto 22, Remecula, CA.) 52

Passive keyless lock

FIGURE 3-32 Electrical diagram of the solid-state relay used as an output module. Notice that the output circuit includes an optocoupler and a transistor that is used as an amplifier. (Courtesy of Opto 22, Remecula, CA.)

SPECIALTY TYPES OF OPTOCOUPLERS

A large variety of Optocouplers has been designed to meet the demands of numerous applications. For example, Optocouplers are available that are specifically designed for high-gain signals that use darlington pairs and for high-speed switching where Schmitt triggers are used. Other conditions such as common-mode rejection, ac/dc voltage to logic-level signal interfaces, low-current applications, TTL applications, high-gain applications, and for multiplexing data applications require special types of Optocouplers. Fig. 3-33 shows example circuits of the low-input current logic gate optocoupler. Fig. 334 shows examples of specialty types of Optocouplers that use transistors with a base terminal where bias can be added, darlington pair transistors that are used for higher gain, and Schmitt triggers that are used for high-speed switching. Fig. 3-35 shows the diagram for a shunt drive circuit for optocoupler interface between TTL and CMOS signals, and Fig. 3-36 shows an optocoupler that allows ac or dc voltage as the input and the output is converted to a logic-level signal.

53

Passive keyless lock

FIGURE 3-33 Schematic diagram and pin outline for a low-power optocoupler. This type of device is used where the input signal is a low-power signal. (Copyright of Motorola, Used by Permission.) In Fig. 3-34 you can see the diagram of the low-input power logic gate optocoupler. This optocoupler combines a GaAsP LED with an integrated high-gain photon detector. The detector portion of the device provides a three-state output stage and has a detector threshold with hysteresis. The need for pull-up resistors is negated by the three-state output. The hysteresis provides differential-mode noise immunity and prevents the possibility of chatter in the output signal. Chatter may occur if the contacts of the input device bounce during closure. The contact bounce may appear as more than one signal transistion, and the hysteresis in the circuit ensures the input signal only represents the intial contact closure. This optocoupler is specifically designed to switch at small current thresholds as low as 1.6-2.2 mA. A truth table is also provided for this circuit. Fig. 3-35 shows the diagram for a shunt drive circuit that uses an optocoupler to provide an interface between TTL/LSTTL/CMOS logic circuits. The LED in this circuit can be enabled by as little as 0.5 mA at a frequency of 5 megabaud (5 million pulses per second). This makes the circuit usable as a logic-level translator or for microprocessor I/O isolation. This circuit also eliminates several problems and increases common-mode rejection, since the path for leak current in the LED is eliminated.

54

Passive keyless lock

FIGURE 3-34 Diagrams of optocouplers that use transistors, darlington transistors, and Schmitt triggers for their output stage. (Courtesy of Hewlett Packard Company.)

FIGURE 3-35 Electrical diagram of a shunt driver circuit that utilizes an optocoupler to provide an interface between TTL and CMOS logic circuits. (Courtesy of Hewlett Packard Company.)

SCHOTTKY DIODE (HP 5082 2800, OR EQUIVALENT) AND 20 pF CAPACITOR ARE NOT REQUIRED FOR UNITS WITH OPEN COLLECTOR OUTPUT.

55

Passive keyless lock

FIGURE 3-36 Electrical diagram of optocouplers specifically designed for AC input signals. (Copyright of Motorola, Used by Permission.) Other types of specialty optocouplers nave been developed 10 handle problems that occur when optocouplers are used in ac circuits. One circuit is shown in the first part of Fig. 338 where a phototriac is used instead of a phototransistor. Since the triac is used, ac voltages can be controlled directly. The second diagram in this figure shows a triac connected to a zero-crossing circuit. The zero-crossing circuit is used to ensure that the triac switches ac voltage on and off exactly when the ac sine wave is at 0 volts. This means that the triac is only turned on when the sine wave is at 0 or at 180, which means that voltage and current are minimal when the triac allows current to flow to the remainder of the circuit. This allows circuit components such as lamp filaments to last much longer, since they are not subjected to high-voltage transients from switching ac voltage and current when the sine wave is at a peak. FIGURE 3-37 Electrical diagram of an optocoupler specifically designed to accept an AC or DC voltage input. (Courtesy of Hewlett Packard Company.)

Adding Bias to the Phototransistor of the Optocoupler


The optocoupler is also useful in circuits where the bias of the phototransislor is changed. When bias voltage is added to the base of the phototransistor in an optocoupler, it can make the optocoupler more or less sensitive. If the bias voltage to the base of an NPN transistor is slightly positive, the optocoupler will become more sensitive because the LED does not need to produce as much light to make the phototransistor begin to conduct. If the bias voltage is slightly negative, the optocoupler will become less sensitive and the LED must have more current applied before it can produce enough light to overcome the bias on the phototransistor. The optocoupler must have a base terminal for the transistor brought out to a pin so that it is usable to add bias to it. The optocouplers in Fig. 3-36 show transistors with their base brought out to pin 6.

=======================================

56

Passive keyless lock

Table 9-3 Line Functions of ADC0808/ADC0809 A/D Converter

Line INO-IN7 A B C ALE CLOCK START EOC OE D0-D7 REF (-), (+) V ec

Function Analog input lines Address of analog input lines INO-IN7

Clocks address of INO-IN7 into multiplexer address register Clock signal (640-1280 kHz) Start conversion Interrupt upon completion of conversion Output enable (acknowledge) Data output lines Reference voltage Supply voltage

57

Passive keyless lock

CHAPTER-9 LCD INTERFACING WITH MICRO-CONTROLLER

PHOTOGRAPH OF ACTUAL CIRCUIT SHOWING EEPROM INTERFACING WITH MICROCONTROLLER

AT KEYBOARD
The IBM keyboard can be a cheap alternative to a keyboard on a Microprocessor development system. Or maybe you want a remote terminal, just couple it with a LCD Module. PC Keyboard Theory The IBM keyboard you most probably have sitting in front of you, sends scan codes to your computer. The scan codes tell your Keyboard Bios, what keys you have pressed or released. Take for example the 'A' Key. The 'A' key has a scan code of 1C (hex). When you press the 'A' key, your keyboard will send 1C down it's serial line. If you are still holding it down, for longer than its typematic delay, another 1C will be sent. This keeps occurring until another key has been pressed, or if the 'A' key has been released. However your keyboard will also send another code when the key has been released. Take the example of the 'A' key again, when released, the keyboard will send F0 (hex) to tell you that the key with the proceeding scan code has been released. It will then send 1C, so you know which key has been released. Your keyboard only has one code 58

Passive keyless lock

for each key. It doesn't care it the shift key has been pressed. It will still send you the same code. It's up to your keyboard BIOS to determine this and take the appropriate action. Your keyboard doesn't even process the Num Lock, Caps Lock and Scroll Lock. When you press the Caps Lock for example, the keyboard will send the scan code for the cap locks. It is then up to your keyboard BIOS to send a code to the keyboard to turn on the Caps lock LED. Now there are 101 keys and 8 bits make 256 different combinations, thus you only need to send one byte per key. Unfortunately a handful of the keys found on your keyboard are extended keys, and thus require two scan code. These keys are preceded by an E0 (hex). But it doesn't stop at two scan codes either. How about E1,14,77,E1,F0,14,F0,77! Now that can't be a valid scan code? Wrong again. It's happens to be sent when you press the Pause/break key. Don't ask me why they have to make it so long! Maybe they were having a bad day or something? When an extended key has been released, it would be expect that F0 would be sent to tell you that a key has been released. Then you would expect E0, telling you it was an extended key followed by the scan code for the key pressed. However this is not the case. E0 is sent first, followed by F0, when an extended key has been released.

Scan Codes
The diagram below shows the Scan Code assigned to the individual keys. The Scan code is shown on the bottom of the key. E.g. The Scan Code for ESC is 76. All the scan codes are shown in Hex.

59

Passive keyless lock

As you can see, the scan code assignments are quite random. In many cases the easiest way to convert the scan code to ASCII would be to use a look up table. Below is the scan codes for the extended keyboard & Numeric keypad.

The Keyboard's Connector The PC's AT Keyboard is connected to external equipment using four wires. These wires are shown below for the 5 Pin DIN Male Plug & PS/2 Plug.

5 Pin DIN

1. KBD Clock 2. KBD Data 3. N/C 4. GND 5. +5V (VCC) PS/2

1. KBD Clock 2. GND 3. KBD Data 4. N/C 5. +5V (VCC) 6. N/C

A fifth wire can sometimes be found. This was once upon a time implemented as 60

Passive keyless lock

a Keyboard Reset, but today is left disconnected on AT Keyboards. Both the KBD Clock and KBD Data are Open Collector bi-directional I/O Lines. If desired, the Host can talk to the keyboard using these lines.

Ked to Host Communication As mentioned before, the PC's keyboard implements a bi-directional protocol. The keyboard can send data to the Host and the Host can send data to the Keyboard. The Host has the ultimate priority over direction. It can at anytime (although the not recommended) send a command to the keyboard. The keyboard is free to send data to the host when both the KBD Data and KBD Clock lines are high (Idle). The KBD Clock line can be used as a Clear to Send line. If the host takes the KBD Clock line low, the keyboard will buffer any data until the KBD Clock is released, ie goes high. Should the Host take the KBD Data line low, then the keyboard will prepare to accept a command from the host. The transmission of data in the forward direction, ie Keyboard to Host is done with a frame of 11 bits. The first bit is a Start Bit (Logic 0) followed by 8 data bits (LSB First), one Parity Bit (Odd Parity) and a Stop Bit (Logic 1). Each bit should be read on the falling edge of the clock.

The above waveform represents a one byte transmission from the Keyboard. The keyboard may not generally change it's data line on the rising edge of the clock 61

Passive keyless lock

as shown in the diagram. The data line only has to be valid on the falling edge of the clock. The Keyboard will generate the clock. The frequency of the clock signal typically ranges from 20 to 30 Khz. The Least Significant Bit is always sent first. Reading Bytes from the Keyboard If the KBD Clock line is taken low, the keyboard will buffer any keys pressed. The Keyboard will only attempt to send when both the Data and Clock lines are idle (high). As it can take considerable time to decode the keys pressed, we must stop the keyboard from sending data. If not, some of the data may be lost or corrupted. So we have to keep the KBD Clock line low, unless keyboard is ready to accept data. We will use a loop to retrieve the data bits from the keyboard, thus we will load index register X with the number of bits be want to receive. PAR will be used to verify the parity bit at the end of the transmission. We must clear this first. We can then place the KBD Clock line in the idle state so that the keyboard will start transmitting data if a key has been pressed. The program then loops while the clock line is Idle. If the KBD clock goes low, the loop is broken and the KBD Data pin is read. This should be the start bit which should be low. If not we branch to the start of the receive routine and try again. Once the start bit has been detected, the 8 data bits must follow. The data is only valid on the falling edge of the clock. After the falling edge we can read the level of the KBD Data line. If it is high we can set the MSbit of the byte or if it is clear, we can clear it. You will notice if the bit is set, we also increment PAR. This keeps track of the number of 1's in the byte and thus can be used to verify the Parity Bit. Index register X is decremented as we have read a bit. It then repeats the above process, until the entire 8 bits have been read. After the 8 data bits, comes the dreaded parity bit. We could ignore it if we wanted to, but we may as well do something about it. We have been keeping a tally of the number of 1's in PAR. The keyboard uses odd parity, thus the parity bit should be the complement of the LSbit in memory location, PAR. By exclusive OR-ing PAR with the Parity Bit, we get a 1 if both the bits are different. I.e. a '1' if the parity bit checks out. As we are only interested in the LSbit we can quite happy XOR the accumulator with PAR. Then we single out the LSb using the AND function. If the resultant is zero, then a parity error has occurred and the program branches to r_error. After the Parity Bits comes the Stop Bit. Once again we can ignore it if we desire. However we have chosen to branch to an error routine if this occurs. The stop bit should be set, thus an error occurs when it is clear. When an error occurs in the Parity or Stop Bit we should assume that the rest of the byte could have errors as well. We could ignore the error and process the received byte, but it could have unexpected results. Instead the keyboard has a resend command. If we issue a resend (FE) to the keyboard, the keyboard should send the byte back again. This is what occurs here.

62

Passive keyless lock

Reading a byte doesn't really require bi-directional data and clock lines. If you can process the byte fast enough then no handshaking (RTS) is required.

CHAPTER-10 LED- INTERFACING

D L D L D L D L D L D L D L D L E E E E E E E E

1 D 2 D 3 D 4 D 5 D 6 D C 7 D 8 D C C R ? A Y P S N T A P R R 1 1 1 L3 A 3 3 3 3 3 3 3 3 1 2 3 4 5 6 7 8 Y ? U 9 8 7 6 5 4 3 2 P P P P P P P P P P P P P P P P ? 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

V C C

4 0
. . . . . . . . . . . . . . . . 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 / / / / / / / / A A A A A A A A DP DP PD PD PD PD PD PD 20 21 22 23 24 25 26 27 . . . . . . 2 1 . 0 2 / 2A . 1 2 / 3A 2 2/ A 4 3 2/ A 5 4 2/ A 6 5 2/ A 7 6 2/ A 8 7 / A 1 1 1 1 1 1 8 9 0 1 2 3 4 5

1 0 / T P2 3 . 0 /1 R 1 X D / T P2 -3 E . 1X /1 T 2 X D P 3 . 2 / 1 I N3 T O P 3 . 3 /1 I N T 1 4 P 3 . 4 1 / 5T O P 3 . 5 1 / 6T 1 P 3 . 6 1/ W7 R P 3 . 7 / R D 1 2 A P 5 P L P E S E / P 2 3 9 N 0 R O G

9 8 X T A L 9 X T A L R S T 1 E T A 8 9 / V C

22 0

63

Passive keyless lock

CHAPTER-11 STEPPER MOTOR


Motion Control, in electronic terms, means to accurately control the movement of an object based on either speed, distance, load, inertia or a combination of all these factors. There are numerous types of motion control systems, including; Stepper Motor, Linear Step Motor, DC Brush, Brushless, Servo, Brushless Servo and more. A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. Stepper motor is a form of ac. motor .The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied [39]. For every input pulse, the motor shaft turns through a specified number of degrees, called a step. Its working principle is one step rotation for one input pulse. The range of step size may vary from 0.72 degree to 90 degree. In position control application, if the number of input pulses sent to the motor is known, the actual position of the driven job can be obtained. A stepper motor differs from a conventional motor (CM) as under: Input to SM is in the form of electric pulses whereas input to a CM is invariably from a constant voltage source. A CM has a free running shaft whereas shaft of SM moves through angular steps. In control system applications, no feedback loop is required when SM is used but a feedback loop is required when CM is used. A SM is a digital electromechanical device whereas a CM is an analog electromechanical device .

OPEN LOOP OPERATION


One of the most significant advantages of a stepper motor is its ability to be accurately controlled in an open loop system. Open loop control means no feedback information about position is needed. This type of control eliminates the need for expensive sensing and feedback devices such as optical encoders. Control position is known simply by keeping track of the input step pulses . Every stepper motor has a permanent magnet rotor (shaft) surrounded by a stator. The most common stepper motor has four stator windings that are paired with a center-tapped 64

Passive keyless lock

common. This type of stepper motor is commonly referred to as a four- phase stepper motor. The center tap allows a change of current direction in each of two coils when a winding is grounded, thereby resulting in a polarity change of the stator. Notice that while a conventional motor shaft runs freely, the stepper motor shaft moves in a fixed repeatable increment which allows one to move it to a precise position. This repeatable

Rotor Alignment fixed movement is possible as a result of basic magnetic theory where poles of the Same polarity repel and opposite poles attract. The direction of the rotation is dictated by the stator poles. The stator poles are determined by the current sent through the wire coils. As the direction of the current is changed, the polarity is also changed causing the reverse motion of the rotor. The stepper motor used here has a total of 5 leads: 4 leads representing the four stator windings and 1 common for the center tapped leads. As the sequence of power is applied to each stator winding, the rotor will rotate. There are several widely used sequences where each has a different degree of precision. Table shows the normal 4-step sequence. For clockwise go for step 1 to 4 & for counter clockwise go for step 4 to 1.
W i n d i n g W i n d i n g A1 2 3 B

W i n d i n g

6 W Ci n d i n g

Stator Windings Configuration Winding B Winding C Winding D 65

Step

Winding

Passive keyless lock

A 1 2 3 4 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0

Input Sequence to the Windings Step Angle & Steps per Revolution Movement associated with a single step, depends on the internal construction of the motor, in particular the number of teeth on the stator and the rotor. The step angle is the minimum degree of rotation associated with a single step. Step per revolution is the total number of steps needed to rotate one complete rotation or 360 degrees (e.g., 180 steps * 2 degree = 360) [31]. Since the stepper motor is not ordinary motor and has four separate coils, which have to be energized one by one in a stepwise fashion. We term them as coil A, B, C and D. At a particular instant the coil A should get supply and then after some delay the coil B should get a supply and then coil C and then coil D and so on the cycle continues. The more the delay is introduced between the energizing of the coils the lesser is the speed of the stepper motor and vice versa.
1 2 3 M M G O 2 T O R S T E P P E R

V Q 1

2C
P N P 3 6 9 Q 2 Q 3

Q 4 3 6 9

R 4

R 5

4 7 0

o h m

4 U

1 1 4 2

1 5

3 1 6

4 1 7 5 1 8

6 1 9 7

2 0 8 2 1

9 2 2 1 0 2 3

1 1 2 4 1 2

P C

1 O N N E C T O R D B 2 5

2 5 1 3

66

Passive keyless lock

CHAPTER-12

67

Passive keyless lock

CHAPTER-13 KEY-CODING
68

Passive keyless lock

#INCLUDE<REG52.H> #INCLUDE<INTRINS.H> #INCLUDE<DELAY.H> #INCLUDE<SERIAL.H> #DEFINE LED1 P20 #DEFINE LED2 P26 VOID MAIN() { UNSIGNED CHAR IN; INIT_SERIAL(9600); LED1=LED2=0; SECDELAY(1); LED1=LED2=1; SECDELAY(1); LED1=LED2=0; SECDELAY(1); LED1=LED2=1; SECDELAY(1);

WHILE(1) { IF(RI==1) { LED1=0; IN=SBUF; LED1=1; } IF(IN=='A') {


69

Passive keyless lock

LED2=0; SEND('B'); LED2=1; } } }

CHAPTER-14
70

Passive keyless lock

VECHILE CODING

#DEFINE RS P35 #DEFINE RW P36 #DEFINE E P37 #DEFINE DATA P1 #DEFINE BUZZ P27 #DEFINE ST1 P20 #DEFINE ST2 P21 #DEFINE ST3 P22 #DEFINE ST4 P23

#INCLUDE<LCDROUT.H> #INCLUDE<SERIAL.H>

BIT S=0; VOID OPEN() //FUNTION FOR OPEN THE DOOR { UNSIGNED CHAR COUNT=6;

WHILE(COUNT>0) { ST1=0; ST2=ST3=ST4=1; MS_DELAY(50); ST2=0; ST1=ST3=ST4=1; MS_DELAY(50);


71

Passive keyless lock

ST3=0; ST2=ST1=ST4=1; MS_DELAY(50); ST4=0; ST2=ST3=ST1=1; MS_DELAY(50); ST4=ST2=ST3=ST1=1; COUNT--; } } VOID CLOSE() { UNSIGNED CHAR COUNT=6; WHILE(COUNT>0)

72

Passive keyless lock

CONCLUSION
The PIC16F639 device is an easy-to use ,low cost and secure bidirectional communication transponder.This device can be used for various smart hands-free passive keyless entry applications.A basic configuration of the Passive Keyless Entry(PKE)transponder is shown in fig 2.Example schematics for the transponder and the base station are shown in Appendix B:Transponder and Appendix C:Base Station. The firmware examples for the transponder and the base station are also provided .Users can modify the provided examples for their application purposes.

Candidates Declaration
We hereby declare that the major project which is presented in this report entitled GSM operated accident alert system with alcoholic driver detection submitted in the partial fulfillment of the requirements for the award of the degree of Bachelor of Technology in ECE to the PTU, Jalandhar, is an authentic record of our own work carried out at DWIET campus. The material embodied in this project work has not been submitted to any other university or institute for the award of any degree. PRITIKA BHATT RAJWANT KAUR SHEENU SUKHMANI 81008108079 81008108082 81008108086 81008108091

Place: Date:

This is to certify that above statement made by the candidate(s) is correct to the best of my knowledge. 73

Passive keyless lock

Guided by: Er. Parminder Singh Department of ECE Approved by: HOD (ECE) DWIET

REFERENCES Websites
Make ur own microcontroller projects , Online , 3 August 2008 < http://www.strobotics.blogspot.com >
2.

3.

Robokits World RF Modules (Tx + Rx Pair) 433 MHz ASK [RKI-1064] - The RX ASK is an ASK Hybrid receiver module, Online, 15 August 2008 < http://www.robokitsindia.com > Wireless Made Simple - RF module, antenna and connector solutions offer easily applied remote control functionality to your product, Online, 18 August 2008 < http://8051.com > Datasheet search site, datasheets, Datasheet search site for Electronic Components and Semiconductors, integrated circuits, diodes and other semiconductors. Online, 31 August 2008 < http://www.alldatasheet.com > How Stuff Works explains hundreds of subjects, from car engines to lock-picking to ESP, using clear language and tons of illustrations Online, 11 October 2008 < www.howstuffworks.com > Books 1. Author: Muhammad Ali Mazidi & Janice Gillispie Mazidi The 8051 Microcontroller and Embedded system Publisher: PEARSON, Prentice Hall, 1990 74

4.

5.

Passive keyless lock

2.

RS components , Catalog book, 2008

75

You might also like