ug - mini project -drunk and drive detection system

Upload: aarthi

Post on 09-Mar-2016

228 views

Category:

Documents


0 download

DESCRIPTION

Undergraduate Mini Project

TRANSCRIPT

DRUNKEN DRIVING VEHICLE DETECTION

Drunken Driving Vehicle Avoiding-cum-Detector

Through Wireless System

CONTENTS TITLEPAGE NO

ABSTRACT

CHAPTER 1: INTRODUCTION1

CHAPTER 2: BLOCK AND CIRCUIT DIAGRAM3

CHAPTER 3: DISCRIPTION OF BLOCK DIAGRAM7

3.1.SENSOR (TGS813)8

3.2.OP AMP(LN324)8

3.3.DISCRIPTION10

3.4.RF TECHNOLOGY11

3.5.LCD DISPLAY11

3.6.MICRO CONTROLER13

3.7.RELAY14

CHAPTER 4: SENSOR15

4.1.TGS813 SENSOR15

4.2.BASIC MEASURING CIRCUIT WITH 16

TGS SENSOR

CHAPTER 5: MICRO CONTROLER17

5.1.MICRO CONTROLLER VERSUS17

MICRO PROCESSOR

5.2.FEATURES OF AT89C5118

5.3.FLASH MEMORY18

5.4.PIN CONFIGURATION19

5.5.BLOCK DIAGRAM20

5.6.PIN DISCRIPTION OF AT89C205120

5.7.8051 OSCILLATOR AND CLOCK23

5.8.SPECIAL FUNCTION REGISTER 23

MEMORY

5.9.PSW(PROGRAM STATUS 25

WORD;0D0h)

5.10.SBUF(SERIAL BUFFER,99h)26

5.11.INTRUPTS26

CHAPTER 6: DISCRIPTION OF RF 28

COMMUNICATION SYSTEM

6.1.HOW RF WIRELESS CONNECTIVITY 28

WORK

6.2.RF FUNDAMENTAL29

6.3.RF RECEIVER OUTPUT AND IF 29

RECEIVER OUTPUT

6.4.TRANSMITTER MODULE31

6.5.RECEIVER MODULE31

CHAPTER 7: DISCRIPTION ABOUT LCD PANELS35

7.1.SCHMATIC36

7.2.CIRCUIT DISCRIPTION36

CHAPTER 8: RELAY37

SOFTWARE DETAILES39

FLOW CHARTS40

APLLICATION AND ADVANTAGES42

RESULT43

CONCLUSION44

FUTURE SCOPE44

REFERENCE45

APPENDIX46

LIST OF FIGURES

NAME

1.BLOCK DIAGRAM OF TRANSMITTER3

2.BLOCK DIAGRAM OF RECEIVER4

3.CIRCUIT DIAGRAM TRANSMITTER5

4.CIRCUIT DIAGRAM OF RECEIVER6

5.LM324 PIN DIAGRAM

9

6.BASIC MEASURING CIRCUIT WITH TGS 16

SENSOR

7.AT89C2051 PIN DIAGRAM19

8.BLOCK DIAGRAM OF AT89C205120

9.8051 OSCILLATOR AND CIRCUIT28

10.RF FUNDAMENTAL29

11.WIRELESS LINK31

12.RF TRANSMITTER MODULE PIN32

13.RF RECEIVER MODULE34

14.LCD SCHEMATIC36

15.RESULT OF TRANSMITTE AND 43

RECEIVER

ABSTRACT

As everybody knows that the most of road accidents are taking place due to the drunken drivers, especially this problem is severe in high ways and it is very difficult to trace the drunken drivers. These days our patrolling police at high ways and traffic police in cities are checking the drivers through a hand held portable alcohol sensors, but it is very painful activity and also consumes lot of time to check each and every vehicle. There by the present technology implemented here is innovative by which the drunken driver can be caught very easily and the vehicle itself will be stopped while trying to drive by drinking. This technology offers great ease to the police such that they need not stop each and every vehicle for hunting the alcoholic driver.

The purpose of this project work is to avoid drink and driving of the vehicles. For this, an alcohol sensor is placed in the vehicle that senses the smell of alcohol content. Whenever the driver/person who consumed alcohol tries to start the vehicle, the vehicle will not be started avoiding the drunken driving and immediately the alarm will be energized automatically indicating drunken person is trying to drive the vehicle. And if the alcohol is being consumed while driving, the vehicle immediately stops and doesnt move any further again acknowledging by activating the alarm.

To prove the concept practically, each and every vehicle must be installed with an Alcohol sensor inside the vehicle at some feasible point like dashboard, steering, etc. The alcohol sensor is interfaced with an Op-Amp, which is constructed like a voltage comparator. Whenever the alcohol sensor detects any alcoholic gases, the output of the Op-Amp (comparator) is triggered (gives a logic HIGH signal). The triggered output of the comparator is fed to the micro controller.

