Você está na página 1de 25


Description: The Objective of this project is to develop a system to keep the vehicle secure and protect it by the occupation of the intruders. Scope: We cant take care of ours while in running by less conscious. If we done all the vehicles with automated security system that provides high security to driver, also gives alarm. Function: This project involves measure and controls the eye blink using IR sensor. The IR transmitter is used to transmit the infrared rays in our eye. The IR receiver is used to receive the reflected infrared rays of eye. If the eye is closed means the output of IR receiver is high otherwise the IR receiver output is low. This to know the eye is closing or opening position. This output is give to logic circuit to indicate the alarm. This project involves controlling accident due to unconscious through Eye blink. Here one eye blink sensor is fixed in vehicle where if anybody looses conscious and indicate through alarm.

CONTENTS 1. Introduction ....... 6 2. System Model.. .7 2.1 Basic Model of The System ... ...7 2.2 Circuit Diagram ... ...8 2.3 Parts of The System ..... ..9 2.3.1 IR Sensing Circuit..... .9 2.3.2 Alarm Circuit.. 11 2.3.3 LM358 Comparator. .13 3. Hardware Description.. .. 14 3.1 Microcontroller (AT89S52).. ..16 3.2 Liquid Crystal Display... .. 18 3.3 Power Supply... .20 4. Software. ..22 4. 1 Introduction to KEIL . . 22 4.2 What is VISION3?....................................................................22

4.3 Source Code..23 5. Conclusion... .27 6. References. 27

Driving to save lives, time, and money in spite of the conditions around you and the actions of others.- This is the slogan for Defensive Driving. Vehicle accidents are most common if the driving is inadequate. These happen on most factors if the driver is drowsy or if he is alcoholic. Driver drowsiness is recognized as an important factor in the vehicle accidents. It was demonstrated that driving performance deteriorates with increased drowsiness with resulting crashes constituting more than 20% of all vehicle accidents. But the life lost once cannot be rewinded. Advanced technology offers some hope avoid these up to some extent. This project involves measure and controls the eye blink using IR sensor. The IR transmitter is used to transmit the infrared rays in our eye. The IR receiver 3

is used to receive the reflected infrared rays of eye. If the eye is closed means the output of IR receiver is high otherwise the IR receiver output is low. This to know the eye is closing or opening position. This output is give to logic circuit to indicate the alarm. This project involves controlling accident due to unconscious through Eye blink. Here one eye blink sensor is fixed in vehicle where if anybody looses conscious and indicate through alarm. A car simulator study was designed to collect physiological data for validation of this technology. Methodology for analysis of physiological data, independent assessment of driver drowsiness and development of drowsiness detection algorithm by means of sequential fitting and selection of regression models is presented.

2.System Model: 2.1. Basic Model of the System:

The block diagram depicts the total blue print of the proposed project. The total essence and the functioning of the project is represented in a single block diagram. The block diagram mainly consists of 4 parts. They include LM358 Comparator Eye Blink Sensor LCD 8051 Microcontroler Buzzer


8051 LM358 Comparator Eye Blink Sensor Microcontrolle r Buzzer

2.2.Circuit Diagram:

2.3.Parts Of The System: 2.3.1.IR Sensing Circuit:


Infrared transmitter is one type of LED which emits infrared rays generally called as IR Transmitter. Similarly IR Receiver is used to receive the IR rays transmitted by the IR transmitter. One important point is both IR transmitter and receiver should be placed straight line to each other. The transmitted signal is given to IR transmitter whenever the signal is high, the IR transmitter LED is conducting it passes the IR rays to the receiver. The IR receiver is connected with comparator. The comparator is constructed with LM 358 operational amplifier. In the comparator circuit the reference voltage is given to inverting input terminal. The non inverting input terminal is connected IR receiver. When interrupt the IR rays between the IR transmitter and receiver, the IR receiver is not conducting. So the comparator non inverting input terminal voltage is higher then inverting input. Now the comparator output is in the range of +5V. This voltage is given to microcontroller or PC and led so led will glow.

When IR transmitter passes the rays to receiver, the IR receiver is conducting due to that non inverting input voltage is lower than inverting input. Now the comparator output is GND so the output is given to microcontroller or PC. This circuit is mainly used to for counting application, intruder detector etc.

2.3.2.Alarm Circuit 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 8

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 highpitched tone. Usually these were hooked up to "driver" circuits which varied the pitch of the sound or pulsed the sound on and off. description: The circuit is designed to control the buzzer. The buzzer ON and OFF is controlled by the pair of switching transistors (BC 547). The buzzer is connected in the Q2 transistor collector terminal. When high pulse signal is given to base of the Q1 transistors, the transistor is conducting and close the collector and emitter terminal so zero signals is given to base of the Q2 transistor. Hence Q2 transistor and buzzer is turned OFF state. When low pulse is given to base of transistor Q1 transistor, the transistor is turned OFF. Now 12v is given to base of Q2 transistor so the transistor is conducting and buzzer is energized and produces the sound signal. Voltage from MC or PC 1 0 Transistor O1 ON OFF Transistor Q2 OFF ON Transistor O3 OFF ON

