Anda di halaman 1dari 19

VEHICLE ANTI COLLISION USING ULTRASONIC SIGNALS

ABSTRACT: The aim of the project is to avoid vehicle collision. Nowadays so many accidents are happening in the roads. This will create time loss for passengers, huge traffic in the road and life loss for the accident person and vehicle damage. We can avoid these things by using ultrasonic anti-collision instrument. This instrument is fixed in front side of the vehicle. If any vehicle comes near by this vehicle immediately this instrument will give alarm and it will stop the vehicle. COMPONENTS USED Power Supply Micro controller Buzzer LCD Relay Ultrasonic transmitter and receiver. SOFTWARE USED: Embedded C WORKING PRINCIPLE The vehicle collision can be avoided by using this project. Opposite vehicles are sensed by using ultrasonic signals. The microcontroller switching on the ultrasonic transmitter and receive the output signal of ultrasonic receiver. By doing distance measurement calculation the system can find out the distance of opposite vehicle from our vehicle. If the distance is our set value, the controller will energize braking system. The buzzer will give warning beep. The beep duration is depends upon the distance between the two vehicles. : 5v DC : AT89S52 : Freq-1 to 18 kHz (5v-12Vdc) : 2*16 characters

BLOCK DIAGRAM

LCD (Display)
Ultrasonic Transmitter

LCD Driver

LCD Glass

Ultrasonic Receiver

Buzzer
Buzzer Driver

R E L A Y

Micro Controller (AT89S52) Relay Driver

Buzzer OSC

Battery

Brake System

COMPONENT APPLICATIONS: POWER SUPPLY: The microcontroller and other devices get power supply from AC to Dc adapter through voltage regulator. The adapter output voltage will be 12V DC non regulated. The 7805 voltage regulators are used to convert 12 V to 5VDC.

AC Power

AC/DC Adapter

Regulator (7805)

Filter

DC Output

Vital role of power supply in Vehicle anti-collision using ultrasonic signals The adapter output voltage will be 12V DC non regulated. The 7805/7812 voltage regulators are used to convert 12 V to 5V/12V DC. MICRO CONTROLLER-AT89S52 The AT89S52 is a widely available in market, cost effective, low power and highperformance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. Features: 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range 256 x 8-bit Internal RAM 32 Programmable I/O Lines Full Duplex UART Serial Channel Fully Static Operation: 0 Hz to 33 MHz

Description
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller, which provides a highly-flexible and cost-effective solution to many, embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit

timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, onchip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM; timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

3.1.3 Pin Configuration:

Fig (3.1) 3.1.3.1 Descriptions of the pins being used:

RxD / P 3.0 (Pin 10): This pin is used for receiving data serially during serial communication. This pin is connected to RxD (Pin 12) of MAX 232.

TxD / P 3.1 (Pin 11): This pin is used for transmitting data serially during serial communication. This pin is connected to TxD (Pin 11) of MAX 232. INT0 / P 3.2 (Pin 12): This pin is used to receive laser signal. Laser receiver is connected to this pin.

INT1 / P 3.3 (Pin 13): This pin is used to send laser signal. Laser transmitter is connected to this pin. P 3.4 P 3.7 (Pin 14 17): These pins are used to send data sequence to rotate the stepper motor in clock wise and anti clock wise direction. XTAL1 and XTAL2 (Pin 19 and Pin 18): These two pins are used to connect external quartz crystal to microcontroller. Vss (Pin 20): This pin is connected to ground. EA / Vcc (Pin 31): This pin is connected to Vcc, because the chip contains internal ROM. P 0.7 (Pin 32): This pin is used to make the buzzer produce audible sound. This pin is connected to buzzer. P 0.2 P0.5 (Pin 34 37): These pins are used to transfer data from microcontroller to LCD 16 * 2. These pins are connected to Pins 11 14 of LCD 16 * 2. P 0.1 (Pin 38):

This pin is used to enable LCD 16 * 2. This pin is connected to pin 6 of LCD 16 * 2. P 0.0 (Pin 39): This pin is used to select the register of LCD 16 * 2. This pin is connected to pin 4 of LCD 16 * 2. Vcc (Pin 40): This pin is used to provide power supply for microcontroller. This pin is connected to +5 volts.

3.1.4 Specifications of our project:


In this project we are using Timer 1 in mode 2. As mode 2 is an auto reload mode. M1=1 and M0=0 TMOD: Timer 1 GATE 0 C/T 0 M1 1 M0 0 GATE 0 Timer 0 C/T 0 M1 0 M0 0

To communicate serially, the baud rate has to be set. In our project configuring the TMOD and SCON registers is setting a baud rate of 2400bps. To generate a baud rate of 2400 bps, the TH1 is loaded with 0xf4(decimal value: -3). And then Timer 1 should be started by making TR1 = 1.

SCON: SM0 0 SM1 1 SM2 0 REN 1 TB8 0 RB8 0 TI 0 RI 0