CHAPTER 1 INTRODUCTIONThe concept described in this project report is aimed to catch the drunken driver, as the concept is critical sophisticated technology must be used to detect exact vehicle that is driven by drunken driver. To achieve the goal accurately, suitable sensors must be used. But here since it is a prototype module, basic concept is proven with universal sensor which can detect all sorts of toxic gases, petroleum products, smoke, etc, in addition to the alcoholic vapors. The sensor used here is named as TGS813. Since it can detect all sorts of toxic vapors and it is available easily every where, it is said to be universal sensor, and this sensor is used here to detect the alcoholic vapors. Presently this kind of sensors can be used for goods transport vehicles, because these vehicles will not carry passengers. When this sensor used in cars, it is difficult to detect the drunken person because of the drunken passengers. Hence it is recommended to use this technology in trucks only, because the truck contain separate cabin for the driver and his assistant. One advantage of using this sensor is that it can not detect little far vapors, because it is not so sensitive. It is said to be advantage because it should not detect other drunken persons those who are little away from the driving wheel. This indicates that the sensor must be installed over the dashboard and that point must be very close to the driving wheel. If this kind of arrangement is made in the cabin, the system can detect only drunken driver. As described above, the sensor is not so sensitive, during demo, the sensor must be exposed to the alcohol vapor. For this purpose pour little alcohol (brandy or whiskey) in to a plate and place the sensor little above the plate with a gap of 2 inches approximately. Depending up on the alcohol vapor concentration in the air, the conductivity of the sensor will be varied and based on this conductivity its output in the form of voltage levels will be varied automatically. These variations are monitored through op-amp and a high signal will be generated whenever the sensor detects vapors in the air. The output of the sensor is used to trigger the Op-amp, this op-amp configured as voltage comparator can generate a logic high signal when sensor output is greater than the reference voltage. Based on this signal, the microcontroller used as processing unit is programmed to deliver the proportionate code through its output. This code contains the information about the vehicle and it will be transmitted through an RF transmitter generates a high frequency of 433MHz as carrier frequency. The digital code produced by the controller will be super imposed over the carrier and transmitted as modulated wave. Based on this data, the receiver decodes this data and displays the information through an LCD interfaced with microcontroller at data receiving end. The information contains vehicle registration number, type of vehicle, owner address, etc. will be displayed. Whenever the system finds drunken driving vehicle, initially alarm will be energized in the data receiving module to alert the squad, and then information will be displayed. As the system utilizes RF communication system and the range is restricted to less than 90-100 feet in the open air because of the low power transmitter, whenever the transmitter is brought within the range receiver will be activated and displays the information. In addition the controller in the transmitting section halts the vehicle and doesnt allow the drunken person to drive the vehicle avoiding drunken driving. Since it is a prototype module low power transmitter is used, but for real applications little high power transmitter can be used, there by the vehicle can be detected little away from the check post. Application point of view, the system designed here can be installed at check posts at high ways. At these places all the vehicles are checked for many purposes, in this regard alcoholic driver can be caught very easily without wasting time. The same system also can be installed in police stations in busy centers of main cities. If the system finds drunken driving vehicle passing near by the station, it will be very easy for the police to catch the driver red-handed.

The technology presented here is very simple, it can be used as demo module, but when it is going to be used for real applications, all the vehicles must be equipped with real sensors which can detect even small concentration of alcohol vapors present in the air. When multiple transmitters are in use, they all must be synchronized with single receiver and receiver should able to detect the drunken driving vehicles independently. Since wireless communication system plays the dominant roll in this project work, the following is the brief introduction about it. The carrier generator in the transmitting module is designed to produce 433MHz approximately; the digital information produced by the microcontroller is super imposed over this carrier and transmitted as a modulated wave. In the receiving module, the received information will be de-modulated and decoded through an embedded system by which information will be displayed. The data transmitting module that contains vehicle information will be the pre-programmed and always it transmits the same information, it can not be modified because it is stored in the ROM of microcontroller internally. To change the source of information, the controller has to be removed from the main board and the source code dumped in to the chip must be erased through chip burner. Again new program must be stored in to the chip, this is called burning process.The system described here utilizes two microcontroller units and these units are also playing dominant roll in this project work. Two different microcontroller units are constructed separately for data transmitting and data receiving modules. For this purpose AT 89C2051 controllers are selected. These chips are belongs to ATMEL family. Since the task of data transmitting unit is to send fixed information always, and where as the data receiving module is to display the received information, higher memory chips are not required here.

Any Micro-controller, that functions according to the program written in it. The program is nothing but an instruction set, this is often prepared in binary code, & are referred as machine code, there by this software is called as machine language. Writing a program in such a code is a skilled and very tedious process Micro controller can read and it can store the information received from the remote control unit. Micro-controllers are dedicated to one task and run CHAPTER 2 BLOCK AND CIRCUIT DIAGRAM 2.1.BLOCK DIAGRAM OF TRANSMITTER:

2.2.BLOCK DIAGRAM OF RECEIVER:

2.3. CIRCUIT DIAGRAM OF TRANSMITTER:

2.4.CIRCUIT DIAGRAM OF RECEIVER:

CHAPTER 3 DESCRIPTION OF BLOCK THE DIAGRAMThe block diagram and circuit diagram shown in the next chapter consists data transmitter and data receiver. The data transmitting unit contains four major devices; they are 1) TGS813 used as alcohol sensor, 2) 89C2051 microcontroller unit, 3) LM 324 Op-amp Chip, 4) Relay, 5) DC Motor and 4) RF transmitter. Similarly the data receiving unit contains three major units; they are 1) RF receiver, 2) Microcontroller unit, and 3) LCD and alarm. As the over all system contains two microcontroller units, the function of microcontrollers differs to each other, two different software programs are prepared to function as data transmitter and data receiver. The data receiver function is to decode the data and display the same through an LCD interfaced with 89C2051 controller through its output. It is also the function of data receiving unit to activate the alarm whenever it receives data from the transmitter. The source of information is the sensor, whenever this sensor is activated by alcohol vapor, op-amp output will become high and this high signal is fed to the microcontroller. This op-amp configured as voltage comparator, generates logic high signal for the controller. Based on this signal the microcontroller generates a digital code and it will be transmitted. More over the vehicle movement is stopped by stopping the DC motor through the relay. In the receiver, the controller is programmed to decode the received information and display the same through LCD. Here this microcontroller is performing the function of decoder. The information gathered from receiver will be decoded and will be displaying the data in the LCD. The received information after demodulating, replica in the form of digital code will be obtained from the receiver; this data will be decoded for display purpose. As the process begins with Alcohol sensor, the following is the description of this sensor, later function of individual blocks description is also provided.

