Project2 Final Paper

download Project2 Final Paper

of 20

Transcript of Project2 Final Paper

  • 8/2/2019 Project2 Final Paper

    1/20

    AUTOMOBILE COLLISION DETECTION SYSTEM

    by

    Eilleen Berganos and Timothy Lim

    ECE 345Senior Design

    TA: Shao Hsia

    December 5, 2000

    Project #2

  • 8/2/2019 Project2 Final Paper

    2/20

    Abstract

    In this paper, the goal is to present a senior design project which pertains to building anautomobile collision detection system that will successfully detect obstacles or targets at a varietyof ranges, avoid side collision situations via force feedback to the driver, and create an easy wayfor alerting the driver of obstacles and collisions via a user friendly console. The components,design, and verification of the entire project will be discussed as well as certain challenges that

    came up while work was done on the project. Primarily ultrasonic sensors, an analog to digitalconverter, a Motorola 68HC12 microcontroller, and a set of light emitting diodes implemented thedesign.

    ii

  • 8/2/2019 Project2 Final Paper

    3/20

    TABLE OF CONTENTS

    PAGE

    1. INTRODUCTION...1

    1.1 Functionality and block diagram.....11.2 Performance variables and specifications11.3 Major design components1

    2. DESIGN PROCEDURE..3

    2.1 Sensing System Procedure...32.2 System Logic Procedure..32.3 Design Alternatives..4

    3. DESIGN DETAILS.6

    3.1 Sensing System Details63.2 System Logic Procedure..7

    4. DESIGN VERIFICATION11

    4.1 Sensing System Verification..114.2 System Logic Verification.12

    5. COSTS...15

    6. CONCLUSION..16

    APPENDIX 1. REFERENCES.17

    iii

  • 8/2/2019 Project2 Final Paper

    4/20

    1. Introduction

    1.1 Functionality and Block Diagram

    The block diagram of the automobile collision detection system is shown in Figure 1.1 at the end of the

    chapter and the functionality of each block is as follows:

    SensorWill detect obstacles and withstand most everyday environments.

    LogicWill handle a network of sensors linking the sensors to a microcontroller and be implementedwith a demultiplexer.

    SynchronizationWill cycle through sensory data coming in from the demultiplexer and relay theinformation to a proximity alert console and if need be relay control signals to drivers steering wheel toproduce force feedback in situations where side collisions are imminent.

    Presentation of DataWill present data processed by the microcontroller and display the results of thesensor data to the user via a proximity alert console.

    Guidance SystemWill take control signals presented from the microcontroller and present it to the useras force feedback.

    1.2 Performance variables and specifications

    The variables pertaining to the performance of the project include the time-delay from the sensor to thelight emitting diode console, the distance between the object and the sensor, and the analog to digitalreference voltages. The time-delay from the sensor to the light emitting diode console pertains to the timeit takes for the system to produce a LED output after the sensor detects an object in its detection range.This value should be less than half a second. The distance between the object and the sensor pertains tothe minimum and maximum distances that the sensor can accurately detect any object. The value of theminimum and maximum detection range of the ultrasonic sensors should be 0 in. and 12 in. respectively.The analog to digital reference voltage pertains to the voltage value that the analog to digital converterutilizes in order to determine its sampling value in bits per mV. The value of this should be around 1.3 Vwith a resulting resolution of 5 mV/bit.

    1.3 Major design components

    The purpose of the Automobile Collision Detection system is to keep drivers better informed with theenvironment surrounding them. The system consists of eight different sensing areas: front, rear, side, andas well as front and rear diagonal positions. To implement this system, the following components wereused: the sensor system and the system logic. The sensing system consists a set of Jameco model number40TR128 ultrasonic sensors and a National Semiconductor ADC0808 model analog to digital converter.The data sheets for the sensors and the analog digital converter can be found athttp://www.jameco.com/Jameco/Products/ProdDS/139491.PDF and http://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdf, respectively. The system logic consists of Motorola 68HC12Microcontroller and a set of LEDs for each sensor area.

    1

    http://www.jameco.com/Jameco/Products/ProdDS/139491.PDFhttp://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdfhttp://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdfhttp://www.jameco.com/Jameco/Products/ProdDS/139491.PDFhttp://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdfhttp://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdf
  • 8/2/2019 Project2 Final Paper

    5/20

    Figure 1.1. Block Diagram of the Automobile Collision Detection System

    2

  • 8/2/2019 Project2 Final Paper

    6/20

    2. Design Procedure

    2.1 Sensing System Procedure

    In the sensing system of the project a set of ultrasonic sensors and an analog to digital converter are used.The system required eight analog signals to be converted from each of the eight sensing areas of thesystem (front, rear, left side, right side, front right, front left, rear right, and rear left). It was alsodetermined that a smaller reference voltage needed to be fed into the analog to digital converter in orderfor the analog signal coming in from the sensors to be utilized properly by the microcontroller. The analogsignal coming in from the sensors was pretty small in magnitude and so the reference voltage needed to bereduced so that the signal can be more accurately broken down for the microcontroller to use. To bring thevoltage down, an appropriate resistor was dropped down from a voltage source to the analog to digitalconverter. The equation used to calculate the reference voltage needed for a particular resolution can beseen in Equation (1) below. A general circuit diagram of the sensing system can be seen in Figure 2.1 atthe end of the chapter.

    Bit resolution * Analog to digital converter resolution = Desired reference voltage (1)

    In order to choose the resistor that needed to be pulled to the voltage source we used Equation (2) belowafter measuring the current coming into the analog to digital converter.

    Resistor value = (Value of main voltage source desired reference voltage)/measured current (2)

    2.2 System Logic Procedure

    The system logic is the subproject that ties the user interface and ultrasonic sensors together. Thissubproject determines the sub-ranges of each sensor area while at the same time outputting thisinformation to the user interface.

    The sensor ranges were predetermined with voltage measurements from the ultrasonic sensors and theanalog/digital conversion discussed in Section 2.1. Each sensor area had a range of 0 to 12 inches.Therefore, each range was arbitrarily divided into four different sub-ranges. With each sub-range, thecorresponding light emitting diode (LED) on the user interface would be lit. A summary of the sub-rangesfor each sensor area and corresponding LEDs are listed in Table 2.1.

    TABLE 2.1. Designation of sub-ranges with reference voltage = 1.3 Volts.

    Sub-Range Voltage Amplitude (mV) LED Display

    1 (10-12 inches) 0-59 Green

    2 (7-9 inches) 60-119 Yellow

    3 (3-6 inches) 120-179 Red

    4 (0-2 inches) 180 Force Feedback LED

    The voltage amplitudes are measurements from the ultrasonic sensors at different ranges. The 5mv/bitvalue is the value calculated from the reference voltage of the analog/digital conversion. Both the voltageamplitude and the 5mV/bit value are discussed further in the previous section. Using the maximumvoltage level within each sub-range chooses the boundary values. Equation (3) shows how to determinethe boundary values.

    3

  • 8/2/2019 Project2 Final Paper

    7/20

    Boundary Value = (Maximum Voltage Amplitude in sub-range) / (5mv/bit) (3)

    These boundary values would then be converted to a binary number for easy comparison with the binarydata that would be coming from the ultrasonic sensors along with their analog/digital conversion.

    The Motorola 68HC12 Microcontroller would take the binary data determined for the boundaries and the

    binary data from the sensors to determine the proper output to the user interface. With the microcontrollerthe sensor area and its corresponding sub-range would easily be determined. It would compare and branchaccording to the predetermined boundary values.

    Once the sub-ranges were determined with the 68HC12 Microcontroller, the determined values wouldneed to be outputted to the user interface. The user interface comprised of a series of LEDs. Each LEDrepresented each sub-range within each sensor area. Therefore, the corresponding area that was activatedwould be lit on the user display.

    With all these elements combined, the user will be able to see where obstacles are located around theirvehicle and make the necessary adjustments.

    2.3 Design Alternatives

    The reason ultrasonic sensors are used is because they are the best available sensors to accurately detectobjects of virtually any material and through many types of weather unlike sensors of the infra-red andphotoelectric variety. In deciding what analog to digital converter to use, the need for an analog to digitalconverter with a multiplexer as opposed to an analog to digital converter that took in analog signals one ata time was realized. It was determined that an analog to digital converter with a multiplexer built into itwill be advantageous over a configuration of two separate entities (multiplexer and analog to digitalconverter configured separately) due to the reduced propagation time of the combined analog to digitalconverter and multiplexer package. Other design alternatives could involve the system logic. The system

    logic could have been built using simple logic. However, this design was not chosen in hope of addingmore functionality to the collision system in the future.

    4

  • 8/2/2019 Project2 Final Paper

    8/20

    Figure 2.1. General Circuit Diagram of Sensing System

    5

  • 8/2/2019 Project2 Final Paper

    9/20

    3. Design Details

    3.1 Sensing System Details

    To get an idea of the voltage range that needed to be dealt with coming from the ultrasonic sensors,different distances between an arbitrary object (a wirekit) and the sensor had to be determined. The datathat was acquired in Table 3.1 below shows the approximate magnitudes of voltages at different objectdistances for a given ultrasonic sensor transmitter/receiver pair.

    TABLE 3.1. Voltage as a function of Distance using Wirekit (Plastic Object)

    Distance (inches) Voltages (mV)

    1.00 177.35

    2.00 140.60

    3.00 79.69

    4.00 62.50

    5.00 60.94

    6.00 56.257.00 53.13

    8.00 50.00

    9.00 42.19

    10.00 23.44

    11.00 21.88

    12.00 17.19

    13.00 12.50

    After coming up with the voltage magnitudes above, it can be seen that a small bit resolution is the most

    desirable since the voltage magnitudes coming out of the ultrasonic sensor are pretty small. A smaller bitresolution would allow the microcontroller to better distinguish between different distances. It wasdecided then that a bit resolution of 5mV/bit would be sufficient enough for a good distancedifferentiation. In order come up with the appropriate 5mV/bit resolution for the analog to digitalconversion instead of the default resolution produced by a 5 V reference voltage coming from the mainvoltage source (Vcc), which would have been 20mV/bit, the reference voltage that was required to be fedinto the analog to digital converter needed to be calculated. Using Equation (1), a voltage reference ofabout 1.3 V was calculated. The calculation can be seen below for this in Equation (4).

    5 mV/bit * 256 bits = 1.28 V 1.3 V (4)

    Next, the resistor value dropping from the main voltage source needed to be calculated. First, the currentto the voltage reference pin, without the presence of a resistor, was measured by an ammeter to be 5 mA.The desired reference voltage was 1.3 V. Using Equation (2), a resistor with a value of 740 ohms wascalculated in order to produce the reference voltage. The calculation for this is shown below in Equation(5).

    (5 volts 1.3 volts) / 5 mA = 740 ohms (5)

    3.2 System Logic Details

    6

  • 8/2/2019 Project2 Final Paper

    10/20

    The system logic can be divided into two main components: the microcontroller and the user interface.The user interface depends solely on the output of the microcontroller. Therefore it is important that themicrocontroller efficiently execute the code and is constantly updating the information from the sensors.The details of the microcontroller are described further below.

    The Motorola 68HC12 Microcontroller combined the elements of the user interface and the ultrasonic

    sensors. The three main functions of the microcontroller were the following:

    1. Control the multiplexer to select appropriate sensing area2. Determination of ranges with compares and branch commands3. Control the output to the user interface

    Each of the sensor areas goes through each of the above functions by cycling through an infinite loop.This is to ensure constant updates for the user display and to ensure that the microcontroller is getting themost updated information from the ultrasonic sensors.

    While cycling through the infinite loop, the microcontroller must choose which sensor it wants to look at.

    This is done with Port E. The values of Port E are outputted to the multiplexer and in turn that multiplexerchooses the appropriate sensor pair. For example, while cycling through each sensor area within the codeit would first set the value for the multiplexer followed by a half second delay. The delay is implementedby decrementing a numeric variable until it reaches zero. This delay ensures that the signal has time to gothrough the analog/digital conversion and can be inputted through Port A. At the same time, this delaydoes not cause any significant delay that will cause the user to have inaccurate information about theobstacles around them. The values used to select the sensor area are stated in Table 3.1.

    TABLE 3.1. Control values for selecting sensor areas.

    PORT E (PE7, PE6) Sensor Area

    00 Left Side01 Rear Left Diagonal

    10 Mid Rear

    11 Rear Right Diagonal

    Once the delay is done it loads and stores the data from the analog/digital conversion of the ultrasonicsensors into Port A. It then goes through a range of compares and branches with the boundary valuescalculated ahead of time. The process can easily be seen through the flow diagram in Figure 3.1 at the endof the chapter. It loads and stores the value from the sensor that was selected earlier with Port E. Then itcompares this value with the boundary values calculated in Table 3.2. When the compare is done,

    depending if it is within the boundary values, it will assign the proper values to Port B and then branch tothe next sensor area. The boundary values are 60 mV, 120 mV, and 180 mV respectively. By usingEquation (1), the binary values for the boundary values are calculated and listed within Table 3.2.

    TABLE 3.2. Boundary values used in branching.

    7

  • 8/2/2019 Project2 Final Paper

    11/20

    Boundary Value (mV) Boundary ValueCalculated from Equation (1)

    60 0000 1100

    120 0001 1000

    180 0010 0100

    Port B is the output that controls the user interface. These values are determined from the comparisondescribed above. Port B is set up in a way in which 2 bits of the 8-bit port represent the 4 different sensorareas. From there, those 2 bits can have up to four different values depending on the sub-range. Table 3.3describes which bits of Port B are designated to which area. Table 3.4 describes the possible values foreach area and their subsequent sub-ranges along with their values for the user interface display.

    TABLE 3.3. Designation of Sensor Area in Port B

    PORT B (Bits Used) Sensor Area

    PB7, PB6 Left Side

    PB5, PB4 Rear Left Diagonal

    PB3, PB2 Mid Rear

    PB1, PB0 Rear Right Diagonal

    TABLE 3.4. Possible Values for each sensor area

    Sub-ranges Value LED Display

    1 (10-12 inches) 00 Green

    2 (7-9 inches) 01 Yellow

    3 (3-6 inches) 10 Red

    4 (0-2 inches) 11 Force Feedback LED

    Once all of these values are determined, they are used to build the user interface. The user interface isbuilt using a 3 to 8 decoder and a set of inverters for each sensor area. A LED is tied via an inverter to thefirst four least significant address lines since these are the only address lines for the four different sub-ranges. The values from Port B are used as selector bits for the decoder hence give a low to the selectedaddress and a high to all the other address. Therefore an inverter is needed to subsequently reverse allthese signals therefore allowing the corresponding LED to be lit.

    The user interface is built using the decoder and inverter. They are arranged according to Figure 3.2 at theend of the chapter.

    8

  • 8/2/2019 Project2 Final Paper

    12/20

    Figure 3.1. Flow Diagram for each sensor area

    LoadLoads input into PORTA

    CompareRange 1

    Store

    Stores input intoPORT A

    StorePut proper value into

    LED

    Each sensor

    area goesthrough this

    process .

    CompareRange 2

    CompareRange 3

    CompareRange 4

    Start for new

    Sensor Area

    9

  • 8/2/2019 Project2 Final Paper

    13/20

    Figure 3.2. User Interface

    Front

    Rear

    10

  • 8/2/2019 Project2 Final Paper

    14/20

    4. Design Verification

    4.1 Sensing System Verification

    In order to verify that the sensing system was working according to its design, tests were done on thesensors and the analog to digital converter. For the sensors, voltage versus distance tests were done withobjects of differing materials. The data for objects made of plastic (which was shown in Table 3.1 on theprevious chapter), wood and metal. The data for wood and metal can be seen on Tables 4.1 and 4.2 belowrelating distance between sensor and object as well as the corresponding voltage level for each distance.

    TABLE 4.1. Voltage as a function of using

    Distance using Wooden ObjectTABLE 4.2. Voltage as a function of using

    Distance using Metal Object

    Distance (inches) Voltages (mV) Distance (inches) Voltages (mV)

    1.00 180.47 1.00 174.35

    2.00 145.45 2.00 132.43

    3.00 69.60 3.00 74.564.00 62.50 4.00 65.70

    5.00 60.30 5.00 61.39

    6.00 58.21 6.00 59.54

    7.00 52.43 7.00 51.37

    8.00 48.55 8.00 49.66

    9.00 43.68 9.00 42.78

    10.00 26.89 10.00 28.89

    11.00 20.73 11.00 21.11

    12.00 19.57 12.00 19.56

    13.00 12.45 13.00 13.01

    As can be seen by Tables 3.1, 4.1 and 4.2, the voltages dont differ that much at each distance. Thisconfirms that the sensors are indeed independent of the material that the object is made of.

    In order to verify the functionality of the analog to digital converter, eight light emitting diodes wereconnected to each of the eight digital output ports of the analog to digital converter. When the time cameto convert the analog signals coming from the sensors the bit value of the digital output can then be seenon the eight light emitting diodes. The values tested, voltages and the binary values realized can be seenon Table 4.3. When running these tests, a problem arose when the analog signal was being converted intoa binary value. The analog to digital converter was outputting many different binary values from one

    analog signal. It was then figured that this problem came from the fact that the analog signal coming infrom the sensors was so noisy that the analog to digital converter was converting the noise too. To remedythis, a full wave rectifier circuit was designed as an attempt to remove most of the noise. The circuit forthe diagram can be seen on Figure 4.1 at the end of the chapter.

    Unfortunately, after implementing the circuit into the system, it didnt correct the problem as expected.The PSPICE simulation of the graphed output of the rectifier circuit can be seen in Figure 4.2 at the end ofthe chapter. As can be seen, the circuit will ideally filter out all of the noise associated with the analogsignal. Resistor and capacitor values were chosen so that the time constant of the circuit would be equal tothe amount of time it took for the capacitor to reach ten percent of its maximum voltage value. Its in thisregion that steady state is achieved and thus a steady state signal can be realized. In order to figure out the

    11

  • 8/2/2019 Project2 Final Paper

    15/20

    time constant that we needed to use we measured the time it took a one picofarad capacitor to decay toten percent of its maximum voltage value. The desired time constant was set equal to this value and thevalue of the required resistor was calculated. Ten percent of the maximum voltage value of the onepicofarad capacitor was measured to be 1.25 us. And by using Equation (6) below, a resistor with a value

    of about 1.25 Mwas required to be used.

    = RC R = /C (1.25 us)/(1.0 pF ) = 1.25 M (6)

    Due to the lack of time and the fact that both the sensors and the analog to digital converter had achievedbasic functionality, the issue was not looked into any further.

    4.2 System Logic Verification

    To test the functionality of the system logic, simulated high and low signals were put into Port A. Thesimulated voltage values were determined using Equation (3). With this simulation it was possible to seethe output of the microcontroller through the user interface. The following values were used and theresults for each of the values.

    TABLE 4.3. Simulated inputs to test functionality of system logic.

    Sub-range Simulated Voltage Value(mV)

    Bit Value LED Display

    1 (10-12 inches) 20 0000 0100 Green

    1 (10-12 inches) 59 0000 1011 Green

    2 (7-9 inches) 60 0000 1100 Yellow

    2 (7-9 inches) 119 0001 0111 Yellow

    3 (3-6 inches) 120 0001 1000 Red

    3 (3-6 inches) 179 0010 0011 Red

    4 (0-2 inches) 180 0010 0100 Force Feedback LED

    Only one test was done with Range 4 because anything higher that the bit value would have the sameoutput on the LED user display. With this test we were able to verify the functionality of themicrocontroller.

    12

  • 8/2/2019 Project2 Final Paper

    16/20

    Figure 4.1. Full Wave Bridge Rectifier Circuit Layout with Low Pass Filter

    13

  • 8/2/2019 Project2 Final Paper

    17/20

    Figure 4.2. PSPICE Simulated Graph of the Output for the Rectifier Circuit

  • 8/2/2019 Project2 Final Paper

    18/20

    5. Costs

    Parts:

    Jameco Ultrasonic Sensors (4 pairs) $ 24.00

    Motorola HC12 Microprocessor $ 25.0010 kilo Ohm resistors (12) $ 0.60 National Semiconductor Analog/Digital Converter $Red LED (8) $ 1.20Yellow LED (4) $ 0.60Green LED (4) $ 0.603 to 8 Decoder (4) $ 2.40Inverters (4) $ 2.40

    Total $62.30

    Labor:

    2* ($ 40/hour * 2.5 * 300 hours) = $60,000

    Project Total: $60,062.30

  • 8/2/2019 Project2 Final Paper

    19/20

    6. Conclusion

    The automobile collision detection system is a useful device in today's society. It helps the driver to beaware of the environment surrounding them. Although there were implementation problems, the designwas successfully. Through simulations, it was predicted that the project would be functional in anyenvironment. With a successful design and implementation, the driver would be able to detect multipleobstacles in multiple areas.

    The system logic subproject was implemented successfully. The Motorola 68HC12 microcontroller wasable to communicate accurately with the ultrasonic sensor output and the user LED interface. Thusmaking it possible for the driver to have a safer trip. The sensor area implementation encountered somedifficulties. The main obstacle within the subproject was the analog/digital conversion. This problemcould have been solved with a full-wave rectifier and low-pass filter. This would eliminate anyirregularities with the analog/digital conversion, thus making the project successful. Despite these,irregularities the project as a whole was functional.

    For real world implementation, the project would need to take into account different situations. At thedeadline, the project was able to detect obstacles while stationary. Real world implementation would

    include movement factors such as velocity, wind, and weather conditions. Other additions to the projectcould include a force feedback system that would incorporate steering and breaking controls. Anotherpossible addition would be monitoring the actual distance from the object in addition to have thedesignated sensor areas. The possibilities of this project depend on the wants of the user. This projectprovided the basic awareness components for the user and other options could easily be adapted.Therefore making the project open to expansion or adequate as a stand-alone device.

  • 8/2/2019 Project2 Final Paper

    20/20

    Appendix 1. References

    Jameco Electronics, Jameco Part Number 139491,

    http://www.jameco.com/Jameco/Products/ProdDS/139491.PDF.

    National Semiconductor, ADC0808 8-bit uP Compatible A/D Converters with 8-Channel Multiplexer,October, 1999, and http://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdf.

    http://www.jameco.com/Jameco/Products/ProdDS/139491.PDFhttp://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdfhttp://www.jameco.com/Jameco/Products/ProdDS/139491.PDFhttp://www.national.com/ads-cgi/viewer.pl/ds/AD/ADC0808.pdf