Here SCON register is assigned a value 50H. That is we are using serial mode 1 hence SM0=0 and SM1=1. Since we want the microcontroller to both transfer and receive data, REN must be set to 1.

3.1.5 Block Diagram


.

Fig (3.2)

Vital role of Micro controller-AT89S52 in Vehicle anti-collision using ultrasonic signals

The microcontroller switching on the ultrasonic transmitter and receive the output signal of ultrasonic receiver. By doing distance measurement calculation the system can find out the distance of opposite vehicle from our vehicle. If the distance is our set value, the controller will energize braking system.

Oscillator and Clock circuit:

The heart of the 89s52 is the circuitry that generates the clock pulses by which all internal operations are synchronized. Pins XTAL1 and XTAL2 are provided for connecting a resonant network to form an oscillator. Typically, a quartz crystal and capacitors are employed as shown in figure. The crystal frequency is the basic internal clock frequency of the micro controller. To calculate the time any particular instruction will take to be executed the number of cycle, C needs to be found out, the time to execute that instruction is then found by multiplying C by 12 and dividing the product by the crystal frequency: T inst = (C*12d)/(crystal frequency) An 11.0592 MHz crystal is connected to XTAL1 and XTAL2 to yield a cycle frequency of 921.6 KHz, which can be divided evenly by standard communication rates of 19200, 9600, 4800,2400, 1200, and 300 Hz.

3.1.7 Memory Organization


89s52 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed.

3.1.7.1 Program Memory


If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory.

3.1.7.2 Data Memory


The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions, which use direct addressing access of the SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.

3.2 LIQUID CRYSTAL DISPLAY (LCD)


LCD is a single-line, 16-character unit. This is a standard unit available in market. Interface with micro controller is accomplished via four data lines D7-D4 & two control lines RS & EN. Using these six lines, micro controller displays all messages & telephone numbers. The signal names used here are the same as used by the LCD module/driver manufacturers. Some LCD modules come with additional one or two pins. These extra pins are used for backlighting. There is no fixed standard for the additional pins. LCD controller is a flexible controller & can be used with 8-bit or 4-bit micro controller. In 4-bit mode, only D4-D7 are used, leaving D0-D3 open. To avoid problems, extra delays in software are provided after every write command so that before writing another command/data, LCD module should be ready (not busy). Further, only four data lines (D4-D7) have been used while the other four data lines (D0-D3) are left disconnected. Thus even though we are using an 8-bit micro controller, the LCD module has been interfaced for 4-bit mode. Again, to save pin count, RS line is shared with SDA (serial data) line for memory (IC3) since at any given moment micro controller will either interface with the LCD module or the memory, and this does not affect the system operation Liquid Crystal Displays have materials, which combine the properties of both liquids and crystals. LCD consists of two glass panels, with the Liquid Crystal material sand witched in between them. The inner surfaces of the

glass plates are coated with transparent electrodes, which define the character, symbols or patterns to be displayed. 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 wide operating temperature range. A brighter display can be obtained by providing backlighting.

LCD has single line display, Two-line display and four-line display.

Two-line display
80 8F

C0

CF

LCDs can add a lot to your application in terms of providing an useful interface for the user, debugging an application or just giving it a "professional" look. The most common type of LCD controller is the Hitachi 44780 which provides a relatively simple interface between a processor and an LCD. Using this interface is often not attempted by inexperienced designers and programmers because it is difficult to find good documentation on the interface, initializing the interface can be a problem and the displays themselves are expensive. In our project we used two-line display. Vital role of LCD in Vehicle anti-collision using ultrasonic signals Used to display the distance between the vehicles.

3.2.1 Microcontroller and LCD interactions:


Microcontroller interacts with LCD to display data on it. Port 0 pins are used to interact with the LCD. P 0.0: is connected to Register Select (RS) pin i.e. Pin 4 of LCD. If P 0.0 = 0, instruction commands code register is selected, allowing the user to send a command such as clear display, cursor at home etc. If P 0.0 = 1, the data register is selected, allowing the user to send data to be displayed on to the LCD. P 0.1:is connected to Enable (EN) pin i.e. Pin 6 of LCD. The LCD to latch information presented on its data pins uses the enable pin. When data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450ns wide. P 0.2: is connected to Data pin bit 0 (LSB) pin i.e. Pin 11 of LCD. P 0.3: is connected to Data pin bit 1 (LSB) pin i.e. Pin 12 of LCD. P 0.4: is connected to Data pin bit 2 (LSB) pin i.e. Pin 13 of LCD. P 0.5: is connected to Data pin bit 3 (LSB) pin i.e. Pin 14 of LCD.

The microcontroller provides data on P 0.2 P 0.5 pins to LCD.


P 0.5 P 0.4 P 0.3 P 0.2 P 0.1 P 0.0 D7 D6 D5 D4 LCD EN RS

Microcontroller

Fig (3.3)

3.2.2 Hardware Configuration