3.1.SENSOR(TGS813)Generally the sensor used here is aimed to detect the gas leakages, since it can detect all types of gasses and smokes it is used as universal sensor and the same sensor is used as alcohol sensor. This sensor contains a semiconductor named as tin dioxide (SnO2);. During our trail runs, we used different types of liquors like brandy, whisky, etc. they are poured in to a small containers and sensor is placed above the container with a distance of one inch approximately. At this distance the concentration will be more and hence it is observed that the sensor generates more than 2V. If the distance is increased, density will be reduced because the liquor vapor will be spread in to the air, so depending up on the distance sensor output also varies proportionately. One important factor to be observed is, the output is not similar when compared with other sensor, hence it is concluded that the output will be differed from sensor to sensor. Finally it is concluded that the output will be 2V approximately, when it detects alcohol vapors. Based on this value reference voltage must be adjusted accordingly in Op-amp circuit. Whenever the sensor output becomes high, i.e. more then the reference voltage, op-amp output will become high.

3.2.OPAMP(LM324)

The output of alcohol sensor is fed to the op-amp input as variable source of voltage which varies according to the density of alcohol vapor present in the air. Here average density is considered and accordingly reference voltage value is adjusted at second input of op-amp. The op-amp used here is configured as voltage comparator, in this configuration difference between the two inputs is monitored, if they are equal to each other then out put of the op-amp will become high. The sensor output is fed to the non-inverting input of op-amp, where as at inverting input side, with the help of a fixed potential dividing network also known as voltage divider circuit, reference voltage is adjusted to 2V approximately. Here average value is also considered as 2V, means when the sensor detects average density of alcohol vapor it may generate around 2V. In normal condition, sensor out put will be less then 1.2V, if the air is polluted with alcohol vapors, then sensor output may raise to more then 2V. When this voltage is equal with the reference voltage or slightly more then the reference voltage, output of op-amp will become high and this high signal is fed the microcontroller for further process. The following is description of op-amp.

3.2.1. LM324

The below is the figure of LM 324 quad operational device showing the function of each pin

3.3.DISCRIPTIONThe LM324 series consists of four independent, high gain, internally frequency compensated operational amplifiers which were designed specifically to operate from a single power supply over a wide range of voltages. Operation from split power supplies is also possible and the low power supply current drain is independent of the magnitude of the power supply voltage.Application areas include transducer amplifiers; DC gain blocks and all the conventional op amp circuits, which now can be more easily implemented in single power supply systems. For example, the LM324 series can be directly operated off of the standard +5V power supply voltage, which is used in digital systems and will easily provide the required interface electronics without requiring the additional 15V power supplies.

The LM324 contains four independent high gain operational amplifiers with internal frequency compensation. The four op-amps operate over a wide voltage range from a single Power supply. Also use a split power supply. The device has low power supply current drain, regardless of the power supply voltage. The low power drain also makes the LM324 a good choice for battery operation. The LM324 series are low-cost, quad operational amplifiers with true differential inputs. They have several distinct advantages over standard operational amplifier types in single supply applications.

3.4.RF TECHNOLOGY

The carrier generator in the transmitting module is designed to produce 433 MHz approximately; the information produced by the microcontroller according to the interrupted signal obtained from the sensor in the form of vehicle information in digital data is super imposed over this carrier and transmitted as a modulated wave. The RF modules (transmitter & receiver) used in the project work are readymade, as the transmitter generating very high frequency of 433 MHz and it is very difficult to construct in normal electronic labs, there by readymade modules are used here.When the receiver is synchronized with the transmitter it can be said as the receiver is tuned with the transmitter, if the receiver is tuned perfectly then the communication link will be established. The transmitting antenna sends out radio waves in all directions. When radio waves leaving through a conductor of specific size is called as transmitting antenna, similarly at the receiving end signals are picked up through another conductor of same length is called as receiving antenna. Here in this project work, as the range is very less, thin copper wires of 20 cms length each is used as antenna.

3.4.1.Working of RF communication systemImagine an RF transmitter wiggling an electron in one location. This wiggling electron causes a ripple effect, somewhat a kind of dropping a pebble in a pond. The effect is an electromagnetic (EM) wave that travels out from the initial location resulting in electrons wiggling in remote locations. An RF receiver can detect this remote electron wiggling. The RF communication system then utilizes this phenomenon by wiggling electrons in a specific pattern to represent information. The receiver can make this same information available at a remote location; communicating with no wires.

In most wireless systems, a designer has two overriding constraints: it must operate over a certain distance (range) and transfer a certain amount of information within a time frame (data rate). Then the economics of the system must work out (price) along with acquiring government agency approvals (regulations and licensing).3.5.LCD DISPLAY

The LCD used here is having two rows and each row contains 16 characters, depending up on the availability of LCD panel 3 lines or 4 lines panels can be used for the purpose, so that more information can be displayed simultaneously. LCD Displays are dominating LED displays, because these displays can display alphabets, numbers and some kind of special symbols, where as LEDs (seven segment display) can display only numbers. These LCD displays are very useful for displaying user information and communication. LCD displays are available in various formats. Most common are 2 x 16, is that two lines with 16 alphanumeric characters. Other formats are 3x16, 2x40, 3x40 In recent years LCD is finding widespread use replacing LEDs, because of the ability to display numbers, characters, and graphics. Another advantage is, because of its compactness and ease of programming for characters and graphics, more information in the form of text message or graphics can be displayed. Generally, the LCD modules have an 8-bit interface, besides the 8-bit data bus; the interface has a few other control lines. The 8-bit data bus is connected to port 0 and the control lines are connected to port 2. The default data transfer between the LCD module and an external device is 8-bits, however it is possible to communicate with the LCD module using only four of the 8-data lines. The R/W line is connected to ground and hence the processor cannot read any status information from the LCD module, but can only write data to the LCD.

The LCD panel used in this project work is having 16 pins. The function of each pin description with table is as followed:

Pin No.NameDescription

Pin no. 1D7Data bus line 7 (MSB)

Pin no. 2D6Data bus line 6

Pin no. 3D5Data bus line 5

Pin no. 4D4Data bus line 4

Pin no. 5D3Data bus line 3

Pin no. 6D2Data bus line 2

