Vehicular Source Localization - Project 35 Report | ECE 445, Study Guides, Projects, Research of Electrical and Electronics Engineering

Material Type: Project; Class: Senior Design Project Lab; Subject: Electrical and Computer Engr; University: University of Illinois - Urbana-Champaign; Term: Spring 2004;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 03/16/2009

koofers-user-edz
koofers-user-edz 🇺🇸

4.5

(1)

10 documents

1 / 36

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Vehicular Source
Localization
By
Jason Ching
Clayton Chan
Michael Mar
SENIOR DESIGN PROJECT
University Of Illinois at Urbana Champaign
Department of Electrical and Computer Engineering
FALL 2004
TA: Mark Wiegert
April 29th, 2004
Project No. 35
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download Vehicular Source Localization - Project 35 Report | ECE 445 and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

Vehicular Source

Localization

By Jason Ching Clayton Chan Michael Mar SENIOR DESIGN PROJECT University Of Illinois at Urbana Champaign Department of Electrical and Computer Engineering FALL 2004 TA: Mark Wiegert April 29th, 2004 Project No. 35

Abstract

This following paper describes the complete system with documentation, graphs and charts of the design and implementation of a Vehicular Sound Localization System. The system will be able to distinguish where the sound is coming from and move accordingly towards the sound signal. It was also implemented with an object detection system to enhance its robustness. The sound localization system consisted of a two 3.5mm stereo jack microphones that were fed into the TI-54X DSP board that would determine the location of the sound signal by calculating the delay in the fourier domain in real time by implementing FFT’s. The obstacle detection system was made up of several IR sensors placed around the perimeter of the car. All systems were fed into the BasicX microcontroller which than directed the car. In the end we were successful in our project, it was able to determine and move towards a sound signal with a maximum success rate at around 6 feet. ii

    1. INTRODUCTION....................................................................................................................
    • 1.1 Purpose and Motivation......................................................................................................
    • 1.2 Block Diagram....................................................................................................................
    • 1.3 Specifications......................................................................................................................
    1. DESIGN PROCEDURE...........................................................................................................
    • 2.1 Microphones Signal Amplification.....................................................................................
    • 2.2 Sound-Source Localization.................................................................................................
    • 2.3 Obstacle Detection System.................................................................................................
    • 2.4 Stepper Motor.....................................................................................................................
    • 2.5 BasicX Microcontroller......................................................................................................
    1. DESIGN DETAILS..................................................................................................................
    • 3.1 Microphones.......................................................................................................................
    • 3.2 Sound-Source Localization.................................................................................................
    • 3.3 Interface Between DSP Board and BasicX Microcontroller..............................................
    • 3.4 Obstacle Detection with Infrared Sensors..........................................................................
    • 3.5 BasicX Microcontroller......................................................................................................
    • 3.6 Stepper Motor.....................................................................................................................
    1. DESIGN VERIFICATION.....................................................................................................
    • 4.1 TDOA algorithm Simulation in MATLAB......................................................................
    • 4.2 TDOA Algorithm Testing and Verification.....................................................................
    • 4.3 Microphone Response......................................................................................................
    • 4.4 BasicX Testing..................................................................................................................
    • 4.5 Car Testing........................................................................................................................
    • 4.6 Total System Testing........................................................................................................
    1. COST......................................................................................................................................
    • 5.1 Parts..................................................................................................................................
    • 5.2 Labor.................................................................................................................................
    1. CONCLUSIONS....................................................................................................................
    • 6.1 Accomplishments.............................................................................................................
    • 6.2 Challenges.........................................................................................................................
    • 6.3 Future Work/Alternatives.................................................................................................
  • Appendix A: tdoa.m................................................................................................................ APPENDIX
  • Appendix B: tdoa.c.................................................................................................................
  • Appendix C: Basic Code for Obstacle Detection System......................................................
  • Appendix D: Basic Code for Proper Control of Car...............................................................
  • Appendix E: Wiring Diagram of Car......................................................................................
  • Appendix F: Basic Code for Stepper Motors.........................................................................
  • REFERENCES.......................................................................................................................