2.3.3.LM358 Comparator: The LM358 consist of two independent, high gain, internally frequency compensated operational amplifiers which were designed specifically to operate from a single power supply over a wide range of voltage. 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 amplifier, DC gain blocks and all the conventional OP-AMP circuits which now can be easily implemented in single power supply systems.

Frequency Compensated for Unity Gain

Large DC Voltage Gain: 100dB Wide Power Supply Range: LM358 3V~32V (or 1.5V~ 16V) Input Common Mode Voltage Range Includes Ground Large Output Voltage Swing: 0V DC to Vcc -1.5V DC Power Drain Suitable for Battery Operation. Block Diagram:


3.Hardware Description: 3.1.AT89C51 Microcontroller:

Microcontroller is a general purpose device, which integrates a number of the components of a microprocessor system on to single chip. It has inbuilt CPU, memory 11

and peripherals to make it as a mini computer. A microcontroller combines on to the same microchip: The CPU core Memory(both ROM and RAM) Some parallel digital i/o Microcontrollers will combine other devices such as: A timer module to allow the microcontroller to perform tasks for certain time periods. A serial I/O port to allow data to flow between the controller and other devices such as a PIC or another microcontroller. An ADC to allow the microcontroller to accept analogue input data for processing. Microcontrollers are: Smaller in size Consumes less power Inexpensive Micro controller is a stand alone unit, which can perform functions on its own without any requirement for additional hardware like I/O ports and external memory. The heart of the microcontroller is the CPU core. In the past, this has traditionally been based on a 8-bit microprocessor unit. For example Motorola uses a basic 6800 microprocessor core in their 6805/6808 microcontroller devices. In the recent years, microcontrollers have been developed around specifically designed CPU cores, for example the microchip PIC range of microcontrollers. AT89C51 is the 40 pins, 8 bit Microcontroller manufactured by Atmel group. It is the flash type reprogrammable memory. Advantage of this flash memory is we can erase the program with in few minutes. It has 4kb on chip ROM and 128 bytes internal RAM and 32 I/O pin as arranged as port 0 to port 3 each has 8 bit bin .Port 0 contain 8 data line(D0-D7) as well as low order address line(AO-A7). 12

Port 2 contain higher order address line (A8-A15). Port 3 contains


purpose register such as serial input receiver register SBUF, interrupt INT0,INT1 and timers T0 , T1 many of the pins have multi functions which can be used as general purpose I/O pins (or) Special purpose function can be decided by the programmer itself. \ 3.1.1Features: 4K Bytes of In-System Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles Fully Static Operation: 0 Hz to 24 MHz Three-Level Program Memory Lock 128 x 8-Bit Internal RAM 32 Programmable I/O Lines Two 16-Bit Timer/Counters Six Interrupt Sources Programmable Serial Channel Low Power Idle and Power Down Modes

3.1.3 PIN DIAGRAM OF 89C51:


3.2.Liquid Crystal Display (LCD):

An LCD consists of two glass panels, with the liquid crystal material sand witched in between them. The inner surface of the glass plates are coated with 14

transparent electrodes which define the character, symbols or patterns to be displayed polymeric layers are present in between the electrodes and the liquid crystal, which makes the liquid crystal molecules to maintain a defined orientation angle. One each polarisers are pasted outside the two glass panels. These polarisers would rotate the light rays passing through them to a definite angle, in a particular direction When the LCD is in the off state, light rays are rotated by the two polarisers and the liquid crystal, such that the light rays come out of the LCD without any orientation, and hence the LCD appears transparent. When sufficient voltage is applied to the electrodes, the liquid crystal molecules would be aligned in a specific direction. The light rays passing through the LCD would be rotated by the polarisers, which would result in activating / highlighting the desired characters. The LCDs are lightweight with only a few millimeters thickness. Since the LCDs consume less power, they are compatible with low power electronic circuits, and can be powered for long durations. The LCDs dont generate light and so light is needed to read the display. By using backlighting, reading is possible in the dark. The LCDs have long life and a wide operating temperature range. Changing the display size or the layout size is relatively simple which makes the LCDs more customer friendly. 3.2.1.Introduction:


Fig. LCD Display The LCD display consists of two lines, 20 characters per line that is interfaced with the PIC16F73.The protocol (handshaking) for the display is as shown in Fig. The display contains two internal byte-wide registers, one for commands (RS=0) and the second for characters to be displayed (RS=1). It also contains a user-programmed RAM area (the character RAM) that can be programmed to generate any desired character that can be formed using a dot matrix. To distinguish between these two data areas, the hex command byte 80 will be used to signify that the display RAM address 00h will be chosen Port1 is used to furnish the command or data type, and ports 3.2 to 3.4 furnish register select and read/write levels. 3.2.3.Pin Diagram The Pin diagram for LCD is shown in the following fig 5.7 and the pin
GN 5. +5 description is also explained in Table D v




2x16 Liquid Crystal Display

4 5 6 3.3.POWER SUPPLY:

10 11 12 13 14

RS power R/w En The supply circuits builtD2 usingD3 filters, D0 D1 D4 rectifiers, D5 D6and D7then voltage ww 0D regulators. Starting with a steady dc voltage is obtained by rectifying the ac woan ac voltage, 6 voltage, then filteringw to a dc level, and 0 finally, regulating to obtain a desired fixed dc voltage. The regulation is usually obtained from an IC voltage regulator unit, which takes a dc voltage and provides a somewhat lower dc voltage, which remains the same even if 16

the input dc voltage varies, or the output load connected to the dc voltage changes. The block diagram of power supply is shown in fig below.

AC I/P Transformer Rectifier . Block diagram of power supply 3.3.1.Transformer The potential transformer will step down the power supply voltage (0-230V) to (0-6V) level. Then the secondary of the potential transformer will be connected to the precision rectifier, which is constructed with the help of opamp. The advantages of using precision rectifier are it will give peak voltage output as DC, rest of the circuits will give only RMS output. Filter Regulator Load

3.3.2.Bridge rectifier Bridge rectifier is used to maintain the proper DC polarity at the input to the circuit, irrespective of telephone line polarity. It comprises of four diodes connected to form a bridge. It uses the entire AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses 0.7V when conducting and there are always two diodes conducting, as shown in fig below. AC I/P


O/P Fig: Bridge rectifier 3.3.3.IC Voltage Regulators: Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the circuitry for reference source, comparator amplifier, control device, and overload protection all in a single IC. Although the internal construction of the IC is somewhat different from that described for discrete voltage regulator circuits, the external operation is much the same. IC units provide regulation of either a fixed positive voltage, a fixed negative voltage, or an adjustably set voltage. 3.3.4.Three terminal Voltage Regulators: Fig shows the basic connection of a three-terminal voltage regulator IC to a load. The fixed voltage regulator has an unregulated dc input voltage, V in, applied to one input terminal, a regulated output dc voltage, V out, from a second terminal, with the third terminal connected to ground.

IN Secondary Vin

OUT 7805 GND

Fig.: Fixed Voltage Regulator 18

Fig.: Circuit Diagram of Power Supply

4.Software: Introduction to Micro vision Keil (IDE)

Keil is a cross compiler. So first we have to understand the concept of compilers and cross compilers. After then we shall learn how to work with keil.

4.1. Concept of compiler:


Compilers are programs used to convert a High Level Language to object code. Desktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors. I.E the programs written in one of the HLL like C will compile the code to run on the system for a particular processor like x86 (underlying microprocessor in the computer). For example compilers for Dos platform is different from the Compilers for Unix platform.

4.2. Keil C cross compiler:

Keil is a German based Software development company. It provides several development tools like IDE (Integrated Development environment) Project Manager Simulator Debugger C Cross Compiler , Cross Assembler, Locator/Linker Keil Software provides you with software development tools for the 8051 family of microcontrollers. With these tools, you can generate embedded applications for the multitude of 8051 derivatives. Keil provides following tools for 8051 development 1. C51 Optimizing C Cross Compiler, 2. A51 Macro Assembler, 3. 8051 Utilities (linker, object file converter, library manager), 4. Source-Level Debugger/Simulator, 5. Vision for Windows Integrated Development Environment. The keil 8051 tool kit includes three main tools, assembler, compiler and linker. An assembler is used to assemble your 8051 assembly program A compiler is used to compile your C source code into an object file A linker is used to create an absolute object module suitable for your in-circuit emulator. 8051 project development cycle: - these are the steps to develop 8051 project using keil 1. Create source files in C or assembly. 2. Compile or assemble source files. 3. Correct errors in source files. 4. Link object files from compiler and assembler. 5. Test linked application.

4.3 Source Code: Eye Blink:

#include <AT89X52.H> void lcd_read (unsigned char); void lcd_write(unsigned char); void lcd_display(unsigned char *,unsigned char); 20