The initial equates are RS EN DATA0 DATA1 EQU EQU EQU Power EQU P0.0 (PORT-0) P0.1

on

P0.2 P0.3

Wait DATA2 for more than 30ms after VDD rises to 4.5v EQU P0.4
DATA3 EQU P0.5

Wait for more than 3ms

3.2.3 Interfacing the LCD


4-bit Interface Mode

Wait for more than 3ms

RS 0 0 0

RW 0 0 0

DB7 0 0 N

Function set DB6 Wait for more than 3ms DB5 DB4 DB3 0 1 0 X 0 1 0 X F X X X

DB2 X X X

DB1 X X X

DB0 X X X

Initialization end

RS 0 0

RW 0 0

DB7 0 1

Display ON/OFF Control DB6 DB5 DB4 DB3 DB2 0 0 0 X X D C B X X

DB1 X X

DB0 X X

Display Clear RS 0 0 RW 0 0 DB7 0 0 DB6 0 0 DB5 0 0 DB4 0 1 DB3 X X DB2 X X DB1 X X DB0 X X

RS 0 0

RW 0 0

DB7 0 0

DB6 0 1

Entry Mode Set DB5 DB4 DB3 0 0 X I/D SH X

DB2 X X

DB1 X X

DB0 X X

3.2.3 Cursor addresses for LCD


16 x 2 LCD 80 C0 81 C1 82 C2 83 C3 84 C4 85 C5 86 C6 through through 8F CF

BUZZER: The buzzer subsystem produces a 2 KHz audible tone when powered. The buzzer will sound when the signal coming into the driver is high. It must be connected to a transistor, Darlington or transducer driver subsystem. The buzzer is connected between the supply rail (+V) and the input signal. This acts as load on the driver. When the input signal coming into the buzzer subsystem is low, a potential difference across the buzzer causes current to flow. It is this flow of current that causes the buzzer to sound. Vital role of Buzzer in Vehicle anti-collision using ultrasonic signals The buzzer will give warning beep. The beep duration is depends upon the distance between the two vehicles. RELAY:

The relay subsystem is an electrically-operated switch. The relay switches when the signal coming into the driver is high. It must be connected to a Darlington or transducer driver subsystem. The relay coil is connected between the supply rail (+V) and the input signal. This acts as load on the driver. When the input signal coming into the relay subsystem is low, a potential difference across the relay coil causes current to flow. It is this flow of current that causes contacts to switch. Vital role of Relay in Vehicle anti-collision using ultrasonic signals This is used to switch ON/OFF the brake unit. This operating voltage is 12V DC. ULTRASONIC RAYS: Ultrasonic is acoustic energy in the form of waves having a frequency above the human hearing range. Ultrasonic can be used to locate objects by means similar to the principle by which radar works. High-frequency acoustic waves reflect from objects, even comparatively small ones, because of the short wavelength. The distance to an object can be determined by measuring the delay between the transmission of an ultrasonic pulse and the return of the echo. Applications Ultrasonic is used in electronic, navigational, industrial, and security applications. It is also used in medicine to view internal organs of the body. Ultrasonic security systems are also popular among automobile owners. These devices detect motion in the immediate vicinity of a vehicle. Ultrasonic is used in industry to analyze the uniformity and purity of liquids and solids. Ultrasonic is used to observe the condition and behavior of fetuses prior to birth. Subminiature ultrasonic cleaning instruments are used by some dentists during routine examinations.

Ultrasonic can be used in sonar systems to determine the depth of the water in a location, to find schools of fish, to locate submarines, and to detect the presence of SCUBA divers. ULTRASONIC TRANSDUCER (Transmitter and Receiver) Ultrasonic TXR is used to transmit ultra sonic signals. Ultrasound is used in electronic, navigational, industrial, and security applications. It is also used in medicine to view internal organs of the body. Ultrasound can be used to locate objects by means similar to the principle by which radar works. High-frequency acoustic waves reflect from objects, even comparatively small ones, because of the short wavelength. The distance to an object can be determined by measuring the delay between the transmission of an ultrasound pulse and the return of the echo.

APPLICATIONS OF THIS PROJECT: Distance measurement Vehicle anti-collision

SOFTWARE DETAILS

6.1 Keil u Vision 2 IDE:


Keil u Vision 2 IDE (Integrated Development Environment) is a windows based front end for the C compiler and assembler. Keil u Vision 2 is used for writing embedded C programs. Embedded C is a high level language, which includes many aspects of ANSI C programming Language. Standard libraries are altered or enhanced to add the peculiarities of an embedded target processor.

6.2 C x 51 cross compiler:


C X 51 is a cross compiler to compile C program for your target 89s52 environment and provides several extensions to ANSI standard C to support the elements of 89s52 architecture. These C programs are referred as embedded C program. The software used to program Kiel u Vision 2 embedded C is a high level language, which includes many aspects of the ANSI C programming language.

Anda mungkin juga menyukai