1. Introduction 1.1 Purpose and Motivation Our team consisted of engineers that were very familiar in a wide range of Electrical Engineering sub- disciplines. We found that it would be most beneficial to undertake a project that would utilize each group member’s engineering focus. Background’s consisted of Digital Signal Processing (DSP), Hardware Design, Sensors, Power and Control systems. We developed a project that was able to expose the group to their respective fields of interest: viz. vehicular sound localization. Our main goal would be to design and implement a system that would be able to distinguish where a sound source was originating from and progress towards that sound accordingly. This would involve a strong knowledge of algorithmic implementation using a digital signal processor. Also, hardware and circuit design were needed to construct microphones and implement control. With that said, there are many possible “real world” applications behind source-localization. For example, steering antennas in the direction of an incoming signal to maximize SNR and minimize interference. Source Localization has many applications for noise and interference cancellation within audio systems as well. Our project is unique in that source localization is being extended to vehicular control. This has a plethora of possibilities in terms of marketing; any where from an automated security systems to a child’s toy. 1.2 Block Diagram Figure 1.1 shows a very general layout of our proposed design. Figure 1.1. Finalized Block Diagram of System

  1. Microphones / Amplifier - a mechanical vibrating source, preferably from a speaker that will generate the signal the car should follow.
  2. Sound Detection System – a Texas Instruments (TI) 54X Digital Signal Processor will digitize the signals from two highly sensitive microphones and perform the necessary processing in order to determine where the sound originated from. This information is then relayed to the microprocessor.
  3. Obstacle Detection System – we plan to use a series of IR sensors placed on the perimeter of the car to alert it of any obstacles in its way. Sound-Source Localization (T1-54x DSP) Stepper Motor BasicX IR Sensors Microcontroller Bridge Rectifier Capacitor Filter Amplifier Demodulator

2. Design Procedure 2.1 Microphone Signal Amplification The purpose behind the amplification of the microphones will be to boost the sensitivity and increase the robustness of the system. Ideally, the signals the microphones output should have little noise as to not to interfere with the actual signal and thus a compromise between contrast and the actual signal must be decided upon in order to maximize robustness of the system. 2.2 Sound-Source Localization The purpose of the Sound Source Localization Component is to determine the direction from which a single acoustic source originated from. There are several methods of implementing such a system. Two specific methods were considered for our design. The first method considered was high-resolution direction finding as described in [1]. The second method considered (the method used in our final design) utilized the time delay of arrival (TDOA) algorithm as discussed in [1]. In general, the algorithm estimates the delay between two digitized sources. 2.3 Obstacle Detection System This system would consist of a series of IR sensors placed around the perimeter of the car. The basic principle behind the IR sensors uses the property of energy reflection of IR waves off of certain surfaces. The sensors consists will consist of an emitter that will emit IR energy and a detector that will receive any IR energy reflected back. The detector is modeled after a transistor except the gate voltage increases only when IR energy is detected, that is the transistor turns “on” when IR energy is detected and lets current flow through it. 2.4 Stepper Motor In order to move the car to the sound source, at least two stepper motors would be required in order to turn the two rear wheels of a car. Stepper motors provide accurate positional control for systems and are simple to control. In addition, stepper motors can be used for speed control. The parts shop actually made us a car that encompassed two stepper motors for the rear wheels. The parts shop also made us a ball pivot for the front of the car. All the logic to operate the motors effectively was already completed for the project, and the operation of the stepper motors was through a 6-pin pinout connection for each motor. 2.5 BasicX Microcontroller The BasicX microcontroller is a 24 pin programmable microcontroller that consists of 16 general logic I/ O pins, 8 of which can be used as a 10-bit analog to digital converter. The BasicX is able to communicate with the computer through a serial port which also uses it to download programs. It is capable of multi-tasking and floating point math. It is powered by a 5 V power supply across pins 21 (+) and 4 (-) and has a combined maximum current of 80 mA.