Pin no. 7D1Data bus line 1

Pin no. 8D0Data bus line 0 (LSB)

Pin no. 9EN1Enable signal for row 0 and 1 (1stcontroller)

Pin no. 10R/W0 = Write to LCD module1 = Read from LCD module

Pin no. 11RS0 = Instruction input1 = Data input

Pin no. 12VEEContrast adjust

Pin no. 13VSSPower supply (GND)

Pin no. 14VCCPower supply (+5V)

Pin no. 15EN2Enable signal for row 2 and 3 (2ndcontroller)

Pin no. 16NCNot Connected

Vcc, Vss, and VEE: While Vcc and Vssprovide+5V and ground, respectively; VEEis used for controlling LCD contrast.

3.6.MICROCONTROLLER

The microcontroller used in the project work belongs to ATMEL family, for this purpose 89C2051 chip is used. The following is the general and functional description about microcontrollers.

Microcontrollers are single-chip computers consisting of CPU (central processing unit), data and program memory, serial and parallel I/O (input/output), timers, external and internal interrupts, all integrated into a single chip. Microcontrollers are intelligent electronic devices used to control and monitor devices in the real world. Today microcontrollers are used in most commercial and industrial equipment. About 40% of microcontroller applications are in office automation, such as PCs, laser printers, fax machines, and so forth. About one-third of microcontrollers are found in consumer CHAPTER 4

DESCRIPTION ABOUT UNIVERSAL SENSORS4.1.TGS813 SENSORTGS 813 is a general purpose Sensor which has good sensitivity characteristics to a wide range of gases. As this sensor can be used for many applications, it is said as universal sensor. In this project work this sensor is used to detect Alcohol vapors. This device is designed to operate with a stabilized 5V heater supply and a circuit voltage depends up the design. The most suitable application for the TGS 813 is the detection of methane, propane and butane which makes it an excellent Sensor for domestic gas leak detectors.

The initial stabilization time of the TGS 8813 is very short and the relative and elapsed characteristics are very good over a long period of Operation. TGS 813 has a very low sensitivity to 'noise-gases' which considerably reduces the Problem of nuisance alarming. The TGS 8813 is most practically employed in a circuit design which maintains circuit voltages at fixed value of 5V. This voltage rating is very practical when determining design specifications because of the wide range of available components. This makes the use of the TGS 813 an especially economical way to design low-cost, highly reliable gas detection circuits.

Because of its especially high sensitivity to methane, propane and butane, the TGS 813 is very practical for Town Gas and LPG monitoring. With the added features of a short-initial stabilization period and highly reliable elapsed characteristics, the TGS 813 represents a new generation of gas Sensors from Figaro. These sensors are molded with Resin.

4.2.BASIC MEASURING CIRCUIT WITH TGS SENSOR:

The following is the basic test circuit

The Variation in resistance of the TGS sensors measured indirectly as a Change in voltage appearing across the load resistor RL. In fresh air the current passing through the Sensor and RL in series is steady, but when a combustible gas such as propane, methane etc. comes in contact with the Sensor surface, the Sensor resistance decreases in accordance with the gas concentration present. The voltage Change across RL is the same when VC and VH are supplied from AC or DC sources. One can feel that this circuit is most suitable for evaluating the TGS 813 performance because of the ease in measuring the output signal.CHAPTER 5 DESCRIPTION ABOUT MICROCONTROLLERS5.1.MICROCONTROLLER VERSUS MICROPROSSER

A microcontroller differs from a microprocessor in many ways. The first and most important difference is its functionality. In order that the microprocessor may be used, other components such as memory must be added to it. Even though the microprocessors are considered to be powerful computing machines, their weak point is that they are not adjusted to communicating to peripheral equipment.Simply,In order to communicate with peripheral environment, the microprocessor must use specialized circuits added as external chips. In short microprocessors are the pure heart of the computers. This is how it was in the beginning and remains the same today. On the other hand, the microcontroller is designed to be all of that in one. No other specialized external components are needed for its application because all necessary circuits which otherwise belong to peripherals are already built into it. It saves the time and space needed to design a device.

A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single silicon chip. If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM, EPROM and peripherals. But controller is provided all these facilities on a single chip. Development of a Micro controller reduces PCB size and cost of design. One of the major differences between a Microprocessor and a Micro controller is that a controller often deals with bits not bytes as in the real world application. Intel has introduced a family of Micro controllers called the MCS-51.

The AT89C2051 is a 20 pin DIP, low-voltage, high-performance CMOS 8-bit microcomputer with 2 Kbytes of flash programmable and erasable read only memory (PEROM).

5.2.Features of AT89C2051

Compatible with MCS-51 Products

2 Kbytes of Reprogrammable Flash Memory

Endurance: 1,000 Write/Erase Cycles

2.7 V to 6 V Operating Range

Fully Static Operation: 0 Hz to 24 MHz

Two-Level Program Memory Lock

128 x 8-Bit Internal RAM

15 Programmable I/O Lines

Two 16-Bit Timer/Counters

Six Interrupt Sources

Programmable Serial UART Channel

Direct LED Drive Outputs

On-Chip Analog Comparator

Low Power Idle and Power Down Modes

5.2.1.Description

The device is manufactured using Atmels high density nonvolatile memory technology and is compatible with the industry Standard MCS-51 instruction set and pin out. By combining a versatile 8-bit CPU with flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications.

5.3.Flash Memory

Flash memory uses in-circuit wiring to apply the electric field to the entire chip or to the predetermined sections known as blocks. The targeted area of the chip is erased, which can be rewritten. Flash memory works much faster than traditional EEPROMs because instead of erasing one byte at a time, it erases a block or the entire chip and then rewrites it.

Flash memory is a non-volatile memory combining the advantages of EPROM/EEPROM, ROM, and DRAM.

The technology used by Intel is further classified based on the core memory cell. The first technology is the original single-bit/cell flash memory which allows a single bit of information to be stored in each cell (1=erased and 0=programmed).

