Electronic Mirror New1

download Electronic Mirror New1

of 42

Transcript of Electronic Mirror New1

  • 8/11/2019 Electronic Mirror New1

    1/42

    1

    ELECTRONIC MIRROR

    A PROJECT REPORT(PHASE I)

    Submitted by

    B.HARIDASS (090107803038)

    M.RAGAVI (090107803083)

    R.REVATHI (090107803096)

    R.SANDHIYA (090107803101)

    in partial ful fi lment for the award of the degree

    of

    BACHELOR OF ENGINEERING

    In

    ELECTRONICS & COMMUNICATION ENGINEERING

    SONA COLLGE OF TECHNOLOGY

    SALEM-5

    ANNA UNIVERSITY: CHENNAI 600 025

    NOVEMBER 2012

  • 8/11/2019 Electronic Mirror New1

    2/42

    2

    ANNA UNIVERSITY: CHENNAI 600 025

    BONAFIDE CERTIFICATE

    Certified that this project report ELECTRONIC MIRROR is the bonafide

    work of B.HARIDASS, M.RAGAVI, R.REVATHI, R.SANDHIYA who

    carried out the project work under my supervision.

    SIGNATURE SIGNATURE

    Professor.B.Gopi.,M.E. Dr.S.Jayaraman .,Ph.D.

    SUPERVISOR HEAD OF THE DEPARTMENT

    Department of Electronics and Department of Electronics and

    Communication Engineering. Communication Engineering.

    Sona College Of Technology, Sona College Of Technology,

    Salem - 636005. Salem - 636005.

    Submitted for the project phase I review held on ______________________

    Internal Examiner External Examiner

  • 8/11/2019 Electronic Mirror New1

    3/42

    3

    ACKNOWLEDGEMENT

    First we pay our gratitude to the almighty for providing us with enough

    strength, courage and ideas to undertake this project. It is our boundenduty to

    express our sincere thanks and warm regards to those who stood as a pillar of

    strength all through the entire process of our project.

    We wish to thank our honourable Chairman Shri.C.Valliappa, our most

    respected Secretary Shri.A.Dhirajlaland Principal Dr.C.V.Koushik for all their

    motivations and help provided during the period of project work.

    We sincerely thank our Dean/HOD Dr.S.Jayaramanfor favouring us with

    the needful during our project period.

    It is a great pleasure to express our sincere thanks and whole hearted

    gratitude to our project guide Professor.B.Gopi, Department of ECE for enduring

    patience, valuable thoughts, guidance and care for us.

    Also our sincere thanks to all the staff members and technicians of the

    department of Electronics and Communication Engineering for providing us

    creative ideas and knowledge in the field of our project.

    Last but not least our sincere thanks to the family members and friends for

    their co-operation and encouragement during this period.

  • 8/11/2019 Electronic Mirror New1

    4/42

    4

    TABLE OF CONTENTS

    CHAPTER NO TITLE PAGE NO

    ABSTRACT 6

    LIST OF FIGURES 7

    LIST OF TABLES 7

    1. INTRODUCTION 8

    1.1 Introduction 8

    1.1 Scope of the project 9

    2. LITERATURE SURVEY

    2.1 Embedded system 10

    2.1.1Definition 10

    2.1.2 Over View of Embedded SystemArchitecture 11

    2.1.3 General block diagram of embedded System 11

    2.1.4 Advantages 13

    2.2 Basic block diagram 14

    2.3 Sensor 14

    2.3.1Types of sensor 14

    2.4 Ultrasonic sensor 16

    2.4.1 Principle 16

    2.5 Lv-MaxSonar-EZ3 17

    2.5.1 Introduction 17

  • 8/11/2019 Electronic Mirror New1

    5/42

    5

    2.5.2 Features 18

    2.5.3 Benefits 19

    2.5.4 Beam characteristics 19

    2.5.5 Pin Description 20

    2.5.6 Working 21

    2.6 PIC MICROCONTROLLER 23

    2.6.1 General architecture of PIC 24

    2.6.2 Instruction set 25

    2.6.3 Advantages 27

    2.7 PIC16F676 28

    2.7.1 Pin diagram 31

    2.7.2 Architecture of PIC16F676 32

    2.8 LM324 32

    2.8.1 Description 32

    2.8.2 Pin Configuration 33

    2.8.3 Features 33

    2.8.4 Applications 33

    2.9 LCD (Liquid Crystal Display) 34

    2.9.1 Block Diagram 34

    2.9.2 Board schematics 35

    2.9.3 Power Supply 36

    2.9.4 Pin Description 38

    CONCLUSION 40

    REFERENCE 41

  • 8/11/2019 Electronic Mirror New1

    6/42

    6

    ABSTRACT

    Measuring the distance is a need of human being always because of manyreasons. Knowing distance of any object is so important in lots of categories.In

    nowadays world cars, planes, robots, rockets etc. are need to measure or sense

    the distance of the objects that are near and far away from them. In addition to that

    in astronomy, army, security works, research works as water, petrol or mine,

    distance measuring is very important subject for efficient working, and success.

    Distance measuring is done with many ways. For example with sound, light,

    laser, infrared, radio navigationetc. In nowadays world, with thehelp of

    developing technology, measuring distance is getting so easy with the sensors. For

    example, to park a car, to search anything under the land, to have a safe travelling

    for airplanes...etc. and lots of using areas are so common.

    In present situation accidents occurring throughout the world has

    tremendously increased and so there is increase in death rate also. So here we

    propose the concept of ELECTRONIC MIRROR.The main idea of our project is

    to measure the distance between two cars using ultrasonic sensor, which is also

    applicable for long range detection and finally as result an indication is given to the

    driver through voice and LCD screen telling whether he /she can overtake. Main

    purpose of our project is to replace the conventional mirror and also to reduce the

    occurrence of accidents.

  • 8/11/2019 Electronic Mirror New1

    7/42

    7

    LIST OF FIGURES

    TITLE PAGE NO.

    F ig.1 Overview of embedded system 11

    F ig 2: General block diagram (hardware archi tecture) 11

    F ig 3: Software architecture 12

    F ig 4: Basic block diagram 14

    F ig 5: Lv-MaxSonar-EZ3 sensor 18

    F ig 6: Beam character istics 20

    F ig 7: Pin diagram of Lv-MaxSonar-Ez3 20

    F ig 8: Working Circuit diagram of Lv-MaxSonar-Ez3 22

    F ig 9: Pin Diagram of PIC16F676 30

    F ig 10: Block diagram of PIC16F676 32

    F ig 11: Pin confi guration of LM324 33

    F ig 12: Block diagram of LCD 34

    F ig 13: Board Schematics of LCD 35

    F ig 14: Diagram of power supply 36

    LIST OF TABLES

    Table 1: Pin description of PIC16F676 31

    Table 2: Pin description of LCD 39

    METHODOLGY 40

    TIME CHART 42

  • 8/11/2019 Electronic Mirror New1

    8/42

  • 8/11/2019 Electronic Mirror New1

    9/42

    9

    1.2 SCOPE OF THE PROJECT

    Our main aim of the project is to replace the conventional mirror, add

    additional feature to the dash board and to reduce the occurrence of accidents

    during overtaking. Here driver may miscalculate the timing of overtaking and it

    may lead to accident so to overcome that critical situation a sensor is used here

    to detect the obstacle. Ultrasonic sensor used here detect the object at near or

    far distance and receive the reflected signal back .As a result indication is given

    to the driver by means of LCD and Voice whether he/she is in a position to

    overtake or not. This process takes place in microseconds.

    The same concept is applicable for hair-pin bends in hill station also. Thus by

    using sensor we can calculate the distance and PIC Microcontroller is used.

    LCD is used to display the result whether to overtake or not. Software is used

    for the purpose of programming. This is simple and easier method which will

    help to save the life of people by reducing the occurrence of accidents.

  • 8/11/2019 Electronic Mirror New1

    10/42

    10

    CHAPTER 2

    LITERATURE SURVEY

    2.1EMBEDDED SYSTEM

    2.1.1 Definition:

    An embedded system is one that has computer-hardware with software

    Embedded in it as one of its most important component. It is dedicated

    computer based system for an application.

    It may be either an independent system or a part of a large system. As its

    software usually embeds in ROM it does not need secondary memories as in a

    Computer.

    An Embedded system has three main components.

    1. Hardware.

    2. It has main application software. The application software may perform

    concurrently the series of tasks or multiple tasks.

    3. It has a real time operating system that supervises the application

    software and provides a mechanism to let the processor run a process as per

    scheduling and do the context-switching between the various processes (tasks)

    2.1.2 Over View of Embedded System Architecture:

    The embedded system architecture can be represented as a layered architecture

    as shown in fig. The operating system runs above the hardware, and the

    application software runs above the operating system. The same architecture is

    applicable to any computer including a desktop computer. It is not compulsory

    to have an operating system in every embedded system. For small appliances

    such as remote control units, air-conditioners, toys etc., there is no need for an

  • 8/11/2019 Electronic Mirror New1

    11/42

    11

    operating system and you can write only the software specific to that

    application.

    F ig.1 Overview of embedded system

    2.1.3 General Block Diagram of an embedded system:

    Hardware Architecture: The various building blocks of Embedded system

    hardware are shown in Fig2

    F ig 2:General block diagram (hardware archi tecture)

  • 8/11/2019 Electronic Mirror New1

    12/42

    12

    Communication Interfaces:

    For embedded systems to interact with the external world, a number of

    communication interfaces are provided. These are

    1. Serial interface using RS 232

    2. Serial interface using RS 422/RS 485

    3. Universal Serial Bus(USB)

    4. Infrared

    5. Ethernet

    6. Wire less inter face based on IEEE 802.11 Wire less LAN standard

    7. Blue tooth radio interface

    Software Architecture:

    The software in an embedded system consists of an operating system and the

    application software. The operating system is optional if it is not present; you

    need to write your own software routine to access the hardware.

    F ig 3:Software architecture

  • 8/11/2019 Electronic Mirror New1

    13/42

    13

    2.1.4 ADVANTAGES:

    1. Design and Efficiency: The central processing core in embedded systems is

    generally less complicated, making it easier to maintain. The limited function

    required of embedded systems allows them to be designed to most efficiently

    perform their functions.

    2. Cost:The streamlined make-up of most embedded systems allows their parts to

    be smaller less expensive to produce.

    3. Accessibility:Embedded systems are difficult to service because they are inside

    another machine, so a greater effort is made to carefully develop them. However, if

    something does go wrong with certain embedded systems they can be too

    inaccessible to repair. This concern is sometimes addressed in the design stage,

    such as by programming an embedded system so that it will not affect related

    systems negatively when malfunctioning.

    4. Maintenance:Embedded systems are easier to maintain because the supplied

    power is embedded in the system and does not require remote maintenance.

    5. Redundancies:Embedded systems do not involve the redundant programming

    and maintenance involved in other system models.

  • 8/11/2019 Electronic Mirror New1

    14/42

    14

    2.2BLOCK DIAGRAM

    F ig 4:Basic block diagram

    2.3SENSOR:

    Sensors are sophisticated devices that are frequently used to detect and

    respond to electrical or optical signals. A Sensorconverts the physical parameter(for example: temperature, blood pressure, humidity, speed, etc.) into a signal

    which can be measured electrically.

    2.3.1.TYPES OF SENSOR:

    Classification based on property is as given below:

    Temperature - Thermistors, thermocouples, RTDs,IC and many more.

  • 8/11/2019 Electronic Mirror New1

    15/42

    15

    Pressure - Fibre optic, vacuum, elastic liquid based manometers, LVDT,

    electronic.

    Flow - Electromagnetic, differential pressure, positional displacement,

    thermal mass, etc.

    Level Sensors - Differential pressure, ultrasonic radio frequency, radar,

    thermal displacement, etc.

    Proximity and displacement - LVDT, photoelectric, capacitive, magnetic,

    ultrasonic.

    Biosensors - Resonant mirror, electrochemical, surface Plasmon

    resonance, Light addressable potentio-metric.

    Image - Charge coupled devices,CMOS

    Gas and chemical - Semiconductor,Infrared, Conductance,

    Electrochemical.

    Acceleration - Gyroscopes,Accelerometers.

    Others - Moisture,humidity sensor,Speed sensor, mass,Tilt sensor,

    force, viscosity.

    Surface Plasmon resonance and Light addressable potentio-metric from the

    Bio-sensors group are the new optical technology based sensors.CMOS Image

    sensors have low resolution as compared to charge coupled devices. CMOS has the

    advantages of small size, cheap, less power consumption and hence are better

    substitutes for Charge coupled devices. Accelerometers are independently grouped

    because of their vital role in future applications like aircraft, automobiles, etc and

    in fields of videogames, toys, etc.Magnetometers are those sensors which measure

    magnetic flux intensity B (in units of Tesla or As/m2).

    http://www.engineersgarage.com/articles/pressure-sensors-types-workinghttp://www.engineersgarage.com/articles/WHAT-IS-LEVEL-SENSORhttp://www.engineersgarage.com/articles/what-is-cmos-technologyhttp://www.engineersgarage.com/articles/accelerometerhttp://www.engineersgarage.com/articles/humidity-sensorhttp://www.engineersgarage.com/articles/what-is-tilt-sensorhttp://www.engineersgarage.com/articles/what-is-cmos-sensorhttp://www.engineersgarage.com/articles/what-is-cmos-sensorhttp://www.engineersgarage.com/articles/magnetometerhttp://www.engineersgarage.com/articles/magnetometerhttp://www.engineersgarage.com/articles/what-is-cmos-sensorhttp://www.engineersgarage.com/articles/what-is-cmos-sensorhttp://www.engineersgarage.com/articles/what-is-tilt-sensorhttp://www.engineersgarage.com/articles/humidity-sensorhttp://www.engineersgarage.com/articles/accelerometerhttp://www.engineersgarage.com/articles/what-is-cmos-technologyhttp://www.engineersgarage.com/articles/WHAT-IS-LEVEL-SENSORhttp://www.engineersgarage.com/articles/pressure-sensors-types-working
  • 8/11/2019 Electronic Mirror New1

    16/42

    16

    Classification based on Application is as given below:

    Industrial process control, measurement and automation

    Non-industrial use Aircraft, Medical products, Automobiles, Consumer

    electronics, other type of sensors.

    Sensors can be classified based on power or energy supply requirement of the

    sensors:

    Active Sensor - Sensors that require power supply are called as Active

    Sensors. Example: LiDAR (Light detection and ranging), photoconductive

    cell.

    Passive Sensor - Sensors that do not require power supply are called as

    Passive Sensors. Example: Radiometers, film photography.

    In the current and future applications, sensors can be classified into groups as

    follows:

    Accelerometers - These are based on the Micro Electro Mechanical sensor

    technology. They are used for patient monitoring which includes pace

    makers and vehicle dynamic systems.

    Biosensors - These are based on the electrochemical technology. They are

    used for food testing, medical care device, water testing, and biological

    warfare agent detection.

    Image Sensors - These are based on theCMOS technology. They are used in

    consumer electronics,biometrics, traffic and security surveillance and PC

    imaging.

    Motion Detectors - These are based on the Infra Red, Ultrasonic, and

    Microwave /radar technology. They are used in videogames and

    simulations, light activation and security detection.

    http://www.engineersgarage.com/articles/what-is-cmos-technologyhttp://www.engineersgarage.com/articles/biometricshttp://www.engineersgarage.com/articles/what-is-radar-technologyhttp://www.engineersgarage.com/articles/what-is-radar-technologyhttp://www.engineersgarage.com/articles/biometricshttp://www.engineersgarage.com/articles/what-is-cmos-technology
  • 8/11/2019 Electronic Mirror New1

    17/42

    17

    2.4 ULTRASONIC SENSOR:

    Ultrasonic sensors(also known as transceiverswhen they both send and

    receive) work on a principle similar toradar orsonar whichevaluate attributes of a

    target by interpreting the echoes from radio or sound waves respectively.

    Ultrasonic sensors generate high frequency sound waves and evaluate the echo

    which is received back by the sensor. Sensors calculate the time interval between

    sending the signal and receiving the echo to determine the distance to an object.

    2.4.1 PRINCIPLE:

    Ultrasonic principle is based on high frequency sound waves that human ear

    can not hear. Ultrasonic sensors generate high frequency sound waves and evaluate

    the echo which is received back by the sensor. The reasons of using this high

    frequency waves are can be said as below:

    These waves radiate extremely smooth and linear

    Energy of these waves are in high level

    These waves can be easily reflected from hard planes

    The measure of the distance is done simply like that:

    Firstly ultrasonic waves are sent and then wait until reflected signal has come.

    After that, the time is calculated between sent and received signal. Finally, time

    and the velocityof the sound multiplied each other, so the half of the result showsthe distance of the object.

    The sensor that is used by us for measuring the distance (0-inches to 254-inches) is

    LV-MAXSONAR-EZ3.Let us see the detailed description below.

    http://en.wikipedia.org/wiki/Radarhttp://en.wikipedia.org/wiki/Sonarhttp://en.wikipedia.org/wiki/Sonarhttp://en.wikipedia.org/wiki/Radar
  • 8/11/2019 Electronic Mirror New1

    18/42

    18

    2.5 LV-MAXSONAR-EZ3:

    2.5.1 Introduction:

    With 2.5V - 5.5V power, the LV-MaxSonar- EZ3 provides very short to

    long-range detection and ranging, in an incredibly small package. The LV-

    MaxSonar-EZ3 detects objects from 0-inches to 254-inches6.45-meters) and

    provides sonar range information from 6-inches out to 254-inches with 1-inch

    resolution. Objects from 0-inches to 6-inches range as 6-inches. The interface

    output formats included are pulse width output, analog voltage output, and serial

    digital output.

    F ig 5:L v-MaxSonar-EZ3 sensor

    2.5.2 Features:

    1. Continuously variable gain for beam control and side lobe suppression

    2. Object detection includes zero range objects

    3.2.5V to 5.5V supply with 2mA typical current draw4. Readings can occur up to every 50mS, (20-Hz rate)

  • 8/11/2019 Electronic Mirror New1

    19/42

    19

    5. Free run operation can continually measure and output range information

    6. Triggered operation provides the range reading as desired

    7. All interfaces are active simultaneously

    8. Serial, 0 to Vcc, 9600Baud, 81N

    9. Analog , (Vcc/512) / inch

    10. Pulse width, (147uS/inch)

    11. Learns ringdown pattern when commanded to start ranging

    12. Designed for protected indoor environments

    13. Sensor operates at 42KHz

    14. High output square wave sensor drive (double Vcc)

    2.5.3 Benefits:

    1. Very low cost sonar ranger

    2. Reliable and stable range data

    3. Sensor dead zone virtually gone

    4. Lowest power ranger

    5. Quality beam characteristics

    6. Mounting holes provided on the circuit board

    7. Very low power ranger, excellent for multiple sensor or battery based systems

    8. Can be triggered externally or internally

    9. Sensor reports the range reading directly, frees up user processor

    10. Fast measurement cycle

    11. User can choose any of the three sensor outputs

    2.5.4 Beam Characteristics:

    Sample results for the LV-MaxSonar-EZ3 measured beam patterns are shown

    below on a 12-inch grid. The detection pattern is shown for;

    (A) 0.25-inch diameter dowel, note the narrow beam for close small objects,

    (B) 1-inch diameter dowel, note the long narrow detection pattern,

  • 8/11/2019 Electronic Mirror New1

    20/42

    20

    (C) 3.25-inch diameter rod, note the long controlled detection pattern,

    (D) 11-inch wide board moved left to right with the board parallel to the front

    sensor face and the sensor stationary. This shows the sensors range capability.

    F ig 6:Beam character istics

    Note: The displayed beam width of (D) is a function of the specular nature of sonar and the

    shape of the board (i.e. flat mirror like) and should never be confused withactual sensor beam

    width.

    2.5.5 PIN DESCRIPTION:

    F ig 7: Pin diagram of L v-MaxSonar-Ez3

    G N DReturn for the DC power supply. GND (& Vcc) must be ripple and noise

    free for best operation.

    +5 VVccOperates on 2.5V - 5.5V. Recommended current capability of 3mA

    for 5V, and 2mA for 3V.

  • 8/11/2019 Electronic Mirror New1

    21/42

    21

    TXWhen the *BW is open or held low, the TX output delivers variety of passive

    components,asynchronous serial with an RS232 format, except voltages are 0-

    Vcc.The output is an ASCII capital R, followed by three ASCII character

    digits representing the range in inches up to a maximum of 255,followed by a

    carriage return (ASCII 13). The baud rate is 9600, 8bits, no parity, with one stop

    bit. Although the voltage of 0-Vcc is outside the RS232 standard, most RS232

    devices have sufficient margin to read 0-Vcc serial data. If standard voltage level

    RS232 is desired, invert, and connect an RS232 converter such as a MAX232.

    When BW pin is held high the TX output sends a single pulse, suitable

    for low noise chaining. (no serial data).

    R XThis pin is internally pulled high. The EZ3 will continually measure range

    and output if RX data is left unconnected or held high. If hel d low the EZ3 will

    stop ranging. Bring high for 20uS or more to command a range reading.

    A NOutputs analog voltage with a scaling factor of (Vcc/512) per inch. A supply

    of 5V yields ~9.8mV/in. and 3.3V yields ~6.4mV/in.The output is buffered and

    corresponds to the most recent range data.P WThis pin outputs a pulse width representation of range. The distance can be

    calculated using the scale factor of 147uS per inch.

    BW*Leave open or hold low for serial output on the TX output.When BW pin is

    held high the TX output sends a pulse (instead of serial data), suitable for low

    noise chaining.

    2.5.6 LV-MAXSONAR-EZ3 CIRCUIT:

    The LV-MaxSonar-EZ3 sensor functions using active components consisting

    of an LM324,a diode array, a PIC16F676, together with a variety of passive

    components

  • 8/11/2019 Electronic Mirror New1

    22/42

    22

    F ig 8: Working Circuit diagram of Lv-MaxSonar-Ez3

    Timing Description:

    250mS after power-up, the LV-MaxSonar-EZ3 is ready to accept the RX

    command. If the RX pin is left open or held high, the sensor will first run a

    calibration cycle (49mS), and then it will take a range reading (49mS). After the

    power up delay, the first reading will take an additional ~100mS. Subsequent

    readings will take 49mS. The LV-MaxSonar-EZ3 checks the RX pin at the end of

    every cycle. Range data can be acquired once every 49mS.Each 49mS period starts

    by the RX being high or open, after which the LV-MaxSonar-EZ3 sends thirteen

    42KHz waves, after which the pulse width pin (PW) is set high. When a target is

    detected the PW pin is pulled low. The PW pin is high for up to 37.5mS if no

    target is detected. The remainder of the 49mS time (less 4.7mS) is spent adjusting

    the analog voltage to the correct level. When a long distance is measured

    immediately after a short distance reading, the analog voltage may not reach the

    exact level within one read cycle. During the last 4.7mS, the serial data is sent. The

  • 8/11/2019 Electronic Mirror New1

    23/42

    23

    LV-MaxSonar-EZ3 timing is factory calibrated to one percent at five volts, and in

    use is better than two percent. In addition,operation at 3.3V typically causes the

    objects range, to be reported, one to two percent further than actual.

    General Power-Up Instruction:

    Each time after the LV-MaxSonar-EZ3 is powered up, it will calibrate

    during its first read cycle. The sensor uses this stored information to range a close

    object. It is important that objects not be close to the sensor during this calibration

    cycle. The best sensitivity is obtained when it is clear for fourteen inches, but good

    results are common when clear for at least seven inches. If an object is too close

    during the calibration cycle, the sensor may then ignore objects at that distance.The

    LV-MaxSonar-EZ3 does not use the calibration data to temperature compensate

    for range, but instead to compensate for the sensor ringdown pattern. If the

    temperature, humidity, or applied voltage changes during operation, thesensor may

    require recalibration to reacquire the ringdown pattern. Unless recalibrated, if the

    temperature increases, thesensor is more likely to have false close readings. If thetemperature decreases, the sensor is more likely to have reduced up close

    sensitivity. To recalibrate the LV-MaxSonar-EZ3, cycle power, then command a

    read cycle.

    2.6 PIC MICROCONTROLLER:

    PIC is a family of Harvard architecture microcontrollers made by Microchip

    Technology, derived from the PIC1650. originally developed by General

    Instrument's Microelectronics Division. The name PIC initially referred to

    "Peripheral Interface Controller".

    PICs are popular with both industrial developers and hobbyists alike due to

    their low cost, wide availability, large user base, extensive collection of

    application notes, availability of low cost or free development tools, and

    serial programming (and re-programming with flash memory) capability.

  • 8/11/2019 Electronic Mirror New1

    24/42

    24

    Microchip announced on February 2008 the shipment of its six billionth PIC

    processor.

    2.6.1 General Architecture of PIC:

    The PIC architecture is characterized by its multiple attributes:

    Separate code and data spaces (Harvard architecture) for devices other than PIC32,

    which has a Von Neumann architecture.A small number of fixed length

    instructions.Most instructions are single cycle execution (2 clock cycles, or 4

    clockcycles in 8bit models), with one delay cycle on branches and skips

    One accumulator (W0), the use of which (as source operand) is implied (i.e. is not

    encoded in the opcode).All RAM locations function as registers as both source

    and/or destination of math and other functions.A hardware stack for storing return

    addresses.A fairly small amount of addressable data space (typically 256

    bytes),extended through banking.Data space mapped CPU, port, and peripheral

    register The program counter is also mapped into the data space and writable (is

    used to implement indirect jumps).There is no distinction between memory space

    and register space because the RAM serves the job of both memory and registers,and the RAM is usually just referred to as the register file or simply as the

    registers.

    Data space (RAM):

    PICs have a set of registers that function as general purpose RAM. Special

    purpose control registers for on-chip hardware resources are also mapped into thedata space. The addressability of memory varies depending on device series, and

    all PIC devices have some banking mechanism to extend addressing to additional

    memory. Later series of devices feature move instructions which can cover the

    whole addressable space,independent of the selected bank. In earlier devices, any

    register move had to be achieved via the accumulator.

    To implement indirect addressing, a "file select register" (FSR) and "indirect

    register" (INDF) are used. A register number is written to the FSR,after which

  • 8/11/2019 Electronic Mirror New1

    25/42

    25

    reads from or writes to INDF will actually be to or from the register pointed to by

    FSR. Later devices extended this concept with postand pre increment / decrement

    for greater efficiency in accessing sequentially stored data. This also allows FSR to

    be treated almost like astack pointer (SP).External data memory is not directly

    addressable except in some high pic count PIC18 devices.

    Code space:

    The code space is generally implemented as ROM, EPROM or flash ROM.

    In general, external code memory is not directly addressable due to the lack of an

    external memory interface. The exceptions are PIC17 and select high pin count

    PIC18 devices.

    Word size:

    All PICs handle (and address) data in 8-bit chunks. However, the unit of

    addressability of the code space is not generally the same as the data space. For

    example, PICs in the baseline and mid-range families have program memory

    addressable in the same wordsize as the instruction width, i.e. 12 or 14 bits

    respectively. In contrast, in the PIC18 series, the program memory is addressed in8-bit increments (bytes), which differs from the instruction width of 16 bits.In

    order to be clear, the program memory capacity is usually stated in number of

    (single word) instructions, rather than in bytes.

    2.6.2 Instruction set:

    A PIC's instructions vary from about 35 instructions for the low-end PICs to

    over 80 instructions for the high-end PICs. The instruction set includes instructionsto perform a variety of operations on registers directly,the accumulator and a literal

    constant or the accumulator and a register, as well as for conditional execution, and

    program branching.

    Some operations, such as bit setting and testing, can be performed on any

    numbered register, but bi-operand arithmetic operations always involve W

    (the accumulator), writing the result back to either W or the other operand

  • 8/11/2019 Electronic Mirror New1

    26/42

    26

    register. To load a constant, it is necessary to load it into W before it can be moved

    into another register. On the older cores, all register moves needed to pass through

    W, but this changed on the "high end" cores. PIC cores have skip instructions

    which are used for conditional execution and branching. The skip instructions are

    'skip if bit set' and 'skip if bit not set'.

    In general, PIC instructions fall into 5 classes:

    1. Operation on working register (WREG) with 8-bit immediate ("literal")

    operand. E.g. movlw (move literal to WREG), andlw (AND literal with WREG).

    One instruction peculiar to the PIC is retlw, load immediate into WREG and

    return, which is used with computed branches to produce lookup tables.

    2. Operation with WREG and indexed register. The result can be written to either

    the Working register (e.g. addwf reg,w). or the selected register (e.g. addwf reg,f).

    3. Bit operations. These take a register number and a bit number, and perform one

    of 4 actions: set or clear a bit, and test and skip on set/clear. The latter are used to

    perform conditional branches. The usual ALU status flags are available in a

    numbered register so operations such as "branch on carry clear" are possible.4. Control transfers. Other than the skip instructions previously mentioned, there

    are only two: goto and call.

    5. A few miscellaneous zero-operand instructions, such as return from subroutine,

    and sleep to enter low-power mode.

    Performance:

    The architectural decisions are directed at the maximization of speed-tocostratio. The PIC architecture was among the first scalar CPU designs,and is still

    among the simplest and cheapest. The Harvard architecturein which instructions

    and data come from separate sourcessimplifies timing and microcircuit design

    greatly, and this benefits clock speed, price, and power consumption.

    The PIC instruction set is suited to implementation of fast lookup tables in

    the program space. Such lookups take one instruction and two instruction

  • 8/11/2019 Electronic Mirror New1

    27/42

    27

    cycles. Many functions can be modeled in this way. Optimization is facilitated by

    the relatively large program space of the PIC (e.g. 4096 x 14- bit words on the

    16F690) and by the design of the instruction set, which allows for embedded

    constants. For example, a branch instruction's target may be indexed by W, and

    execute a "RETLW" which does as it is named- return with literal in W Execution

    time can be accurately estimated by multiplying the number of

    instructions by two cycles; this simplifies design of real-time code.

    Similarly, interrupt latency is constant at three instruction cycles. External

    interrupts have to be synchronized with the four clock instruction cycle,otherwise

    there can be a one instruction cycle jitter. Internal interrupts are already

    synchronized. The constant interrupt latency allows PICs to achieve interrupt

    driven low jitter timing sequences. An example of this is a video sync pulse

    generator. This is no longer true in the newest PIC models, because they have a

    synchronous interrupt latency of three or four cycles.

    2.6.3 Advantages:

    The PIC architectures have these advantages:1. Small instruction set to learn

    2. RISC architecture

    3. Built in oscillator with selectable speeds

    4. Inexpensive microcontrollers

    5. Wide range of interfaces including IC, SPI, USB, USART, A/D,programmable

    comparators, PWM, LIN, CAN, PSP, and Ethernet2.6.4 Limitations:

    The PIC architectures have these limitations:

    1. One accumulator.

    2. Register-bank switching is required to access the entire RAM of many devices

    3. Operations and registers are not orthogonal; some instructions can

    address RAM and/or immediate constants, while others can only use

    the accumulator.

  • 8/11/2019 Electronic Mirror New1

    28/42

    28

    Compiler development:

    The easy to learn RISC instruction set of the PIC assembly language code

    can make the overall flow difficult to comprehend. Judicious use of simple macros

    can increase the readability of PIC assembly language. For example, the original

    Parallax PIC assembler ("SPASM") has macros which hide W and make the PIC

    look like a two-address machine. It has macro instructions like "mov b, a" (move

    the data from address a to address b) and "add b, a" (add data from address a to

    data in address b).It also hides the skip instructions by providing three operand

    branch macro instructions such as "cjne a, b, dest" (compare a with b and jump to

    dest if they are not equal).

    2.7 PIC16F676

    14-Pin FLASH-Based 8-Bit CMOS Microcontroller.

    High Performance RISC CPU:

    Only 35 instructions to learn

    - All single cycle instructions except branches Operating speed:

    - DC - 20 MHz oscillator/clock input

    - DC - 200 ns instruction cycle

    Interrupt capability

    8-level deep hardware stack

    Direct, Indirect, and Relative Addressing modesSpecial Microcontroller Features:

    Internal and external oscillator options

    - Precision Internal 4 MHz oscillator factory calibrated to 1%

    - External Oscillator support for crystals and resonators

    - 5 s wake-up from SLEEP, 3.0V, typical

    Power saving SLEEP mode

    Wide operating voltage range - 2.0V to 5.5V

  • 8/11/2019 Electronic Mirror New1

    29/42

    29

    Industrial and Extended temperature range

    Low power Power-on Reset (POR)

    Power-up Timer (PWRT) and Oscillator Start-upTimer (OST)

    Brown-out Detect (BOD)

    Watchdog Timer (WDT) with independent oscillator for reliable operation

    Multiplexed MCLR/Input-pin

    Interrupt-on-pin change

    Individual programmable weak pull-ups

    Programmable code protection

    High Endurance FLASH/EEPROM Cell

    - 100,000 write FLASH endurance

    - 1,000,000 write EEPROM endurance

    - FLASH/Data EEPROM Retention: > 40 years

    Low Power Features:

    Standby Current:

    - 1 nA at 2.0V, typical Operating Current:

    - 8.5A at 32 kHz, 2.0V, typical

    - 100A at 1 MHz, 2.0V, typical

    Watchdog Timer Current

    - 300 nA at 2.0V, typical

    Timer1 oscillator current:- 4 A at 32 kHz, 2.0V, typical

    Peripheral Features:

    12 I/O pins with individual direction control

    High current sink/source for direct LED drive

    Analog comparator module with:

    - One analog comparator

    - Programmable on-chip comparator voltage reference (CVREF) module

  • 8/11/2019 Electronic Mirror New1

    30/42

    30

    - Programmable input multiplexing from device inputs

    - Comparator output is externally accessible

    Analog-to-Digital Converter module (PIC16F676):

    - 10-bit resolution

    - Programmable 8-channel input

    - Voltage reference input

    Timer0:8-bit timer/counter with 8-bit programmable prescaler

    Enhanced Timer1:

    - 16-bit timer/counter with prescaler

    - External Gate Input mode

    - Option to use OSC1 and OSC2 in LP mode as Timer1 oscillator,

    INTOSC mode selected.

    In-Circuit Serial ProgrammingTM (ICSPTM) via two pins.

    2.7.1 PIN DIAGRAM

    F ig 9: Pin Diagram of PIC16F676

  • 8/11/2019 Electronic Mirror New1

    31/42

    31

    PIN DESCRIPTION

    Table 1:Pin description of PIC16F676

  • 8/11/2019 Electronic Mirror New1

    32/42

    32

    2.7.2 ARCHITECTURE OF PIC16F676

    F ig 10:B lock diagram of PIC16F676

    2.8 LM 324

    Low Power Quad Operational Amplifier

    2.8.1 DESCRIPTION

    The LM324 contains four independent high gain operational amplifiers with

    internal frenquency compensation.The four op-amps operate over a wide voltagerange from a single power supply.Also use a split power supply.The device has

  • 8/11/2019 Electronic Mirror New1

    33/42

    33

    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.

    2.8.2 PIN CONFIGURATION

    F ig 11: Pin confi guration of LM324

    2.8.3 FEATURES

    1. Internally frequency-compensated for unity gain

    2. Large DC voltage gain:100 dB

    3. Wide bandwidth(unity gain):1 MHz(temperature-compensated)

    4. Wide power supply range:

    5. Single supply:3VDC to 32 VDC

    6. Dual supplies:1.5VDC to 16VDC

    7. Differential input voltage range equal to the power supply voltage

    8. Power drain suitable for battery operation

    9. Large output voltage swing:0VDC to VCC-1.5VDC

  • 8/11/2019 Electronic Mirror New1

    34/42

  • 8/11/2019 Electronic Mirror New1

    35/42

    35

    OPERATING TEMPERATURE:-

    o The operating temperature for the Display is -3 to +7.

    o

    The supply voltage for the display Is -19 to +0.3.o The unit for the operating voltage and the supply is VOLTS.

    o The operating temperature is -30 to +85.

    o The storing temperature is -55 to +125.

    o

    The unit for the operating and storing temperature is Celsius.

    2.9.2 BOARD SCHEMATICS:-

    F ig 13:Board Schematics of LCD

  • 8/11/2019 Electronic Mirror New1

    36/42

  • 8/11/2019 Electronic Mirror New1

    37/42

    37

    STEP 1:- Intializing the output port

    STEP 2:- Reset =0 for a while & make it to 1// Display Reset

    STEP 3:- Delay for Millisecond.

    STEP 4:-Enable=0 // Intialize Enable signal

    CS1=0// CHIP SELECT SIGNAL FOR IC1

    CS2=0// CHIP SELECT SIGNAL FOR IC2

    R/W=RS=0//Intialize Read/Write & Register select signal

    STEP 5:-Consider chip 1(IC 1)

    A.

    Intialize display ON/OFF// Controls the display ON/OFF.

    Internal status & Display RAM data is not effected .

    B.Repeat STEP 3.

    C.Send instruction to the output port. // Refer Send instruction

    V Display Start Line

    A.Intialize the display Start Line (Z Address).

    B.Repeat step 3

    C.Send the instruction to output port.

    V Set Address

    A.Intialize Set address(Y Address)

    B.Repeat step 3.

    C.Send instruction to output port

    STEP 6: Repeat STEP 5 for chip 2 (IC2)

    STEP 7: Write Data in LCD :

    1)

    Get the chip select, Page number & Start line to display data.

    2) Read an 8-bit data&send it to output port.

  • 8/11/2019 Electronic Mirror New1

    38/42

    38

    Send instruction :-

    1)

    R/W=0, CS1=1,CS2=0,RS=0.//For IC1

    (or)

    R/W=0, CS1=0,CS2=1,RS=0.//For IC2

    2)

    Send instruction to output port.

    3)

    Enable=1 for a while &make it to 0.

    Send Data:-

    1)

    R/W=0, CS1=1,CS2=0,RS=0.//For IC1

    (or)

    R/W=0, CS1=0,CS2=1,RS=1.//For IC2

    2) Send data to output port.

    3) Enable=1 for a while &make it to 0.

    2.9.4 PIN DIAGRAM

    PIN NO SYMBOL DESCRIPTION FUNCTION

    1 VSS Ground 0V

    2 VDDPOWER SUPPLY

    FOR LOGICCIRCUIT

    +5V

    3 V0LCD contrast

    adjustment

    4 RSInstruction /data

    register selection

    RS=0: Instruction register

    RS=1: Data Register

    6E ENABLE SIGNAL

  • 8/11/2019 Electronic Mirror New1

    39/42

    39

    7 DB0

    Data Input / output

    lines8 data lines : DB0-DB7

    8 DB1

    9 DB2

    10 DB3

    11 DB4

    12 DB5

    13 DB6

    14 DB7

    15 CS1Chip selection

    CS1=1,Chip select signal for

    ic1

    16 CS2 Chip selection

    CS2=1,Chip select signal for

    ic2

    17RST Reset signal

    RSTB=0 Display off; display

    from line 0

    18 VEENegative voltage

    for LCD driving10V

    19 LED+Supply voltage for

    LED+5V

    20 LED-Supply voltage for

    LED-0V

    Table 2: PIN Functions of Graphic LCD Display

  • 8/11/2019 Electronic Mirror New1

    40/42

    40

    CONCLUSION

    The above mentioned project when implemented in real time will bring about the

    revolution in the society by preventing road accidents.This method is obviously

    advantageous over existing technologies by providing more safety during

    driving.The sensor can detect the obstacle in hair-pin bend curve in hill station also

    which is useful in avoiding accidents during curves. This distance measurement

    sensor can also be used in other field such as industry, medicine and military.

    METHODOLOGY

  • 8/11/2019 Electronic Mirror New1

    41/42

    41

    REFERENCES

    Web sources

    www.electronicsforyou.com

    www.maxbotix.com

    www.microchip.com

    www.national.com

    www.jhdlcd.com.cn

    E-book sources

    An ultrasonic for distance measurement in automotive applications-

    A Carullo - Sensors Journal, IEEE, 2001 - ieeexplore.ieee.org

    Microcontroller based distance measurement-for measuring short

    distance-K.Padmanaban,EFY-www.electronicsforyou.com

    Y. Jang, S. Shin, J. W. Lee, and S. Kim, A preliminary study for

    portable walking distance measurement system using ultrasonic

    sensors, Proceedings of the 29th Annual IEEE International

    Conference of the EMBS, France, Aug. 2007, pp. 5290-5293

    The Design of car reversing Anti-collision Warning system.

    -Journal of Taiyuan University of Science and Technology32(3),

    172176(2011).

    The PIC Microcontroller ;Your personal Introductory Course

    -John Marton .

    http://www.electronicsforyou.com/http://www.electronicsforyou.com/http://www.maxbotix.com/http://www.maxbotix.com/http://www.microchip.com/http://www.microchip.com/http://www.national.com/http://www.national.com/http://www.jhdlcd.com.cn/http://www.jhdlcd.com.cn/http://www.jhdlcd.com.cn/http://www.national.com/http://www.microchip.com/http://www.maxbotix.com/http://www.electronicsforyou.com/
  • 8/11/2019 Electronic Mirror New1

    42/42

    TIME CHART

    PHASE 1

    Step 1 Selection of Title

    Step 2

    Real Time Identification

    Step 3 Literature Reference

    Step 4 Component Identification

    Step 5 Study of Components