3. Design Details 3.1 Microphones The microphones were one of the key components of the sound localization system due to the fact that the sensitivity of the microphones would determine the robustness and responsiveness of the sound detection. This was because the input into the TI-54X had to be large enough for the DSP to be able to detect process the data accordingly without much interference. The microphones used in the system were standard 3.5mm jack microphones, similar to the ones used for computers. They are an electret type microphone-that is the microphone element senses mechanical vibrations as it hits it by inducing a change in voltage across two capacitative plates. This would mean that the plates had to be powered (charged) in order for them to work properly. The 3.5mm jacks consist of three bands corresponding to three different leads. The top conductive band (the tip) was the signal from the microphone. The middle conductive band was for the power and the last band located at the base of the jack was designated to be ground. The schematic diagram of the mount used for the PCB board is shown below in Figure 3.1 along with a picture of a 3.5mm jack and of the actual mount. Initial testing of the microphones showed that the microphones themselves were not able to give enough of a signal into the DSP as expected. Figure 3.1. Microphone Setup It was decided upon that National Semiconductors LM386 amplifier chip would be ideal for our system. The LM386 is a low-voltage power audio amplifier that uses only 5V so a battery can be used for power and is able to perform gains of 20 to 200. This corresponds to a dB gain of 26 dB and 46 dB respectively. Below in Figure 3.2 is the circuit diagram used in our circuit given by National Semiconductors for a gain of 200. Signal 5 V Groun d

From the estimated delay d , we can determine which microphone received the signal first and therefore which side (right or left) the source originated from. More specifically, if d is positive, microphone i received the signal before microphone k meaning the source is closer to microphone i. Likewise, if d is negative, microphone k is closer to the source. Figure 3.4. Example of sound path from a given sound source The TDOA algorithm, as mentioned earlier, essentially computes the estimated delay d. For the algorithm we will assume that the source is approximately WSS. With this assumption, the peak cross- correlation function will be maximized at n = d. To determine the cross-correlation function, we will process our data in 1024 sample-blocks. As seen in equation 4, is a simple Fourier based method of determining the cross-correlation of two signals (See Appendix A for a complete proof). As we will later discuss, our estimated delay d can be calculated using (^) d  , the value of n that maximizes our cross- correlation function. R (^) i k ( n ) I F F T (^)  M (^) i ( f ) M (^) k ( f )

  (^) (4) d^ ^ m a x R ( n ) n

Since the computation of the cross correlation utilizes FFTs, it will essentially be “circular” (analogous to circular convolution). In other words, the delay d is equal to (^) d  for samples in the range [1,512], otherwise (for the range [513, 1024]) d is equal to (^) d  - 1024. With the computed value (^) d  we can essentially decide on which direction to turn. One of the specifications for the sound localization component of this project was 360º of resolution. That is, the vehicle will be able to maneuver toward the source regardless of the angle it originated from. For that reason, we adjusted the car either left or right based on the value of (^) d  : LEFT if d ^  ( 5 1 2 , 1 0 2 3 ], RIGHT if d ^  [ 0 , 5 1 2 ]). We could have easily estimated an approximate angle that the sound arrived at using (^) d . However, this would limit the cars direction resolution to 180º. d e l a yx s i n (  ) (6)         ^         s i n ^ s i n .  1 1 x 4 4 1 1 03 d e l a y x d

As seen in equation 6, the delay (in seconds) experienced between each microphone is a function of the angle of arrival ^ and the spacing between the microphone x (meters). Solving for ^ we get the expression seen in equation 7. The delay can be computed from (^) d  through normalization of the sampling rate: 44.1 kHz. The inherent resolution of 180º can be clearly seen if considering the case where the sound source is directly behind the vehicle. In this case, the angle of arrival would be 180º which yields the same value of ^ for an angle of 0º. This clearly yields a conflict since the vehicle would be traveling in the complete opposite direction of the source. Of course, this direction ambiguity Speaker

R

L

Front

of 180º can be neatly resolved by adding additional microphone elements at the front and rear of the vehicle. Figure 3.5. Sound Arriving From Either Left or Right Gives Vehicle 360of Resolution However, due to the limited amount of input channels on the DSP board as well as time constraints, we chose a different approach: viz. rotating either left or right by fixed amounts and adjusting as the car progressed. As seen in figure 1, through multiple acquisition periods and the adjusting the direction of the vehicle (rotating it), the vehicle will ultimately end up at the source location. 3.3 Interface Between DSP Board and BasicX Microcontroller One of the main concerns in our design was the difficulty of relaying information from the DSP board to the BasicX Microcontroller. Without digital IO pins on the DSP board, there were only two possibilities to consider for interfacing: via serial port and via analog output channel. After little success with serial port communication (as digital communication would be preferable), we decided to use one of the 6 AC coupled output channels on the DSP board. Each output is AC coupled, meaning that signals, at the A/D converter, are offset such that the signal has no DC component. Therefore, we could not simply synthesize a DC signal, namely 0V or 5V DC, to send to a digital IO pin on the BasicX. Instead, we used a modulation technique, when synthesizing an output symbol at the DSP. Modulation – Amplitude Shift Keying, a simple yet effective digital modulation scheme, was implemented on the DSP end. We basically want to relay three symbols over to the BasicX: Right, Left, or Stop. This can be achieved by sending the signal represented in Equation 6. m ( t )  A (^) m s i n (  t ) (5) The amplitude A^ m takes on different values for each message symbol (in this case, three symbols for left, right and stop). Like any other digital modulation scheme, symbols can be represented with a constellation as depicted in Figure 3.6. Figure 3.6. Signal Constellation of ASK scheme Demodulation – At the BasicX End, we want to receive a DC value proportional to the amplitude of the modulated signal synthesized by the DSP board. To accomplish this, we simply use a rectifier-filter combo to extract a DC voltage from the incoming sinusoid. 3.4 Obstacle Detection with Infrared Sensors