5.4.PIN CONFIGURATION OF AT89C2051

Pin configuration of AT89C2051

5.5.Block Diagram

Block Diagram of AT89C2051

5.6.Pin Description of AT89C2051

5.6.1.VCC

Supply voltage.

5.6.2.GND

Ground.

5.6.3.Port 1

Port 1 is an 8-bit bidirectional I/O port. Port pins P1.2 to P1.7 provides internal pull-ups. P1.0 and P1.1 requires external pull-ups. P1.0 and P1.1 also serves as the positive input (AIN0) and 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 because of the internal pull-ups. Port 1 also receives code data during Flash programming and program verification.

5.6.4.Port 3Port 3 pins P3.0 to P3.5, P3.7 are seven bidirectional 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 because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C2051 as listed in the table 11.1 [refer Appendix]. Port 3 also receives some control signals for Flash programming and programming verification.Pin Details of AT89C2051 Port3

5.6.5.RST

Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for two machine cycles, while the oscillator is running will reset the device. Each machine cycle takes 12 oscillator or clock cycles.

5.6.6.XTAL1

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

5.6.7.XTAL2

Output from the inverting oscillator amplifier.

A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single silicon chip. If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM, EPROM and peripherals.

But controller is provided all these facilities on a single chip. Development of a Micro controller reduces PCB size and cost of design. One of the major differences between a Microprocessor and a Micro controller is that a controller often deals with bits not bytes as in the real world application.

Intel has introduced a family of Micro controllers called the MCS-51.The microcontroller plays the major role in any embedded project. In this project we use two microcontrollers they are made by the ATMEL Company. That is AT89C2051 Controllers5.7. 8051 Oscillator and Clock

The heart of the 8051 circuitry that generates the clock pulses by which all the internal all internal operations are synchronized. Pins XTAL1 And XTAL2 is provided for connecting a resonant network to form an oscillator. Typically a quartz crystal and capacitors are employed. The crystal frequency is the basic internal clock frequency of the microcontroller. The manufacturers make 8051 designs that run at specific minimum and maximum frequencies typically 1 to 16 MHz.

5.8.Special Function registered memorySpecial function registers are the areas of memory that control specific functionality of the 8051 micro controller.5.8.1.Stack pointer (81h)

The stack pointer holds 8-bit value. This is used to indicate where the next value to be removed from the stack should be taken from. When a value is to be pushed onto the stack, the 8051 first stores the value of SP and then store the value at the resulting memory location. When a value is to be popped from the stack, the 8051 returns the value from the memory location indicated by SP and then decrements the value of SP.

5.8.2.Data pointer

The SFRs DPL and DPH work together work together to represent a 16-bit value called the data pointer. The data pointer is used in operations regarding external RAM and some instructions code memory. It is a 16-bit SFR and also an addressable SFR.5.8.3.Program counter

The program counter is a 16 bit register, which contains the 2 byte address, which tells the 8051 where the next instruction to execute to be found in memory. When the 8051 is initialized PC starts at 0000h. And is incremented each time an instruction is executes. It is not addressable SFR.

5.8.4.PCON (power control, 87h)

The power control SFR is used to control the 8051s power control modes. Certain operation modes of the 8051 allow the 8051 to go into a type of sleep mode which consumes much less power.

PCON REGISTER

5.8.5.TCON (timer control, 88h)

The timer control SFR is used to configure and modify the way in which the 8051s two timers operate. This SFR controls whether each of the two timers is running or stopped and contains a flag to indicate that each timer has overflowed. Additionally, some non-timer related bits are located in TCON SFR. These bits are used to configure the way in which the external interrupt flags are activated, which are set when an external interrupt occurs.

TCON REGISTERS

5.8.6.TMOD (Timer Mode, 89h)The timer mode SFR is used to configure the mode of operation of each of the two timers. Using this SFR your program may configure each timer to be a 16-bit timer, or 13 bit timer, 8-bit auto reload timer, or two separate timers. Additionally you may configure the timers to only count when an external pin is activated or to count events that are indicated on an external pin.

TMOD5.8.7.TO (Timer 0 low/high, address 8A/8C h) These two SFRs taken together represent timer 0. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when they increment in value.

5.9.PSW (Program Status Word, 0D0h)

The program Status Word is used to store a number of important bits that are set and cleared by 8051 instructions. The PSW SFR contains the carry flag, the auxiliary carry flag, the parity flag and the overflow flag. Additionally, it also contains the register bank select flags, which are used to select, which of the R register banks currently in use.

PSW registers5.10.SBUF (Serial Buffer, 99h)

SBUF is used to hold data in serial communication. It is physically two registers. One is writing only and is used to hold data to be transmitted out of 8051 via TXD. The other is read only and holds received data from external sources via RXD. Both mutually exclusive registers use address 99h.5.11.INTERRUPTS

Interrupts are hardware signals that are used to determine conditions that exist in external and internal circuits. Any interrupt can cause the 8051 to perform a hardware call to an interrupt handling subroutine that is located at a predetermined absolute address in the program memory.

Five interrupts are provided in the 8051. Three of these are generated automatically by the internal operations: Timer flag 0, Timer Flag 1, and the serial port interrupt (RI or TI) Two interrupts are triggered by external signals provided by the circuitry that is connected to the pins INTO 0 and INTO1. The interrupts maybe enable or disabled, given priority or otherwise controlled by altering the bits in the Interrupt Enabled (IE) register, Interrupt Priority (IP) register, and the Timer Control (TCON) register. . These interrupts are mask able i.e. they can be disabled. Reset is a non maskable interrupt which has the highest priority. It is generated when a high is applied to the reset pin. Upon reset, the registers are loaded with the defaultvalues.

Each interrupt source causes the program to do store the address in PC onto the stack and causes a hardware call to one of the dedicated addresses in the program memory. The appropriate memory locations for each for each interrupt are as follows:

Interrupts

Interrupt Address

RESET0000

