

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















by Alan Bull and Ta-Mao Hwang ECE 345 – Senior Deign TA: Shao Hsia 5/1/ Project #
The purpose of this paper is to present the design process used in making a vehicle collision avoidance system. We will give design details and show a step-by-step procedure of how the final product was designed, produced and tested. The project’s main goal is to alert a driver when his or her vehicle comes too close to another object or when the object is approaching at a high rate of speed. An LCD display shows the distance between the vehicle and the foreign object. The project has the ability to modify distance calculations based on the ambient temperature. Many of the challenges that arose while working on this project will be discussed, as will the specifics of the Basic Stamp II microcontroller, our circuit design, and the ultrasonic sensors used. ii
1.1 Functionality and block diagram Figure 1.1 shows the block diagram of the vehicle collision avoidance system and the following is a brief description of the flow of this design. Figure 1.1 can be found at the end of the chapter.
Temp Velocity m s (equation 1.1). Speed could also vary based on humidity and other external factors; however they have a very limited effect on the speed, and since the BSII doesn’t make floating point calculations (it is only able to do integer math), these would not change the calculated speed of sound. The distance from the sensor to the object is the most important variable, and is what our project was designed to ascertain. The range at which we were able to get reasonable results was 7cm-250cm. The time it takes the BSII to calculate and display data was very minimal and had no effect on our calculated distance and resolution. The object’s ability to reflect sound was noticed when we tested various objects and in one case got differing results. We found that our project worked best with metal objects, that plastic and wood objects were very close to metal, and that accuracy was worst with human beings. 1.3 Major Design Components There are four major design components used in this project. They are the sensors, the circuits, the BSII microcontroller, and the user interface. The user interface consists of an LCD display and an audio warning. There are five different circuits used, the voltage regulation circuit, the temperature sensor circuit, the 40kHz oscillator circuit, the transmitter circuit, and the receiver circuit. MuRata Electronics donated the sensors for this project. They are the MA40B8R/S. A data sheet about the sensors can be found at http://www.murata.com/murata/weblibrary.nsf/pdf/c18/$file/ma40.pdf. The BSII was the last major component of the project that we had to develop. It was simply a matter of writing code to
make sure it did what we wanted it to. Information about the BSII can be found at http://www.parallaxinc.com/. BASIC Stamp II Microcontroller Transmitter Amplifier Receiver Signal Conditioning Ultrasonic Transmit Ultrasonic Receive Ultrasonic Transmit Ultrasonic Receive Receiver Signal Conditioning 40kHz Oscillator Front Rear Operation Mode Inputs 2x16 LCD Display Output Speaker Output A/D Temp Sensor Figure 1.1. Block Diagram of Vehicle Collision Avoidance System
We decided to use the BSII microcontroller for one main reason, its ease of use. Although the Motorola HC12 has a lot more capabilities, we felt that we could do everything we needed with the BSII and saw no reason to add another level of complexity to our project. The BSII controls all the logical operations of our design as well as the user interface. Figure 2.2 shows the operation flow of the BSII. This figure can be found at the end of the chapter. The following is a brief description of this flowchart.
Figure 2.1. Sensors (left are JameCo sensors, right are MuRata sensors)
3.1 Sensors The sensors are fairly easy to use. The only requirement is that the transmitter must receive a 40kHz signal in order to transmit. Although slight variations in frequency are allowed, they can degrade sensor performance. The datasheet (http://www.murata.com/murata/weblibrary.nsf/pdf/ c18/$file/ma40.pdf) specifies that the signal can have a maximum peak-to-peak voltage of 40V. 3.2 Oscillator The 40kHz oscillator consists of a LM555 timer IC and the necessary resistors and capacitors. The circuit used is suggested by National Semiconductors in the LM555 datasheet at http://www.national.com/ds/LM/LM555.pdf. The LM555 is configured for stable operation in our implementation, which means it will send out a continuous oscillation. According to page 8 of the datasheet, the resistor and capacitor values can be calculated for a certain frequency. The equation is R R C f ( a (^2) b )*
output of the transducer is essentially a 40kHz sine wave with maximum amplitudes of up to 300mV. This AC signal is amplified by the op-amp with a gain of 101. Thus the output of the amplifier circuit will be a sine wave centered at 2.5V. The output of the amplifier was connected to the positive input of the comparator, a LM393. The LM393 is chosen because it is capable of outputting TTL compatible signals. The operation of the comparator is similar to that of the one described in the transmitter circuit. The difference is that instead of acting as an amplifier, the comparator will generate a TTL compatible signal capable of being read by the BSII. The circuit and waveforms are shown in Appendix I figures A1.4, A1.5, and A1.6. 3.5 Voltage There are three key voltages generated in this design. The first is a +5V used to power logic devices. This voltage is generated using a voltage regulator, the MC7805, which takes in the 12V supply voltage and regulates it to 5V. Two reference voltages are generated from the 5V. The first is a 2.5V reference voltage generated simply by using a voltage divider. This voltage is used in the transmitter and receiver circuits described above. The second reference voltage is the decay reference used by the comparator in the receiver circuit. The purpose of the decay reference is to eliminate the cross- talk effect between the sensor pairs. The receiver might inadvertently pickup pulses directly from the transmitter instead of detecting an echo when the transmitter is sending pulses. Therefore when the transmitter sends a pulse the pulse voltage also charges the capacitor in the decay voltage circuit, which raises the voltage output of the reference much higher than 2.5V. Once the pulse ends the output will slowly decay to 2.5V as the capacitor discharges. By raising the reference voltage to the comparator we can in effect blank out the receive signals for a short period of time. Comparing figures A1.5 and A1.8 shows the blanking effect. In this design the blanking signal lasts for about 2ms before decaying down to 2.5V. This corresponds to the time of flight of about 7cm, which is our minimum range. The circuits for generating these voltages are shown in Appendix I figure A1.7. The decay voltage is shown in A1.8. 3.6 Temperature Sensor Circuit The temperature circuit consists mainly of a LM335 temperature sensor and an ADC0831 A/D converter. The LM335 temperature sensor is capable of detecting temperature in the –40C to +100C range. It is essentially a zener diode with a breakdown voltage that corresponds to the temperature in degrees Kelvin. Thus a voltage of 3.00V means the temperature is at 300K, or 27C. According to the datasheet (http://www.national.com/ds/LM/LM135.pdf) the temperature sensor is accurate to about 1C without any adjustments and has 10mV voltage increments. The voltage output from the temperature sensor is fed into the analog input of the A/D converter. The ADC0831 is an 8-bit serial converter. Thus it is capable of 256 resolutions. The voltage resolution can be determined by setting the reference voltages. For example setting the references at +5V and ground will result in a resolution of (5-0)/256 = 0.195mV. Since the maximum temperature sensor output is around 3.73V, the upper reference voltage is set to 3.73V with a potentiometer. This gives a resolution of about 15mV.
the A/D clock pin is used to shift in the 8-bit binary value. Once the 8-bit value is obtained it needs to be converted since the value is relative to the A/D references. The temperature in degrees Kelvin can be obtained by: 256 (max) * ADCvalue T (^) k V (^) ref (equation 3.2) The ShowTemp subroutine merely converts the temperature into degrees Celcius by subtracting 273 and takes into account negative temperatures. Then it displays the temperature on the LCD. The Ping subroutine is responsible for commanding the transmitter circuit to send out a series of pulses. The PULSOUT command allows about 16 oscillations from the oscillator circuit to enter the transmitter circuit. A RCTIME command is issued immediately after the pulse is sent. RCTIME measures the amount of time it takes for the receive echo pin to change state from 0 to
4.1 Sensor Verification To verify that our sensors were working correctly, we hooked the transmitter up to a function generator and the receiver to an oscilloscope to be sure that we were sending and receiving signals. The MuRata parts worked with out difficulty, although there was a little crosstalk between the pair of devices. The JameCo parts did not work as well, as there was a lot of crosstalk, and objects were hard to pick-up. Both products gave us voltages in the range of 50- 250mV. For this reason, we decided to use time-of-flight (TOF) instead of voltage to determine the distance of objects. To measure the TOF we had to use the BSII, so we were unable to test this part of the sensors without the BSII. 4.2 Circuit Verification We tested each of the five circuits separately to verify that they were working correctly before we hooked them together. For the amplifier circuits in the transmitter and receiver, we hooked the input up to a constant voltage and then hooked the output up to an oscilloscope. With the transmitter circuit, we verified that we were sending out a 20-V peak-peak signal so that we would receive a strong echo. This was amplified from the 5 V peak-peak that we were inputting. Please see figure A1.2 in appendix 1. The receiver circuit was tested in the same manner to be sure that we were sending out a 5 V square wave that could be used by the BSII. Please see figure A1.5 in appendix 1. To test our voltage regulation circuits, we used a very similar process. With the reference voltage that was used for the transmitter circuit, we made sure that the circuit was outputting a constant 2.5 V signal that could be used by the comparator. The reference voltage that was used for the receiver circuit needed to be a decaying reference voltage so that it would help to eliminate crosstalk. This was discussed previously in section five of the design details chapter. Also, figure A1.7 found in appendix 1 shows the decaying reference voltage. For verification of our temperature sensor circuit, we needed to hook it up to the BSII so we could tell if it was outputting the correct temperature. The temperature sensor was discussed in section six of the design details chapter. The temperature sensor was surprisingly accurate and responded to temperature changes very quickly. To test our oscillator circuit we hooked it up to an oscilloscope to be sure that it was generating a pulse at 40kHz. 4.3 Entire Project Verification To verify that our design was working as expected, we tested the overall project on a variety of different materials. Included below in table 4.1 and 4.2 are the data that we recorded for metal and plastic objects. When we tested our project on wood, we got very similar results to those listed below. The only tests in which we obtained different results were tests on humans. Because clothes sit at varying angles on a person’s body, they tend not to reflect the sound wave back to the receiver as well as with other objects. For this reason we were only about to get about one meter of range when we tested on humans.
5.1 Labor: 5.2 Parts and Supplies
The vehicle collision avoidance system is very useful in today’s society. It makes drivers more aware of their surroundings; therefore it will be easier for them to avoid collisions. With parking lots becoming more and more crowded and with more people driving larger vehicles that are hard to maneuver, a device like this becomes almost essential. The implementation for our product was very successful, with no real problems found. We were able to implement each of the four major subprojects without too much difficulty. Changing the offset a little more might allow us to get perfect distance readings, but being off only a couple of centimeters is not of much concern. If we were to produce this product commercially, we would use a more sophisticated microcontroller that would allow us to eliminate the rounding problems and would therefore make for near perfect distance readings. Also, we would have to find and use lower cost parts in order to make something like this feasible for a company to produce and to sell to a car manufacturer. For real world implementation of this device, a few things would need to be ironed out. The first problem is that we would need an array of sensors on both the front and the back of the vehicle, possibly on the corners of the bumpers for the product to be fully useful. It may also be advantageous to add sensors to the sides of the vehicle to allow for detection in those directions. We would also need to do testing with the higher velocities at which vehicles travel to be sure that the sensors could detect them. The final thing that could be considered for real world implementation is to add an automated response to the system. If the sensor saw that there would be a collision without an immediate response, it could apply the brakes for the user. This might be hard to implement, but it greatly increases safety in the vehicle, which could be a big selling point, especially to families with children.
Figure A1.3. Transmitter Circuit Output Figure A1.4. Receiver Circuit
Figure A1.5. Receiver Circuit Amplifier Output Figure A1.6. Receiver Circuit Comparator Output to BSII