obstructing the car’s path to the sound source. If an obstruction does exist, the car first moves backwards; mainly to allow clearance of the given obstacle. Then the car rotates 90 clockwise and moves forward for approximately 1 second. The whole process is repeated after clearing the obstacle (the controller is reset back to its start state). However, by rotating 90clockwise, the car may progress into an obstacle on its left side. Therefore, the side sensors were positioned along the left side of the car. Therefore, the car would move forward if these side sensors were activated. Once the processor concludes that no obstacle is obstructing the car’s path (whether it be in the front, or on the side), it then determines the direction from which the sound originated from. Basically, if the sound exists to the left of the car, the right motor moves forward to, essentially, rotate the car counter- clockwise. Likewise, if the sound exists to the right of the car, the left motor moves forward to rotate the car clockwise. After rotating, the car then progresses in that direction for approximately 1s. The basic code used to make the car operate properly is shown in Appendix D. Figure 3.8. Flow Chart of Microprocessor 3.6 Stepper Motor no yes Obstacl e Detecte d Rotate Left Direction Acquisiti on Signal Detecte d Move Forward Rotate Right Move Forward

STOP

Side Sensors Activate d Front Sensors Activate d no yes yes no Car Moves Backwar ds Car Turns Right 90 Car Moves Forward

The parts shop made the car that was used to move to the sound source. A block diagram of the car is shown below in Figure 3.9. The exact dimensions of the car are 10.5 inches in width and 9 inches in length. Figure 3.9. Block Diagram of Car Basically, the car was operated using two ten-volt cadium batteries. Two stepper motors were used to move the car, where one stepper motor operated one of the rear wheels. The wiring diagram of the car is shown in Appendix E. A six-pin output was used to operate each stepper motor. Essentially, there was a pin for ground, a pin for direction, and four pins for the PWM speed. A diagram of this output is shown below in Figure 3.9. Figure 3.10. Pinout Diagram for Stepper Motors

4. Testing and Design Verification 4.1 TDOA algorithm Simulation in MATLAB Before actual implantation of the TDOA algorithm, we used simulations in MATLAB to verify its correct operation. As seen in figure 4.1, two 1024-sample blocks (one being slightly delayed) of a sample audio file were cross-correlated in Fourier Domain as seen in equation 4. In the case of our simulation, the block sample of the right microphone was delayed by 200 samples from that of the left microphone’s block sample. Figure 4.1. MATLAB Simulation of TDOA 4.2 TDOA Algorithm Testing and Verification The first method used to verify the correct operation of our sound-source localization component (DSP subproject) of our design was through displaying various analog signals, using the oscilloscope, through the 6 DSP output channels. These signals included: 1) the cross correlation function, 2) a pulse at the index (in our 1024 block) that maximized the cross correlation function, 3) An impulse at index 0 for the scope to trigger of off. Figure 4.2. Cross Correlation Function of the Two Microphone Inputs in the Presence of a WGN Source Figure 4.2 illustrates the cross correlation (top waveform) of our two microphone elements with a sound source originating from the left (the bottom waveform is a pulse for the o-scope to trigger off of).