IE0 (External interrupt 0) 0003

TF0 (Timer 0 interrupt) 000B

IE1 (External interrupt 1)0013

TF1 (Timer 1 interrupt)001B

SERIAL0023

5.11.1.T1 (Timer 1 Low/High, address 8B/ 8D h)

These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up.

5.11.2.IE (interrupt enable, 0A8h)

The Interrupt Enable SFR is used to enable and disable specific interrupts. The low 7 bits of the SFR are used to enable/disable the specific interrupts, where the MSB bit is used to enable or disable all the interrupts. Thus, if the high bit of IE is 0 all interrupts are disabled regardless of whether an individual interrupt is enabled by setting a lower bit.

CHAPTER 6 DESRIPTION ABOUT RF COMMUNICATION SYSTEM

As we know, radio frequencies refer to the frequencies that fall within the electromagnetic spectrum associated with radio wave propagation. When applied to an antenna, RF current creates electromagnetic fields that propagate the applied signal through space. Any RF field has a wavelength that is inversely proportional to the frequency and this means that the frequency of an RF signal is inversely proportional to the wavelength of the field.

6.1.How RF wireless connectivity work

RF is commonly used in the wireless communications industry to describe certain types of equipment, which use radio frequency waves to transmit sounds and data from one point to another. In computer networking, RF is used to describe network devices such as hubs or bridge that transmits data signals using radio waves instead of data cables or telephone lines. Even though the phrase "RF wireless networking" might seem mysterious, the underlying technology is very common. It uses radio waves, the same type of energy used to transmit radio and television broadcasting. Two-way radios and walkie-talkies also use this kind of technology.

In the middle of the radio transmission and receiving process sit two antennas in two different places which is one located at the point for transmitting the signal and the other point is for receiving the signal. In order to transmit the modulated radio signal, an electrical current will pass through the antenna inducing a magnetic field, which oscillates at the given frequency. The variations in the current create slight variations in the radio frequency. Thus, we should remember that the range we get depends on terrain, obstructions, and height of antenna. Buildings can reflect RF energy making it difficult or impossible to receive the desired signal. Also, if a reflected signal is bounced off of a building or other object, it can be received along with the direct signal. If the reflected signal is out of phase with the direct signal, it is possible for the direct signal to be partially cancelled by the weaker, reflected signal. Hence, the ideal conditions for best transmission and reception signal are line of sight and outside with no obstructions. An RF wireless communication system operating in the presence of a periodic noise environment, includes first and second wireless devices, each such device having a source of power, a transceiver coupled to the power source, for transmitting and receiving wireless information, a controller or CPU for controlling the operation of the transceiver; means for detecting and mapping the presence of the RF radiated periodic noise and means responsive to the mapped periodic noise for controlling the operation of the transceiver to communicate with the other wireless device during the quiescent periods of the radiated RF periodic noise. Then the CPU will control the operation of the transceiver in response to the mapped radiated RF periodic noise to communicate with the other wireless device during the quiescent periods of the radiated RF periodic noise by enabling the transmitter to transmit when it predicts the periodic noise is in the quiescent state, thereby making the transmission process efficient.

6.2.RF fundamental

The wireless link consists of a transmitter with antenna, a transmission path and the receiver with antenna. Parameters of interest are the output power of the transmitter and the sensitivity of the receiver. Below figure illustrates the link principle.

6.3.Wireless link

Sensitivity is the minimum received power that results in a satisfactory Bit Error Rate (BER, usually 110-3) at the received data output (i.e. correct demodulation). The difference between received signal power and sensitivity is the transmission link margin also known as headroom. Headroom is reduced by a number of factors such as transmission path length, antenna efficiency, carrier frequency and physical characteristics of obstructions in the transmission path. Sensitivity and output power given in the RF-circuit datasheets are given for the load impedance, which is optimal for the input LNA and the output power amplifier. This means that the impedance of the antenna used must be equal to the load stated in the datasheet; otherwise mismatch and loss of headroom occur. A typical matching network introduces in the order of 1-3 dB of attenuation.