void delay(unsigned int); void lcd_init(); sbit rs = P2^7; sbit rw = P2^6; sbit en = P2^5; sbit buzzer=P1^2; sbit sensor=P1^1; //bit f; unsigned int count; void main() { while(1) { lcd_init(); lcd_read(0x80); //lcd_read(0x18); lcd_display("eye blink sense",16); delay(50000); lcd_read(0xc0); //lcd_read(0x18); lcd_display("accident prevent",16); /*sensor=1; while(sensor==1) { buzzer=0; delay(500); buzzer=1; delay(500); }*/ } } void lcd_read(unsigned char y) { P0=y; rs=0; en=1; rw=0; delay(4000); en=0; } void lcd_write(unsigned char y) 21

{ P0=y; rw=0; rs=1; en=1; delay(600); en=0; } void lcd_init() { lcd_read(0x38); lcd_read(0x06); lcd_read(0x0c); } void lcd_display(unsigned char *dis,unsigned char rr) { unsigned char m; for(m=0;m<rr;m++) { lcd_write(dis[m]); } } void delay(unsigned int count) { while(count--); }

Interfacing with LCD:

#define First_Line 0x80 #define Second_Line 0xc0 #define Curser_On 0x0f #define Curser_Off 0x0c #define Clear_Display 0x01 #define Data_Port P0 pdata unsigned char porta _at_ 0x18; pdata unsigned char portc _at_ 0x20; void Lcd8_Init(); 22

void Lcd8_Command(unsigned char); void Lcd8_Write(unsigned char,unsigned char); void Lcd8_Display(unsigned char,const unsigned char*,unsigned int); void Lcd8_Decimal2(unsigned char,unsigned char); void Lcd8_Decimal3(unsigned char,unsigned char); void Lcd8_Decimal4(unsigned char,unsigned int); void Delay(unsigned int); void Lcd8_Init() { Lcd8_Command(0x38); Lcd8_Command(0x06); Lcd8_Command(0x0c); Lcd8_Command(0x01); }

//to select function set //entry mode set //display on //clear display

void Lcd8_Command(unsigned char com) { porta=com; portc=0x04; Delay(125); portc=0x00; Delay(125); } void Lcd8_Write(unsigned char com,unsigned char lr) { Lcd8_Command(com); porta=lr; portc=0x05; Delay(125); portc=0x01; Delay(125); } void Lcd8_Display(unsigned char com,const unsigned char *word,unsigned int n) { unsigned char Lcd_i; for(Lcd_i=0;Lcd_i<n;Lcd_i++) { Lcd8_Write(com+Lcd_i,word[Lcd_i]); } }


void Lcd8_Decimal2(unsigned char com,unsigned char val) { unsigned int Lcd_hr,Lcd_t,Lcd_o; Lcd_hr=val%100; Lcd_t=Lcd_hr/10; Lcd_o=Lcd_hr%10; Lcd8_Write(com,Lcd_t+0x30); Lcd8_Write(com+1,Lcd_o+0x30); } void Lcd8_Decimal3(unsigned char com,unsigned char val) { unsigned int Lcd_h,Lcd_hr,Lcd_t,Lcd_o; Lcd_h=val/100; Lcd_hr=val%100; Lcd_t=Lcd_hr/10; Lcd_o=Lcd_hr%10; Lcd8_Write(com,Lcd_h+0x30); Lcd8_Write(com+1,Lcd_t+0x30); Lcd8_Write(com+2,Lcd_o+0x30); } void Lcd8_Decimal4(unsigned char com,unsigned int val) { unsigned int Lcd_th,Lcd_thr,Lcd_h,Lcd_hr,Lcd_t,Lcd_o; val = val%10000; Lcd_th=val/1000; Lcd_thr=val%1000; Lcd_h=Lcd_thr/100; Lcd_hr=Lcd_thr%100; Lcd_t=Lcd_hr/10; Lcd_o=Lcd_hr%10; Lcd8_Write(com,Lcd_th+0x30); Lcd8_Write(com+1,Lcd_h+0x30); Lcd8_Write(com+2,Lcd_t+0x30); Lcd8_Write(com+3,Lcd_o+0x30); } void Delay(unsigned int del) 24

{ while(del--); }

5. Conclusion:
This project is very used to provide the easy access to maintain the attendance. In this project RFID card is used as employee or student ID card. This project is very useful to the company and office in order to maintain the employee attendance. Attendance is maintained in the data base in PC. So we can easily cross verify the attendance. In this project we can maintain the employee IN and Out time. We can also use this project in school and college to maintain the attendance of the student. So this project improves the security performance because we cannot make the duplicate RFID card.

6. References:
www.google.com www.wikipedia.org 8051 Microcontroller Complete Reference, 3rd Edition Handbook on different displays. Electronic Device and Circuits, Millman Electronic Circuit Analysis, K.Srirnivasan