2. COLLI 123457890

download 2. COLLI 123457890

of 25

Transcript of 2. COLLI 123457890

  • 8/2/2019 2. COLLI 123457890

    1/25

    1

    1. INTRODUCTION

    1.1 INTRODUCTION:

    Collision prevention system for electrical vehicles has been originated from the idea for

    preventing accidents of cars. It is a prototype of collision prevention for cars.

    Implementation of this idea can prevent accidents so that the passengers in the car can

    travel safely.

    The idea of collision prevention system for electrical vehicles has come from

    mere observation of the most common reason for the accidents of cars. i.e., the most

    common reason for the accidents of cars is collision. The collision may be between the

    cars or between the car and any other hard object.

    The main objective of the project is to prevent collision of electrical vehicles.

    By scaling the components required for collision prevention, a prototype has been

    developed. The idea behind the prototype is to give a basic thought of preventing

    accidents in cars.

    1.2 PROJECT OVERVIEW:

    The collision of car with any hard obstacle causes a major accident to thepassengers in the car causing injuries. However, if the car is stopped from

    colliding with any hard obstacle, the accident can be prevented. Hence, if a

    collision prevention system is implemented in the car, the car can be stopped

    from collision and this way the accident can be prevented

    The project is now implemented in electrical system which can be laterimplemented to real world cars later on. This system can not only be used for

    preventing collisions when on road but can also be used under some conditions

    for parking guidelines as well.

    The collision prevention system for electrical vehicles is just a prototype ofcollision prevention for cars. Though the idea of preventing collisions is same for

    both, the same components cannot be used in cars as there are many dimensional

    differences between the prototype and the car.

  • 8/2/2019 2. COLLI 123457890

    2/25

    2

    2. BASIC PRINCIPLE OF WORKING

    2.1 BASIC PRINCIPLE OF WORKING:

    Collision prevention system is basically now implemented in electrical prototype

    hence D C motors have been employed to drive the pay load. This system is a very

    simple application of an Infrared sensor (GP2D12). Here the sensor is placed in the

    front of the vehicle i.e. near the headlights of the actual vehicles which acts like a

    human eye checking for collision possibility and proximity detection.

    The sensor has got a transmitter and a receiver like any normal sensor

    but since we have an application i.e. proximity detection hence to full fill this

    application this type of sensor shows the distance between two points i.e. supposed to

    be two vehicles or vehicle and wall etc in this project by measuring the time taken by

    the receiver to receive the transmitted signal and gives the distance measured display

    in the LCD provided in the vehicle.

    A microcontroller interface is also provided which is the brain of this

    project. The micro controller is programmed in such a way that as the proximity

    decreases i.e. as the time taken by the receiver decreases the voltage input to the

    motors decreases thereby decreasing the RPM of motors hence slowing down the

    vehicle.

    There is also a preset distance set in the microcontroller after which

    the collision prevention comes into picture and the controller triggers alarm as soon

    as the proximity is less than the preset distance and then it gives comparatively high

    voltage input to the left motor. Now the RPM of the left motor is greater than righthence turning the vehicle towards right hence protecting the vehicle to collide. This

    is a basic principle involved in proximity detection and collision prevention system.

  • 8/2/2019 2. COLLI 123457890

    3/25

    3

    2.2 CIRCUIT DIAGRAM:

    2.3 BLOCK DIAGRAM:

    2.4 CIRCUIT FEATURES:

    Brief description of operation: Gives out well regulated +5V output, outputcurrent capability of 100 mA.

    Circuit protection: Built-in overheating protection shuts down output whenregulator IC gets too hot.

    Circuit complexity: Very simple and easy to build. Circuit performance: Very stable +5V output voltage, reliable operation. Design testing: Based on datasheet example circuit, I have used this circuit

    successfully as part of many electronics projects.

    Applications: Part of electronics devices, small laboratory power supply. Power supply voltage: Unregulated DC 8-18V power supply. Power supply current: Needed output current + 5 mA.

  • 8/2/2019 2. COLLI 123457890

    4/25

    4

    3. CONSTRUCTION OF COLLISION PREVENTION

    SYSTEM

    3.1 HARDWARE DESCRIPTION:

    The main hardware parts used in this project are listed below

    BATTERY REGULATED POWER SUPPLY INFRARED DISTANCE SENSOR AVR MICROCONTROLLER LCD (liquid crystal display) ANALOG TO DIGITAL CONVERTER D C MOTORS

    3.1.1 BATTERY: Battery is just like any other power supply where power can be stored

    and is portable.The whole efficiency and working of the system cannot be justified until

    and unless power supply is constant and stable. To provide this, a battery is provided.

    A battery is a type of linear power supply that offers benefits that traditional line-

    operated power supplies lack: mobility, portability and reliability.

    A battery consists of multiple electrochemical cells connected to provide

    the voltage desire. The power supply used in our project is a lead acid type 12 volts

    battery. This type of battery needs 36 hours of charging and discharges in 10 hours. The

    figure below shows a lead acid type battery which provides a voltage of 12 volts and

    current of 5 amps.

    3.1.2 REGULATED POWER SUPPLY: A variable regulated power supply, also

    called a variable bench power supply, is one where we can continuously adjust the output

    voltage to your requirements. Varying the output of the power supply is the

    recommended way to test a project after having double checked parts placement against

    circuit drawings and the parts placement guide.

    This type of regulation is ideal for having a simple variable bench

    power supply. Actually this is quite important because one of the first projects a hobbyist

    should undertake is the construction of a variable regulated power supply. While a

    http://en.wikipedia.org/wiki/Battery_(electricity)http://en.wikipedia.org/wiki/Battery_(electricity)
  • 8/2/2019 2. COLLI 123457890

    5/25

    5

    dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a variable

    supply on hand, especially for testing.

    Most digital logic circuits and processors need a 5 volt power

    supply. To use these parts we need to build a regulated 5 volt source. Usually you start

    with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12 volt power

    supply is included with the Beginner Kit and the Microcontroller Beginner Kit.). To

    make a 5 volt power supply, we use a LM7805 voltage regulator IC (Integrated Circuit).

    The IC is shown below.

    The LM7805 is simple to use. Connect the positive lead of the

    unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,

    connect the negative lead to the Common pin and then turn on the power, we get a 5 volt

    supply from the output pin.

    http://www.iguanalabs.com/1stled.htmhttp://www.iguanalabs.com/mbkit.htmhttp://www.iguanalabs.com/mbkit.htmhttp://www.iguanalabs.com/mbkit.htmhttp://www.iguanalabs.com/1stled.htm
  • 8/2/2019 2. COLLI 123457890

    6/25

    6

    3.2 MICRO CONTROLLER INTERFACING:

    VCC

    2

    VCC

    1000

    uf/35v

    PB7(SCK)

    10K

    VCC

    PB6(MISO)

    GND

    RS

    GND

    10KPULLUPS

    123456789

    CR1

    R2

    R3

    R4

    R5

    R6

    R7

    R8

    GND

    RESET

    PC.7

    4.7K

    VCC

    123456789

    1011121314

    GNDVCCVEERSRWEND0D1D2D3D4D5D6D7

    gnd

    GND

    BRIDGE RECTIFIER

    VCC

    -

    +

    1

    4

    3

    2

    VCC

    GND

    VCC

    VCC

    XTAL1

    1 2

    3 45 67 89 10

    + ++ ++ ++ ++ +

    PC.4

    GND

    22pf

    EN

    gnd

    D7

    gnd

    0

    .1UF

    1 2

    16Mhz

    XTAL2

    L

    C

    D

    DISPLAY

    VCC

    D5

    XTAL1

    L293D

    2

    7 10

    15

    1

    9

    3

    6 11

    14

    16

    8

    4

    5

    13

    12

    IN1

    IN2 IN3

    IN4

    EN1

    EN2

    OUT1

    OUT2 OUT3

    OUT4

    VSS

    VS

    GND

    GND

    GND

    GND

    I

    1 3V IN V OU T

    gnd

    VCC

    GP2D12

    VCC

    10K PULLUPS

    123456789

    CR1

    R2

    R3

    R4

    R5

    R6

    R7

    R8

    T1

    TRANSFORMER

    1 5

    4 8

    220

    OHMS

    GND

    VCC

    VCC

    PC.3

    PC.5

    DC MOTOR 1

    5K

    gnd

    A

    1 1Saturday, June 25, 2011

    Title

    Size Document Number Rev

    Date: Sheet of

    OC1A

    1 2

    PD.4(OC1B)

    PB5(MOSI)

    VCC

    RST

    RESET

    PC.1

    22pf

    P

    D4

    GND

    GND

    PC.6

    33pf

    XTAL2

    7805

    led

    gnd

    S

    D6

    104pf

    DC MOTOR 2

    10KPULLUPS

    123456789

    CR1

    R2

    R3

    R4

    R5

    R6

    R7

    R8

    ATMEGA8535

    19

    2930

    22

    16

    23

    3940

    38373635

    343332

    9101112131415

    18

    20 21

    24

    2625

    2728

    234567

    8

    17

    31

    1

    PD5(OC1A)

    PC7(TOSC2)AVCC

    PC0(SCL)

    PD2(INT0)

    PC1(SDA)

    PA1(ADC1)PA0(ADC0)

    PA2(ADC2)PA3(ADC3)PA4(ADC4)PA5(ADC5)PA6(ADC6)PA7(ADC7)

    AREFRESETVCCGNDXTAL2XTAL1PD0(RXD)PD1(TXD)

    PD4(OC1B)

    PD6(ICP) PD7(OC2)

    PC2(TCK)

    PC4(TD0)PC3(TMS)

    PC5(TD1)PC6(TOSC1)

    PB1(T1)PB2(INT2/AIN0)PB3(OC0/AIN1)PB4(SS)PB5(MOSI)PB6(MIS0)PB7(SCK)

    PD3(INT1)

    GND

    XCK(T0)PB0

  • 8/2/2019 2. COLLI 123457890

    7/25

    7

    3.3 INFRARED DISTANCE SENSOR (GP2D12): With the introduction of

    the GP2D12 line of Sharp detectors, a new approach is developed that not only gives

    object detection at a longer range, but also offers range information. These new rangers

    offer much better immunity to ambient lighting conditions because of the new method of

    ranging.

    These new rangers all use triangulation and a small linear CCD array to

    compute the distance and/or the presence of objects in the field of view. The basic idea is

    this: a pulse of IR light is emitted by the emitter. This light travels out in the field of

    view and either hits an object or just keeps on going. In the case of no object, the light is

    never reflected and the reading shows no object. If the light reflects off an object, it

    returns to the detector and creates a triangle between the point of reflection, the emitter,

    and the detector.

    The angles in this triangle vary based on the distance to the object.

    The receiver portion of these new detectors is actually a precision lens that transmits

    the reflected light onto various portions of the enclosed linear CCD array based on

    the angle of the triangle described above. The CCD array can then determine what

    angle the reflected light came back at and therefore, it can calculate the distance to

    the object.

  • 8/2/2019 2. COLLI 123457890

    8/25

  • 8/2/2019 2. COLLI 123457890

    9/25

    9

    executed in one clock cycle. The resulting architecture is more code efficient while

    achieving throughputs up to ten times faster than conventional CISC microcontrollers.

    A DISPLAY OF AVR MICRO CONTROLLER: The ATmega8535 provides the

    following features: 32K bytes of In-System Programmable Flash Program memory with

    Read-While-Write capabilities, 1024 bytes EEPROM, 2K byte SRAM, 32 general

    purpose I/O lines, 32 general purpose working registers, a JTAG interface for Boundary

    scan, On-chip Debugging support and programming, three flexible Timer/Counters with

    compare modes, Internal and External Interrupts, a serial programmable USART, a byte

    oriented Two-wire Serial Interface, an 8-channel, 10-bit ADC with optional differential

    input stage with programmable gain (TQFP package only), a programmable Watchdog

    Timer with Internal Oscillator, an SPI serial port, and six software selectable power

    saving modes.

    The Idle mode stops the CPU while allowing the USART, Two-wire

    interface, A/D Converter, SRAM, Timer/Counters, SPI port, and interrupt system to

    continue functioning. The Power-down mode saves the register contents but freezes the

    Oscillator, disabling all other chip functions until the next External Interrupt or Hardware

    Reset. In Power-save mode, the Asynchronous Timer continues to run, allowing the user

    to maintain a timer base while the rest of the device is sleeping.

    The ADC Noise Reduction mode stops the CPU and all I/O modules

    except Asynchronous Timer and ADC, to minimize switching noise during ADC

    conversions. In Standby mode, the crystal/resonator Oscillator is running while the rest

    of the device is sleeping. This allows very fast start-up combined with low-power

    consumption. In Extended Standby mode, both the main Oscillator and the

    Asynchronous Timer continue to run.

  • 8/2/2019 2. COLLI 123457890

    10/25

    10

    FEATURES:

    High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture

    131 Powerful InstructionsMost Single-clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation

    Up to 16 MIPS Throughput at 16 MHz

    On-chip 2-cycle Multiplier High Endurance Non-volatile Memory segments

    32K Bytes of In-System Self-programmable Flash program memory 1024 Bytes EEPROM

    2K Byte Internal SRAM

    Write/Erase Cycles: 10,000 Flash/100,000 EEPROM Data retention: 20 years at 85C/100 years at 25C(1) Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write

    Operation

    Programming Lock for Software Security JTAG (IEEE std. 1149.1 Compliant) Interface

    Boundary-scan Capabilities According to the JTAG Standard Extensive On-chip Debug Support Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG

    Interface.

  • 8/2/2019 2. COLLI 123457890

    11/25

    11

    Peripheral Features Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture

    Mode

    Real Time Counter with Separate Oscillator Four PWM Channels 8-channel, 10-bit ADC 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x Byte-oriented Two-wire Serial Interface Programmable Serial USART Master/Slave SPI Serial Interface Programmable Watchdog Timer with Separate On-chip Oscillator

    Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down,

    Standby and - --Extended Standby

    I/O and Packages 32 Programmable I/O Lines 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF

    Operating Voltages 2.7 - 5.5V for ATmega8535L 4.5 - 5.5V for ATmega8535

  • 8/2/2019 2. COLLI 123457890

    12/25

    12

    Speed Grades 0 - 8 MHz for ATmega8535L 0 - 16 MHz for ATmega8535

    3.5 BLOCK DIAGRAM OF ATMEGA 88535:

    3.6 LCD (LIQUID CRYSTAL DISPLAY): Liquid crystal display a type of

    display used in digital watches and many portable computers. LCD displays utilize two

    sheets of polarizing material with a liquid crystal solution between them. An electric

    current passed through the liquid causes the crystals to align so that light cannot pass

    through them. Each crystal, therefore, is like a shutter, either allowing light to pass

    through or blocking the light.

  • 8/2/2019 2. COLLI 123457890

    13/25

    13

    LCDs have become very popular over recent years for information

    display in many smart appliances. They are usually controlled by microcontrollers. They

    make complicated equipment easier to operate. LCDs come in many shapes and sizes but

    the most common is the 20 character x 4 line display with no backlight. It requires only

    11 connectionseight bits for data (which can be reduced to four if necessary) and three

    control lines (we have only used two here). It runs off a 5V DC supply and only needs

    about 1mA of current. The display contrast can be varied by changing the voltage into

    pin 3 of the display, usually with a trim pot.

    LCD adds a lot to our application in terms of providing a 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.

    DESCRIPTION FOR INTERFACING OF LCD:To get the display working requires

    eight bits of data, a register select line (RS) and a strobe line (E). A third input, R/W, is

    used to read or write data to/from the LCD. The eight bits of data are supplied from the

    controller port data lines and two controller port control lines are used for RS (auto)

    and E (strobe). Basically the LCD has two registers, a data register and a command

    register. Data is written into the command register when RS is low and into the data

    register when RS is high. Data is latched into the LCD register on the falling edge of

    Enable.

  • 8/2/2019 2. COLLI 123457890

    14/25

    14

    Pin Description of LCD:

    From this description, the interface is a parallel bus, allowing simple

    and fast reading/writing of data to and from the LCD. This waveform will write an

    ASCII Byte out to the LCD's screen. The ASCII code to be displayed is eight bits long

    and is sent to the LCD either four or eight bits at a time. If four bit mode is used, two

    "nibbles" of data (Sent high four bits and then low four bits with an "E" Clock pulse with

    each nibble) are sent to make up a full eight bit transfer. The "E" Clock is used to initiate

    the data transfer within the LCD.

    Eight-bit mode is best used when speed is required in an application

    and at least ten I/O pins are available. Four bit mode requires a minimum of six bits. To

    wire a microcontroller to an LCD in four bit mode, just the top four bits (DB4-7) are

    written to. The "R/S" bit is used to select whether data or an instruction is being

    transferred between the microcontroller and the LCD. If the Bit is set, then the byte at the

    current LCD "Cursor" Position can be reader written. When the Bit is reset, either an

    instruction is being sent to the LCD or the execution status of the last instruction is read

    back (whether or not it has completed).

  • 8/2/2019 2. COLLI 123457890

    15/25

    15

    4. ANALOG TO DIGITAL CONVERTER

    4.1 FEATURES:

    Input Channels 7 Differential Input Channels10-bit Resolution 0.5 LSB Integral Non-linearity 2 LSB Absolute Accuracy 13 - 260 s Conversion Time Up to 15 kSPS at Maximum Resolution 8 Multiplexed Single Ended 2 Differential Input Channels with Optional Gain of 10x and 200x Optional Left adjustment for ADC Result Readout 0 - VCC ADC Input Voltage Range Selectable 2.56V ADC Reference Voltage Free Running or Single Conversion Mode ADC Start Conversion by Auto Triggering on Interrupt Sources Interrupt on ADC Conversion Complete Sleep Mode Noise Canceller

    The ADC contains a Sample and Hold circuit which ensures that the

    input voltage to the ADC is held at a constant level during conversion. The ADC has a

    separate analog supply voltage pin, AVCC. AVCC must not differ more than 0.3 V

    from VCC.

  • 8/2/2019 2. COLLI 123457890

    16/25

    16

    4.2 ADC BLOCK DIAGRAM:

    4.3 OPERATION: The ADC converts an analog input voltage to a 10-bit digital

    value through successive approximation. The minimum value represents GND and themaximum value represents the voltage on the AREF pin minus 1 LSB. Optionally,

    AVCC or an internal 2.56V reference voltage may be connected to the AREF pin by

    writing to the REFS n bits in the ADMUX Register. The internal voltage reference may

    thus be decoupled by an external capacitor at the AREF pin to improve noise immunity.

  • 8/2/2019 2. COLLI 123457890

    17/25

    17

    ADC NOISE CANCELLER:

    The ADC features a noise canceller that enables conversion during sleep mode to reduce

    noise induced from the CPU core and other I/O peripherals. The noise canceller can be

    used with ADC Noise Reduction and Idle mode. To make use of this feature, the

    following procedure should be used:

    1. Make sure that the ADC is enabled and is not busy converting. Single Conversion

    Mode must be selected and the ADC conversion complete interrupt must be enabled.

    2. Enter ADC Noise Reduction mode (or idle mode). The ADC will start a conversion

    once the CPU has been halted.

    3. If no other interrupts occur before the ADC conversion completes, the ADC interrupt

    will wake up the CPU and execute the ADC Conversion Complete interrupt routine. Ifanother interrupt wakes up the CPU before the ADC conversion is complete, that

    interrupt will be executed, and an ADC Conversion Complete interrupt request will be

    generated when the ADC conversion completes.

    The CPU will remain in active mode until a new sleep command is

    executed. Note that the ADC will not be automatically turned off when entering other

    sleep modes than idle mode and ADC Noise Reduction mode. The user is advised to

    write zero to ADEN before entering such sleep modes to avoid excessive power

    consumption.

    4.4 D C MOTORS: Industrial applications use dc motors because the speed-torque

    relationship can be varied to almost any useful form -- for both dc motor and

    regeneration applications in either direction of rotation. Continuous operation of dc

    motors is commonly available over a speed range of 8:1. Infinite range (smooth control

    down to zero speed) for short durations or reduced load is also common.

    Dc motors feature a speed, which can be controlled smoothly down to zero,

    immediately followed by acceleration in the opposite direction -- without power circuit

    switching. And dc motors respond quickly to changes in control signals due to the dc

    motor's high ratio of torque to inertia.

    Let's start by looking at a simple 2-pole DC electric motor (here red

    represents a magnet or winding with a "North" polarization, while green represents amagnet or winding with a "South" polarization).

    http://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.html
  • 8/2/2019 2. COLLI 123457890

    18/25

    18

    In real life, though, DC motors will always have more than two poles

    (three is a very common number). In particular, this avoids "dead spots" in the

    commutator. You can imagine how with our example two-pole motor, if the rotor is

    exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get

    "stuck" there. Meanwhile, with a two-pole motor, there is a moment where the

    commutator shorts out the power supply (i.e., both brushes touch both commutator

    contacts simultaneously).

    This would be bad for the power supply, waste energy, and damage

    motor components as well. Yet another disadvantage of such a simple motor is that it

    would exhibit a high amount oftorque"ripple" (the amount oftorqueit could produce is

    cyclic with the position of the rotor).

    There's probably no better way to see how an averageDCmotor is put

    together, than by just opening one up. Unfortunately this is tedious work, as well as

    requiring the destruction of a perfectly good motor.

    http://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/torque.htmlhttp://encyclobeamia.solarbotics.net/articles/dc.html
  • 8/2/2019 2. COLLI 123457890

    19/25

    19

    5. PROGRAMME CODING

    The programme dumped in our microcontroller is shown below

    #include #include #include

    //PORT that is connected to the LCD#define LCD PORTC#define buzzer PORTB.0

    // Selecting the internal voltage reference 2.56 volts#define ADC_VREF_TYPE 0xC0#define VREF 5.0

    //intialization of the lcd

    void init_lcd(void);//function used to send the command to LCDvoid cmd_lcd(unsigned char);//function used to send the data byte to LCDvoid data_lcd(unsigned char);//function used to send the a string to LCDvoid disp_str(unsigned char *);

    //fiunction to read the result of the adc after the conversionunsigned int read_adc(unsigned char);void disp_num(int);void disp_float(float);

    unsigned int adc_data; // to hold the adc result

    void main(){int i;float res;PORTA=0x00;DDRA=0x00;DDRC = 0xFF;

    DDRB=0x01;

    DDRC = 0xFF;

    PORTD=0x00;DDRD=0x30;

    TCCR1A=0xA1;TCCR1B=0x0C;TCNT1H=0x00;TCNT1L=0x00;ICR1H=0x00;ICR1L=0x00;OCR1AH=0x00;OCR1AL=0x00;OCR1BH=0x00;OCR1BL=0x00;

    buzzer=1;init_lcd();

  • 8/2/2019 2. COLLI 123457890

    20/25

    20

    cmd_lcd(0x80);disp_str("COLLISION PREVENTION ");cmd_lcd(0xC0);disp_str("SYSTEM FOR ELECTRICAL VECHILE");delay_ms(5000);cmd_lcd(0x01);

    OCR1A =0;OCR1B =0; buzzer=1;while(1){cmd_lcd(0x80);disp_str("FRONT MOTOR ");// getting the digital equalent of the temperaturei = read_adc(0);cmd_lcd(0xC0);disp_str("DISTANCE =");// mutiply digital data with VREF//res = i * VREF;//res = res/10;

    ///////////////////////////////////res=((i*2.5)/1024)*100;res=100-res;if(res

  • 8/2/2019 2. COLLI 123457890

    21/25

    21

    //disp_str("FRONT MOTOR ");}

    if(res

  • 8/2/2019 2. COLLI 123457890

    22/25

    22

    }delay_ms(100);}}

    // ADC interrupt service routine

    interrupt [ADC_INT] void adc_isr(void){// update the adc_data after the conversionadc_data=ADCW;}

    void init_lcd(void){

    cmd_lcd(0x28);cmd_lcd(0x28);cmd_lcd(0x28);cmd_lcd(0x0c);cmd_lcd(0x06);

    cmd_lcd(0x01);}void cmd_lcd(unsigned char c){unsigned char temp;temp=c>>4;LCD=temp

  • 8/2/2019 2. COLLI 123457890

    23/25

    23

    // Function to display the float value on to the LCD

    void disp_float(float l){

    unsigned char ch;

    //displaying the integer part

    disp_num((int)l);data_lcd('.');//displaying the Fraction part

    l = l - (int)l;l = l * 100;ch = (int)l;data_lcd((ch/10) + 0x30);data_lcd((ch%10) + 0x30);

    }

    // function to read the result of the adc conversionunsigned int read_adc(unsigned char adc_input){// selecting the channel and the referance typeADMUX=ADC_VREF_TYPE;ADCSRA=0x8E;SFIOR&=0xEF;SFIOR|=0x10;

    ADMUX=adc_input|ADC_VREF_TYPE;// starting the adcADCSRA = ADCSRA | 0x40;

    // enable the sleep modeMCUCR = 0x10;sleep_enable();idle();// in to normal mode after the conversion of the ADCreturn adc_data;

    }

  • 8/2/2019 2. COLLI 123457890

    24/25

    24

    6. CONCLUSION AND LIMITATIONS

    RESULT: Collision prevention and proximity detection system has been practically

    implemented and studied. The working of the project has been analyzed and its pros and

    cons have been identified.

    LIMITATIONS:

    This system proves to be very efficient in electrically controlled vehicles as controlling motors

    with the help of microcontroller interface is easy. But mechanically implementing this project is

    lot tougher. However as the trend of using eco friendly electrical cars are speeding up this system

    might provide efficient accident prevention in the near future.

  • 8/2/2019 2. COLLI 123457890

    25/25

    7. BIBLIOGRAPHY

    TEXT BOOKS REFFERED:

    The AVR Microcontroller and Embedded Systems By Muhammad AliMazidi and Janice Gillispie Mazidi. Pearson Education.

    ATMEL AVR Data sheets Hand book for Digital ICs from Analogic Devices

    WEBSITES VIEWED:

    www.bluetooth.com www.beyondlogic.org www.dallassemiconductors.com www.wireless-communication.org/bluetooth/ Bluetooth -

    Connect without Cables Jennifer Bray and Charles F

    Sturman (Prentice Hall)

    ________________X__________________

    http://www.beyondlogic.org/http://www.beyondlogic.org/http://www.dallassemiconductors.com/http://www.dallassemiconductors.com/http://www.wireless-communication.org/bluetooth/http://www.wireless-communication.org/bluetooth/http://www.wireless-communication.org/bluetooth/http://www.dallassemiconductors.com/http://www.beyondlogic.org/