Radio Frequency (RF) waves are lower in frequency and longer in wavelength than Infrared. At 300 MHz the wavelength is 1 m (39.37") while Consumer IR wavelengths are just under 1 millionth of a meter. Most RF remotes use a carrier in the 300-1000 MHz range.

RF receiver only needs to be tuned to the carrier frequency used by the remote. RF remotes and their receivers are tuned to a fixed frequency. The FCC allows unlicensed, low power use of 300MHz-1000MHz as well as some higher frequency bands.

As a general rule, the codes are comprised of pulses and spaces with durations of 0.3-1.5 ms, which is an audible signal in the 500-2000 Hz range as shown in below figure. The IR and RF receivers output the demodulated code waveform. The only difference is that IR receivers output an active low or inverted signal while RF receivers output an active high signal as shown on below figure.

RF Carrier

6.4.RF Receiver output & IF Receiver output

Other than range, it really makes no difference whether the data signal is used to modulate an RF carrier, an IR carrier, an ultrasonic carrier, a laser beam, or smoke. At the receiving end, the demodulated signal carries the same information. For RF control, both the transmitter and receiver need to be tuned to the same carrier frequency and need to use the same type of modulation.

Most RF remotes use ASK (Amplitude Shift Keying) or OOK (On-Off Keying). OOK is really just a special case of ASK. OOK is also called CPCA (Carrier Present, Carrier Absent). All of the illustrations above represent ASK. FSK (Frequency Shift Keying) uses two different carrier frequencies to denote two different states.

6.5.Transmitter module

A transmitter is an electronic device, which with the aid of an antenna propagates an electromagnetic signal such as radio, television, or other telecommunications. A transmitter usually has a power supply, an oscillator, a modulator, and amplifiers for audio frequency (AF) and radio frequency (RF). The modulator is the device modulates the signal information onto the carrier frequency, which is then broadcast.

Sometimes a device like cell phone contains both a transmitter and a radio receiver, with the combined unit referred to as a transceiver. More generally and in communications and information processing, a "transmitter" is any object or source, which able to sends information to an observer or receiver. When used in this more general sense, vocal cords may also be considered an example of a "transmitter".

The transmitter module in Figure 2.5 was a RF transmitter, which used in this project. The RF transmitter is placed at transmitter board inside the bus. The frequency range for this types of transmitter is 433 MHz and the modulation mode is ASK or amplitude shift keying mode. The temperature maximum rating is 230 C. The actual range for data transmitting is from 100 m to 150 m but its depends on the stability of power supply.

Whenever possible avoid using breadboard or vary-board with RF transmitter. The long tracks inside these types of prototyping board introduce large capacitances or inductances to the circuit, which can badly distort radio frequency signals. Ideally Prototype or evaluation PCB should be used. Tracks connected to the antenna pin of transmitter modules should be as short as possible. Any conductor connected to this track will act as an antenna, so it will lengthen and detune the actual antenna. The suitable length of antenna for 433 MHz RF transmitter is 16 cm and above.

6.6.Receiver module

The receiver in information theory is the receiving end of a communication channel. It receives decoded messages or information from the sender, who first encoded them. Sometimes the receiver is modeled so as to include the decoder. Real world receivers like radio receivers or telephones cannot be expected to receive as much information as predicted by the theorem. The receiver is designed to work with the matching transmitter. With the addition of simple antenna the pair may be used to transfer serial data up to 200 m. The range of the system depends upon several factors, principally the type of antenna employed and the operating environment. The 200 m quoted range is a reliable operating distance over open ground using 1/4 whip antenna at both ends of the link at 1.5 meters above ground.

Smaller antenna, interference or obstacles such as building will reduce the reliable working range (down to 30 meters in extreme cases). Increased antenna height, slow data or a larger receive antenna will increase the range. The RF module frequency is from 300 MHz to 434 MHz. Its high sensitivity passive design is simple to use with a low external parts count. An ASK data shaping comparator is included [5]. RF receiver in Figure 2.6 was the other type of super heterodyne receiver. This type of receiver supports the working frequency from 315 MHz to 433 MHz.

Pin description of Receiver:

Pin 1: Ground (-5V)

Pin 2: Output pin for digital data received

Pin 3: Output pin for analog data received

Pin 4: Supply (+5V)

Pin 6 & 7: Ground (-5V)

Pin 8: Pin for external RF Antenna

The receiving sensitivity for this RF receiver is -101 dBm and the operating voltage supply is from 3 V to 6 V. Applying SAW crystal oscillations overcomes easy frequency excursion of LC circuit was the advantages of this RF receiver. Most parts of module are integrated into the chip 3310A, less external components, stable and reliable performance, and excellent anti-jamming ability.

The output data signal is TTL and can be directly connected to decoder. The antenna must be set to 16 cm length if the operating frequency is 433 MHz. These types of receiver are quite popular around few countries in Asia because its easy to get and the market is very wide compare to the European model of RF receiver. CHAPTER 7 DESCRIPTION ABOUT LCD PANELS

In a typical RGB display, the color filter is integrated into the upper glass colored microscopically to render each individual pixel either red, green or blue. The areas in between the colored pixel filter areas are printed black to increase contrast. After a beam of light passes through the color filter, it passes through yet another polarizer to sharpen the image and eliminate glare. The image is then available for viewing.

In an AMLCD, each LCC is stimulated individually by a dedicated transistor or diode. The two existing AMLCD technologies are Thin Film Transistor (TFT) and metal-insulator-metal (MIM). In an MIM display, dedicated diodes are fabricated at each pixel, whereas a TFT display uses a thin film transistor matrix, with one transistor at each pixel. MIM displays, currently being manufactured by Toshiba and Seiko-Epson, are not advantageous in terms of performance, although they cost somewhat less to manufacture than TFT displays("Amorphous Silicon"). This document will focus on TFT technology.

7.1.Schematic

7.2.Circuit Description

The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all the examples, I've left the power supply out. You can use a bench power supply set to 5v or use a onboard +5 regulator. Remember a few de-coupling capacitors, especially if you have trouble with the circuit working properly.

The 2 line x 16 character LCD modules are available from a wide range of manufacturers and should all be compatible with the HD44780. The one I used to test this circuit was a Power tip PC-1602F and an old Philips LTN211F-10 which was extracted from a Poker Machine! The diagram to the right, shows the pin numbers for these devices. When viewed from the front, the left pin is pin 14 and the right pin is pin 1.

CHAPTER 8

RELAY

A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. A relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier. So a relay can be defined as an automatic electromagnetic/electronic switch, which can be used to make or break the circuit. The detailed description of the relay is provided in the further chapters. In this project two relays are used to control the cooling fan and the DC motor individually.

A relay is an electrical switch that opens and closes under control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. These contacts can be either Normally Open (NO), Normally Closed (NC), or change-over contacts.

Normally-open contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called Form A contact or "make" contact. Form A contact is ideal for applications that require to switch a high-current power source from a remote device.

Normally-closed contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called Form B contact or "break" contact. Form B contact is ideal for applications that require the circuit to remain closed until the relay is activated.

Change-over contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called Form C contact.

8.1.OPERATIONThe relays used in this project work are electromagnetic relays. The electromagnetic relay is basically a switch (or a combination of switches) operated by the magnetic force generated by a current flowing through a coil. Essentially, it consists of four parts an electromagnet comprising a coil and a magnetic circuit, a movable armature, a set of contacts, and a frame to mount all these components. However, very wide ranges of relays have been developed to meet the requirements of the industry. This relay is nothing but a switch, which operates electromagnetically. It opens or closes a circuit when current through the coil is started or stopped. When the coil is energized armature is attracted by the electromagnet and the contacts are closed. That is how the power is applied to the signals (indicators). In other words, the core acts as an electromagnet and attracts the metal armature. When the armature is attracted to the core, the magnetic path is from the core through armature, through the frame, and back to the core. On removing the voltage the spring attached to the armature returns the armature to its original position. In this position, there is a small air-gap in the magnetic path. Hence, more power is needed to pull in the armature than that needed to keep it held in the attracted position.

In this project relay is used to control the DC motor. When the voltage obtained from the gas sensor is greater than the reference voltage value set in the controller programming, the controller deactivates the relay by which the DC motor will be stopped and also energizes the alarm. Simultaneously the information is also transmitted through the RF transmitter. Details about the LCD and other major components are provided in the further chapters.

SOFTWARE DETAILS

KEIL SOFTWARE

FLOW CHART

APPLICATION AND ADVANTAGESAPPLICATIONS:

1. The system designed hear can be installed at check post at high ways.

2. The same system also can be installed in police stations in busy centers of main cities.

ADVANTAGES:

1. By this method we can avoid accidents.

2. The drunken and driver can be caught very easily.3. one way of avoid to drinking.

RESULT TRANSMITTERRECEIVER CONCLUSION As the technology advances, particularly in the field of world-wide wireless networks, people are expecting improved quality service for various other applications in addition to the personal communications. Here in this project work RF technology is used to transmit the drunken driving vehicle information to the remote monitoring unit where concern authority is monitoring the system to catch the drunken driver. In this regard other wireless networks like GSM modules, Zigbee modules, etc. can be used to increase the range. But here importance is not given for the range; moreover it is also not required in this concept. The concept is to catch the drunken driver through short range communication system such that whenever the vehicle came near to the monitoring authority, vehicle is supposed to be seized. When this kind of system is used at check posts at high ways, as all the vehicles are stopped for checking, drunken driving vehicle can be detected very easily. For this kind of applications short range communication networks helps the authority to locate the vehicle very easily. FUTURE SCOPE1. By using ZIGBEE module we can increase the distance of dectection.

2. By using GSM module we can send information by message.

3. Since it is only used in automobile,in future we can implement the same technique in two and thre wheeler. REFERENCES The following are the references made during design, development and fabrication of the project work. Books(1) Electronic Circuit guide book Sensors By JOSEPH J.CARR

(2) Op-Amps Hand Book

- By: MALVIND

(3) Relays and their applications - By: M.C.SHARMA

(4) Fundamental of Radio Communication: By A.SHEINGOLD

(5) Digital Communications; By SIMON HAYKIN (6) Linear Integrated Circuits By: D. Roy Choudhury, Shail Jain

(7) The 8051 Micro-controller Architecture, programming & Applications By: Kenneth J. Ayala(8) Programming and Customizing the 8051 Micro-controller By: Myke Predko(9) The concepts and Features of Micro-controllers By: Raj Kamal(10) Digital and Data Communications; By MICHAEL A. MILLER. (11) Basic Radio & television By: S. P. Sharma

APPENDIX

TRANSMITTER:#include#include

Main ( )ORG 000HRT:

Clr p1.4;rly

Setb p1.3;start

MOV SCON,#40H

MOV TMOD,#20H

MOV TH1,#E8H

CLR TI

SETB TR1

MAIN:

JB p1.3,$

MAIN1:

JNB p1.5,EXIT ;alcoholCLR p1.4

MOV SBUF,#0ABH

JNB TI,$

CLR TI

MOV SBUF,#0CDH

JNB TI,$

CLR TI

LJMP MAIN

EXIT:

SETB p1.4

LJMP MAIN1

END

RECEIVERCOUNT DATA 30H

COUNT1 data 31h

COUNT2 DATA 32H

RS BIT p3.1

EN BIT p3.7

BUZ BIT p3.5

LED BIT p3.3

Org 00h

CLR BUZ

MOV COUNT,#00H

MOV COUNT 1,#00H

MOV COUNT2,#00H

mov a,#38h ;2 line lcd initialization

lcall com

lcom delay

mov a,#01h;clear the screen

lcall com

lcall delay

mov a,#14h

lcall com

lcall delay

lcall welcome

LCALL DDELAY

LCALL DDELAY

mov a,#0h;clear the screen

lcall com

lcall delay

ST:

acall sinit1

STT:MOV A,#80H

LCALL COM

LCALL DELAY

VBN:

JNB RI,VBN

CLR RI

MOV A,SBUF

CJNE A,#0ABH,VBN

SETB BUZ

SETB LED

MOV A, #080H

LCALL COM

LCALL DELAY

LCALL ALC1

SETB BUZ

LJMP $

Siniti:

mov SCON,#50h

mov TMOD,#20h

mov TH1,#0E8H

setb TR1

ret

com:

mov p1,a

clr rs

setb en

ret

Rata:

mov p1,a

setb rs

setb en

clr en

ret

ddelay:MOV R4,#90

Zz21z: MOV R5,#90

Zz11z: MOVR6,#90 DJNZ R6,$

DJNZ R5,Zz11z

DJNZ R4,Zz21z

RET

delay:

mov r2,#20h

ll7B: mov r3,#22h

djnz r3,$

djnz r2,ll7B

ret

WELCOME: mov dptr,#0500h ;welcome mov r6,#12h

ll8:

movc a,@a+dptr

lcall rata

lcall delay

inc dptr

djnz r6,ll8 RET

ALC1: mov dptr,#0600h ;welcome

mov r6,#12h

ll86:

movc a,@a+dptr

lcall rata

lcall delay

inc dptr

djnz r6,ll86

RET

Org 0500h

db _ _ _ WELCOME_ _ _

org 0600h db ALCHOL DRNK IDNT

END

STOP

START

SENSOR

OP-AMP

A

MICRO

CONTROLLER

OP-AMP

DC-MOTOR

RELAY

MICRO

CONTROLLER

A

RELAY

(ON)

RF-TRANSMITTER

RF-RECEIVER

DC-MOTOR

(OFF)

STOP

ALARM

LCD

MICRO

CONTROLLER

_1262866132.doc