Figure 4.3. Pulse at Index that Maximizes the Cross Correlation Function Figure 4.3 illustrates the “pulse at max index” signal for the same input signals as the output seen in Figure 4.2. These two output waveforms, along with our MATLAB simulation, confirm the correct operation of our DSP implemented TDOA algorithm. 4.3 Microphone Response Initial test results obtained from recording the output from the microphone during a playback of the song “The Seed” by the Roots at various distances from the microphone in to the computers voice recording program and measuring the signal energy by Matlab is shown below in the plot of Figure 4.4. Power Output from Unamplified Microphone as a function of Distance

  • 0 100 200 300 400 500 600 0 2 4 6 8 10 12 Distance (feet) Power (mW) Figure 4.4. Power Output from Unamplified Microphone Initial tests of the amplifier circuit proved to be very promising. Current output from the supply was rated at 20mA at 5V. The test procedure for the amplification circuit was the same as the un-amplified signal. The plot of the power output from an amplified microphone is shown below in Figure 4.5.

As one can see from the frequency response, the peak range of performance by the circuit is in the kHz range of 10 kHz to 22 kHz. The frequency response exemplifies the notion of frequency distortion outputted from the microphones of the amplifier circuit. One of the biggest problems that were faced in the implementation of the microphones was the interference response that was seen when two amplification circuits were hooked up to the same bus. This wiring where the two circuits shared the power bus drew about 50mA for a 5V potential. This interference would cause a response in one microphone when the other was responding to mechanical vibrations, thus putting this circuit in the DSP would only result in an undistinguishable delay. This was the result of the mechanisms of operation of the electret type microphones. As one microphone would respond to a signal it would draw more current, this current was not restricted to enter the other microphone as well and thus caused both microphones to respond. The simple solution was to separate the two amplification circuits from each other with two battery supplies. 4.4 BasicX Testing In order to test the Basic X microcontroller, two tests were performed. The most effective testing method involved hooking up the serial port with the computer and microcontroller. Then by typing in the command debug.print “ command ” we were allowed to output different lines to the monitor to verify the code was working properly. For example, if the sound was to the left of the car, outputted onto the screen would be “Car turns left”. This would help us verify proper recognition of sound location and proper controlling of the car. Use of these commands can be seen in the code of Appendices C, D, & F. Another way to test the microcontroller was by using the LEDs on the microcontroller themselves. When testing the car on the ground, the serial port could not be hooked up anymore to the computer. Therefore, the LEDs helped verify that the code to control the car was working properly. The green LED signified a right turn, the red LED signified a left turn, and both LEDs signified an obstacle in the car’s path. 4.5 Car Testing In order to test the car, we first applied either 5 V or Ground to each of the pins of the stepper motor. Basically, if the higher bit of the PWM speed is Hi, the faster the car would operate. Also, in order to make the wheel move forward, the direction pin should be Hi. In order to make the wheel move backwards, the direction pin should be Lo. Therefore, the best way to operate the car was by making each pin of the motor either Hi or Lo directly using the Basic X microcontroller so that the car moves according to the given situation. Another testing aspect to take into consideration was the speed to operate the car at. Since the DSP board, microphones, batteries, and protoboard were all going to be taped to the top of the car, all of this weight was going to affect its speed as well. Therefore, data was obtained to see how much time it took to make a 90 right turn. Table 4.1 below lists all this data. Table 4.1. Data to Determine Proper Speed of the Car PWM Speed Time (sec) Bit 3 Bit 2 Bit 1 Bit 0 0 0 0 1 8. 0 0 1 0 5. 0 0 1 1 3. 0 1 0 0 1. 0 1 1 0 0.

Since there were sixteen input/output pins available to use on the microcontroller, only two of the speed bits could be varied for each of the motors, while the other 2 would remain at Ground. Therefore, from the data obtained, it seemed to be best to vary bits 2 and 1. At this speed, the car could move at a decent pace with all the added weight to the car. In addition, if we put the highest bit (bit 3) on Hi ever, the car seemed to move too fast and gave us unstable results. 4.6 Total System Testing The completed project was also tested for its ability to correctly determine where the sound was coming from. This was done by recording the number of correct distinctions about the sound localization at various distances from the sound source. This was conducted with 50 trials for each specified distance to obtain a statistical representation of the cars overall performance. Statiscal Distribution of Sound Detection System 0 20 40 60 80 100 120 1 2 3 4 5 6 7 8 9 10 Distance (Feet) Probability of Success (%) Correct Detection Figure 4.7. Statistical Distribution of Sound Detection System