Max Detection Module



[pic]TABLE OF CONTENTS

Introduction 3

Requirements 6

Design 8

Microphones 8

Amplifier Module 8

Filter Module 9

Analog to Digital Converter Module 11

Threshold Module 11

Correlator Module 12

Correlator Threshold 14

Aiming Algorithm Module 15

Accumulator Module 16

Mover Module 17

Stepper Motor Control Module 17

Tradeoff of the Design 18

Critical Design Parameters 19

Analysis 21

Simulation 23

Parts 26

Test Cases 27

Design Issues 29

Preliminary Reviewer Comments 31

Final Reviewer Comments 34

Changes In Design 36

Meeting Requirements 37

Performance Data 38

References 39

Appendix A 40

Appendix B 41

Appendix C 42

Introduction

We are building a system to locate the source of a sound relative to a stationary platform. The system will drive a stepper motor to aim an arm towards the source. The platform is versatile in that its application changes by what is attached to the arm. A camera could be used for a security application or video conferencing. A light could be attached for use in conferences or theatre applications.

[pic]

Figure 1. Final Product Packaging.

This product is a small box that has a mounting platform on the top. Connected to this platform are two microphones that pivot with the aiming device (See Figure 1). The product is designed to fit in a small one-foot by one-foot area. It is important that it is this size so it can fit in confined areas like conference rooms or mounted on the ceiling in the corner of a room.

Our design involves many different modules which are broken up into stages (See Figure 2). Each stage will be described briefly below and in great detail in the design section.

[pic]Figure 2. Diagram of Stages.

Stage 1

This stage is responsible for getting analog input signals from the outside world. Then, it will process these signals, including amplifying and filtering them. Finally, it will convert the analog signals to digital information that is useful and understandable for the next stage of the system. Stage 1 includes the following main components:

Microphones

We are using two microphones for this system. The microphones will take the sound signals as a waveform from the outside world and then convert these signals into the analog electrical form.

Amplifiers

The amplifiers will increase the amplitude of the input signals without distorting their original frequency. The purpose of the amplifier in our system is to match the output voltages of the microphones to line level.

Filters

The sound targeting system is intended to track human speech signals. Therefore, we need a filter to eliminate all signals outside this range from the environment. We will attempt to capture all human speech frequencies in the range from 200 Hz to 4KHz.

Analog to Digital Converter (ADC)

The ADC will convert the purified analog signals into 20-bit digital signals.

Stage 2

This stage will locate the sources of audio signals. It does so by correlating digital audio signals. This stage then will hand off this information to stage three.

Threshold

A threshold will be responsible for converting the 20-bit signal from the ADC into a 2-bit signal that the correlator will use. From the simulations we ran, we found that using a two-bit signal allows the correlator to output arrays that have peaks in areas we know the source to be.

Correlator

The correlator is responsible for taking the two microphone inputs and attempting to calculate the difference in time that a signal arrived at one microphone verses the other microphone. This output will allow the aiming algorithm to make good guesses at where to aim the arm at the sound source.

Correlator Threshold

The correlator will output weak signals as well as strong ones. We are only interested in aiming at strong signals so the threshold will filter out the weak signals and the signals that are less than zero.

Stage 3

This stage will scan the correlation array and make a good judgment on where to aim the stepper motor arm.

Aiming Algorithm

The aiming module is responsible for scanning a correlation array and outputting the maximum of the inputs within the threshold requirement. Based on a scan of the correlation array, the aiming module will decide if a sufficiently large maximum was found and if so, it will output the index of that max to the accumulator.

Accumulator Unit

An accumulator module is needed to take a large sample of aim outputs to be as informed as possible to where the sound source is before it drives the stepper motor. Since the output from the aiming algorithm is only based on one result from the correlator, the output does not always indicate the correct area to aim the motor at. Therefore, an average over a wider range of output signals helps eliminate incorrect movements made by the arm. This module outputs a direction and number of steps to the stepper motor controller.

Stepper Motor Controller

This module takes a direction and a step signal as inputs and drives a bipolar stepper motor one 1.8 degree step to the right or left based on that input.

Requirements

Microphones

• Microphones must have a pickup pattern of cardioid, half omni, or full omni-directional. Since the arm will be aiming in a 90-degree arc, the microphones need to pickup noises that are in the 180-degree area to the front of the platform.

• Both microphones must be matched in frequency response, and the response band should be larger than 200Hz – 4kHz. This is the range that human voice is commonly found and that is what we are interested in picking up.

• Must be spaced at 30.2cm (11.88 inches) to match correlator size (max samples between microphones is 54 samples at 11.88 inches. See Figure 3).

[pic]

Figure 3. Calculation of Distance Between Microphones

Amplifier

• Must supply at least 53dB gain to be able to amplify microphones to match line level.

Filters

• Fourth order filters required to cut off frequencies out of band quickly to avoid ambiguous correlations.

• Must be band pass and cut off frequencies below 200Hz and above 4kHz.

• Need +/-12 volt power supply to run op amps.

Correlator

• Must be able to store 172 samples from one microphone and 118 samples from the other (See analysis section for details).

• 108 correlations must be completed in less than 20.8 microseconds (48 kHz).

Aiming Algorithm

• Algorithm must fit in available program memory space on the FPGA and must compute next location in less than 20 microseconds.

• Targeting of a continuous white noise source must be within 5 degrees of nadir.

Averaging Module

• Code size must be small enough to fit on FPGA with other modules.

Stepper Motor

• Must have 1.8 degree step or more accurate.

• Must be able to accept signal at 100 Hz (0.5 RPS)

Component Requirements

EDE1204 Bi-Polar Stepper Motor IC

Oscillator frequency 100 KHz - 4 MHz

Supply Voltage 3.0V - 6.25V

Max. current sunk by output pin 25mA

Max. current sourced by output pin 20mA

Operating temperature 0°C to +70°C

L392D Quadruple Half-H Driver

Logic supply voltage Vcc1 4.5V – 7.0V

Output supply voltage Vcc2 Vcc1 – 36.0V

High level input voltage VIH, Vcc1 < 7V 2.3V – Vcc1

High level input voltage VIH, Vcc1 > 7V 2.3V – 7V

Low-level input voltage, VIL 0.0V - 1.5 V

Operating free-air temperature 0°C to +70°C

XSV-300

Supply Voltage 9.0 V

Supply Current 25 mA

Oscillator Frequency 24 MHz

OPA27EZ Burr-Brown Op Amp

Low Supply Voltage -12.0V

High Supply Voltage 12.0V

Open Loop Gain 125dB

270-090C Condenser Microphone Element

Supply Voltage 1.0 - 10.0V

Nominal Supply 4.5V

Current Drain 0.3mA

Signal to Noise Ratio 60dB

Sensitivity -64+/-2 dB

Output Impedance 1kOhm

Weight 1.3 grams

Design

Microphones

We will be using small cartridge microphones that weight about 1.3 grams. It is important that they have a low weight because the step motor has a torque rating of 2000 g/cm. The microphone is responsible for converting analog wave signals from the outside world into analog electrical signal that can be used in our circuit (See requirements section for details). The pickup pattern will be omni-directional. A problem with omni-directional is that they will pickup sound to the rear as well as the front. To combat this, we will only be moving the platform arm in a 90-degree arc and we will have sound insulating padding around the back of the platform. This will focus the area that these microphones respond to the front side of the platform and not the rear.

Mount positions for the microphones is important for the accuracy of the correlation. We will be mounting the microphones directly on the spinning platform so as the motor is driven closer to the sound source, the source will get closer to the center line of the sound field (See Figure 4).

[pic]

Figure 4. Equipotential Lines (Differences in Distances) to Microphones.

The centerline is the only line that runs directly through the axis of the motor. It is impossible with two microphones to know the exact angle to the location of a sound that is not on this centerline at distances closer than 3 feet. Thus, the data coming into the system will be more accurate as the arm gets closer aiming at the source. The microphone gain does not vary with the angle to the sound source because the microphones are omni-directional.

Amplifier Module

This module will take the analog electrical signals from the output of the microphones. It will output an analog electrical signal with frequency the same as that of the input but with greater amplitude. It is important to tune both amplifiers together to the characteristics of the microphones. One microphone could be more sensitive than the other. It is imperative that we set the frequency response of the microphones to match each other so that they will output the same magnitude signal from a sound that was the same distance away. The design of the amplifier involves a few resistors and an op amp (See Figure 5).

[pic]Figure 5. Microphone Amplifier Circuit.

The gain of the circuit ranges from 20dB to 40dB based on the resistance selected by the potentiometer. We will adjust the value of resistance from the potentiometer get the total gain that we need which is approximately about 53dB. We must take into account that each filter has a 8.3 dB gain for a total of 16.6 dB gain from the filter. Combined, the total range of gain ranges from 36.6dB to 56.6dB. Each microphone’s frequency response magnitude will then match and we will get line level output.

Filter Module

The filter receives signals from the amplifier. These analog signals contain waveforms that have frequencies all over the spectrum. Since, we are only interested in human speech signals, this module needs to filter out all signals below 200Hz and above 4kHz. To do this we will use a band pass filter. This filter will consist of a 4th order low-pass filter and a 4th order high-pass filter. This will eliminate all frequencies that are over 4KHz and under 200 Hz.

We have chosen to design 4th order filters. The reason we choose this high order filter is because a higher order filter will reduce a significant amount of noise that could confuse the system. Large order filters have very sharp curves when the frequencies reach the cutoff value. We have also chosen to cascade the Equal-Component-Value, Sallen-Key, 2nd order filter as basic blocks for our filters.

[pic]Figure 6. 4nd Order, High Pass Filter Schematic.

[pic]Figure 7. 4nd Order, Low Pass Filter Schmatic.

It is very efficient to use Sallen-Key second order filters. First, it is easy and efficient to build the 4th order filter from 2nd order filters by chaining them together (See Figure 8). It is also easy to adjust the cutoff frequencies by changing the damping value. This means that we can adjust the frequencies we are filtering by tweaking a single resistor.

[pic]Figure 8. 4th Order Band Pass Filter

Connecting the 4th order low-pass filter to the 4th order high-pass filter will form the filter that we need. The resulting filter will function as a band-pass filter. We can adjust the bandwidth that we need by changing the damping value.

Analog to Digital Converter

We will be using the 4520A stereo codec present on the XSV-300 boards. We will use a 48 kHz sampling rate. The serial bit stream will be converted to a 20-bit number for each sample per channel. Each channel will have a shift register associated with it. One shift register will be 118 samples long; the other shift register will be 172 samples long. The shorter register will be referred to as the reference register, the longer will be referred to as the test register. One microphone will feed the test register; the other will feed the reference register. The difference in length between the two shift registers will be explained in the section on the correlator. To make the correlation simple, we will decimate to 2 bits per sample. This will greatly simplify the construction of the correlator.

Threshold

The threshold module will take the 20-bit signal from the ADC and convert it to a 2-bit signal we can hand off to the correlator. In simulation, we found that correlating on a 2-bit signal produced results that were more conclusive. This allowed the aiming algorithm to output correct results more often. Any signal from the ADC that is over the upper threshold number, which is 214, will be outputted as a 1. This number was derived from simulating our system in Matlab. All other signals will be outputted as 0 (See Figure 9 and 10). In hardware, this is done by a couple comparators that output 1, 0, or –1 depending on the input signal.

[pic]

Figure 9. Input to Threshold Module.

[pic]

Figure 10. Output from Threshold Module.

Correlator

A correlator’s function is to give a measure of the similarity of two signals. This is done by taking the sum of the products of each pairs of samples (See Figure 11 and Appendix B). This number is then an indication of the similarity of the two signals at that point.

[pic]

Figure 11. Correlator Diagram.

Since we will want to find the amount a signal is shifted between the two inputs, we will use a sliding window correlator. A sliding window correlator slides the reference signal along a larger window of the test signal and correlates at each location. From this, we can infer from the location highest correlation the amount the signal is shifted between two channels.

The complexity of the correlator is proportional to the width. The more samples used in the correlation, the more hardware needed to correlate them. However, with a sliding window correlator, the complexity of the correlation increases as the width of the window you are correlating against increases. To lower the time needed to do a sliding window correlator, one can implement several correlators and use each to do a sliding window correlation on different segments of the window, thus reducing the time needed linearly with respect to the number of correlators added.

For this project, we will use a sliding window correlator with a width of 64 samples, and a window size of 172 samples. This will give us 108 correlation results, with the center corresponding to sources equidistant from the two microphones (which is to say, directly in front of the platform). These numbers are derived from the fact that if our microphones are 1 foot apart, based on the speed of sound, they are 54 samples apart when sampled at 48 kHz. Thus we need to have a width of at least 54 samples, and a window size of at least 108 samples.

Our correlation function, represented by the ‘x’ in the diagram, will be:

X(a,b) = {3 if a == b, 1 if |a –b | = 1, 0 otherwise}

This function is designed to signal close correlation, and strongly signal exact correlation. This function is designed for 3 bits per sample. Two bits would require this function:

X(a,b) = {1 if a == b and a != 0, 0 otherwise}

This function and bit depth has the advantage that the X function will fit inside one Logic block, and the output is binary, making the adder smaller. The problem with this is it could be more susceptible to ambiguous correlation of a periodic sample.

An ambiguous correlation of a periodic sample is caused by the fact that a periodic sample will correlate against itself at several places equally. That is a periodic wave will match itself for any shifting of one period. We will minimize this problem by filtering out input before the A/DC to have a maximum frequency much lower than our sampling frequency. We will also filter the low end so that the lowest frequency can be correlated, avoiding the problem of a low frequency causing all samples of the signal to be in the positive range (hence giving very little to correlate at low bit depths).

Our sliding window correlator (See Appendix A) will be implemented using one fixed correlator attached to the output of the last 64 registers in the test shift-register and the output of the last 64 registers of the reference shift register. After we receive a new sample, we will start the correlation, and shift the test register, pushing the last item to the beginning, so that the correlator will run for all shift positions on the window. By just treating the test shift register as a circular shift register, the time to do a complete sliding window correlation of the input is just the time it takes to shift the entire register past the correlator. We need to have the shift register back to the correct position by the time the next sample comes in, so me must shift 172 times between samples. The correlator will be pipelined, but this pipeline only needs to be 4 stages, so the maximum time it takes to correlate the entire input is 176 clock cycles, well below the 400 available.

The output of the correlator will streamed to the aiming module to avoid use hundreds of flip flops to store the intermediate values.

Correlation Threshold Module

The input to this module comes from the correlator module. The input is in the form of one seven-bit bus. To allow this small of a bus, negative correlations will be set to zero and correlations of value 64 (incredibly rare) will be set to 63. This module also has feedback from the aiming module to adjust the level at which we threshold. We will be treating all negative numbers as zero. Thirty-two values will be the maximum number of encoded values that we will have so five bits will be sufficient to transport this information to the aiming module. The aiming module may not be as accurate if weak correlations are sent to it along with the strong signals. The purpose of this module is to filter out all the weak signals and set their values to zero and leave the strong signals alone.

The internals of this module (See Figure 12) consist of one 7-bit input line and a 5-bit output line. On each input line, a comparator module detects whether the 7-bit number is larger than the current threshold value. The threshold value will initially be set at 64 (50% signal strength) and it will get adjusted as the aimer finds maximums in the correlation data and sends feedback. If the input to the threshold module is larger than the threshold value, then the input value is put on the output. Otherwise, zero is put on the output line.

[pic]

Figure 12. Threshold Flowchart

Aiming Algorithm Module

The aiming module is responsible for deciding where the arm should aim based on a single pass by the correlator. Based on these values, the aiming module must make intelligent choices on where to rotate the motor. This module takes a five-bit input and outputs one signal of 7 bits, which index in the correlation array that was the max. This signal is the input to the accumulator.

Many situations need to be taken in to account when designing this very delicate module. The aiming algorithm is one of the most important modules to calibrate to produce an arm that positions correctly. Below we will describe all the situations that our aiming algorithm will attempt to resolve.

When two sound sources are emitting waves that reach the microphones at the same time, there is a dilemma in where to point the arm. We will choose to point the arm at the sound source that is closer to where we are currently aiming at. Each time the aiming module is handed a set of correlation data (See Figure 13), it will scan from left to right looking for the maximum value within the threshold range.

[pic]

Figure 13. Detection of Two Sufficiently Different Sources.

If a sufficiently large (larger than the threshold value) max value is found, the module outputs a new threshold value that is equal to the max value minus eight (See Figure 14). We also output the index of the max in the array to the accumulator at this time. We found eight to be a good value in our simulations. The purpose of outputting the threshold value back to the correlation threshold module is so the next time we do a scan through the correlation array, we will only be looking for signals that are close to the max signal we just got. This will help alleviate the algorithm trying to aim at echoes. If a maximum is not found during the scan, then the threshold value is decremented by one and sent back to the correlation threshold module to let lower value data through.

[pic]

Figure 14. Maximum Search Algorithm

Note that we must calculate each iteration of the aiming algorithm every clock cycle, as correlation data will be ready each cycle. Many of the operations needed to accomplish the aiming algorithm are calculated in parallel to keep the gate depth to a minimum to achieve this constraint.

Accumulator Module

The Accumulator will take in aiming data and will store it until a fixed number of aiming data sets are accumulated. This number will be set at 512 datasets which will take about 0.25 seconds (32 averages*512 accumulations/48kHz sampling rate). In simulation, we found that waiting for large amounts of aiming data greatly increased aiming accuracy. Only when the aimer sends this module valid data, will the dataset counter be incremented. Once it reaches 512, we will scan the accumulated data looking for the most occurring aim index. Once this max is found, we will calculate the number of steps to this index the motor must move. Then we will output this to the stepper motor module and the direction in which to turn it.

Mover Module

The inputs for the mover module are a direction, a number of steps, and a valid bit. Given this input, the mover module will tell the stepper motor to move a given distance. While the mover module is moving the motor, a move alert output will be set so the aiming algorithm knows to ignore input from the correlator. Once the mover has outputted the desired number of move signals to the stepper motor control module, then it will output a zero move alert signal to tell the aiming algorithm to start looking for a good spot to aim again. After the movement has stopped, the mover module must ignore all input from the aiming algorithm module for 180 samples. This data has been corrupted by the arm moving and must be ignored.

Stepper Motor Control Module

We will be using a stepper motor controller IC made by E-Lab, part EDE1204 (See Figure 15) and a stepper motor driver IC made by STM, part L293D (See Figure 16). The H-bridge L293D chip will be supplying the power to the motor while the stepper motor control EDE1204 chip will be controlling the timing of the power. For our purposes, the aiming algorithm module will supply a signal to the direction pin on the EDE1204. A high signal (5v) will mean rotate right (clockwise) and low (0v) will be rotate left (counter clockwise). Then a single high pulse will be sent to the step pin. This will cause the motor to step one step in the desired direction. The run pin will be set permanently to high to keep the chip in “step” mode. The free spin pin will be set high as well to inhibit the motor from free spinning. The half stepping pin will be set to low to allow for 1.8 degree steps. The a, b, and c pins will all be set low as they only affect the behavior when the chip is in “run” mode.

[pic]

Figure 15. Bi-polar Stepper Motor Control Chip.

[pic]

Figure 16. Bi-polar Stepper Motor Driver Chip.

Pin 1,2 EN and 3,4 EN are the enable drive pins and will be set to high (5v). The heat sink and ground pins will be attached to ground. The 1A, 2A, 3A, and 4A pins will be attached to the outputs for the coils of the stepper motor control IC, part EDE1204 (See Figure 17). The 1Y, 2Y, 3Y, and 4Y pins will be attached to the stepper motor itself. The driver pins 1Y, 2Y, 3Y, and 4Y will attach to stepper motor wires Red, Blue, Yellow, and White respectively (See Figure 18).

[pic]

Figure 17. Stepper Motor Control Circuit.

[pic]

Figure 18. Wiring for Bi-polar Stepper Motor.

Tradeoffs

Mounted Microphones Verses Moving On Axis

There are two ways to attach the microphones to the platform. The microphones can be stationary and mounted to the base or they can pivot with the arm. The advantage of mounting them to the base is having a more simple design. We don’t have to worry about shutting off the microphones and clearing the correlation buffer every time the motor is engaged. But the draw back to this approach is that when the correlator calculates the difference in sound times, it will not be accurate as the sound source is to the sides of the platform. Because of this fact alone, we will be attaching microphones to the rotating platform. While we now have to worry about flushing the correlator while the motor is engaged, the accuracy will increase as the platform gets closer to pointing at the sound source.

Choosing A Good Filter Range

It is important to balance a versatile sound range with a noise resistance. The wider the range we choose to use, the more sounds we can detect, but the more background noise we will pick up. We have chosen to use the 200Hz to 4kHz range. This will filter out low frequency sound waves in voice that confuse the correlator. We will also be filtering out high frequency noise by cutting it off at 4kHz. From experimentation, we found that this range will pick up on human voice well.

Complexity of Aiming Algorithm

The more complicated aiming algorithm we choose to create, the slower it will be to process and the more memory it will consume on the FPGA. We have chosen a fairly simple algorithm (described in the aiming algorithm module section) to conserve space and process quickly. The aiming algorithm must completely process in the time between outputs from the averaging module. This makes it imperative that it processes in under 80 microseconds.

Critical Design Parameters

Our design parameters will allow us to tweak how well our design performs. The following items are the discrete values that we will be able to change that will affect the performance. Some are based on physical constraints of our system, others are based on Matlab simulations and complexity constraints. Our choices of parameters are discussed in the analysis and simulation sections that follow.

Physics:

• Number of samples between microphones

• Sampling rate of ADC

• Band of band-pass filter

• Window size of correlator

Matlab

• Bit-depth of ADC

• Value of Correlator Threshold

• Value of Averaging Module Threshold

• Number of Averaged Correlations

• Width of Correlator

• Width of Correlator Window

Analysis

Physics Based Parameters and Their Implications

Here we will do some math to justify the choice of some parameters for our system.

Important constants:

dm = distance between microphones

sm = samples between microphones

f = sampling rate

cw = width of correlator

ws = window size of correlator

vs = speed of sound

We know that

sm = f * dm / vs

We have chosen dm = 1 to keep the microphones reasonable close together (and hence easy to turn), while still being large enough to give us the resolution we need. This claim is supported by the following:

if dm = 11.88 inches and f = 48kHz, then sm = 54 samples.

From this we know that we must have ws = sm * 2, since the maximum distance between sounds is 54 samples, on either side of center, so we need to be able to correlate on both sides of center.

We chose f so that ws (wm * 2) > 100, since our motor has has a range of 100 steps per half revolution, which is the range we are defining our system to work on (that is, 180 degrees).

From the section on the correlator, we know that we can do a complete run of the sliding window correlator in 180 clock cycles. If our FPGA is running at 24 MHz, and we are sampling at f = 48 kHz, we have 500 cycles to correlate in. We clearly have this timing constraint satisfied.

The next important consideration is the motor. By ignoring the correlation for 180 samples after a complete motor movement, we can guarantee that the motor noise will not interfere with the next correlation. If we only move the motor once we have a final destination, that means that we can move the motor all the way before paying attention to the correlation data again. A compete revolution of the motor is 200 steps, and it can revolve 60 times a second if necessary, so if we move the motor as fast as is possible according to our correlation, we will not move the motor faster than its spec.

Aiming Analysis

To deal with multiple sources of sound, out aiming algorithm will maintain tracking of the closest strong source. We have two ways of dealing with sudden loud noises that occur only once. If we start to track a sound than doesn’t last for more than a small fraction of a second, this value accumulator will small in the accumulator in comparison to where the real signal is coming from. Further, by being skeptical about the maximum distance a sound source can move, we can focus on one target, knowing that it will not move more than a certain angle between correlations. When we receive no strong correlations, we will lower the threshold value that we willing to track to. This will allow us to avoid tracking many types of noise, avoids the problems with periodic signals, and maintain a fix on a single source when there are multiple sources.

Simulation

We ran a complete simulation of the functionality of our design before we started building it (See Appendix C for code). All of the Matlab parameters mentioned in the Critical Design Parameters section were derived by trial and error in the simulation. The following are the results of the simulations and the conclusions that we derived from them.

Setup

The simulation was designed to test our correlation and aiming functionality. To do this, we used our completed stage1 module to sample real data that would be representative of what we would actually be correlating on. We recorded it as a wave file and fed it into Matlab and used it as an array.

Module Simulation

We started off by using a correlation function that used 128 sample wide correlator that used a mono sample that was time shifted. Each output was the average of four correlations. The output was then put through a threshold which zeroed out values between zero and 50. The following figure shows the output samples verses time.

Bit-depth of ADC 8 bits

Value of Correlator Threshold 50

Value of Averaging Module Threshold 50

Number of Averaged Correlations 4

Width of Correlator 128

Width of Correlator Window 64

[pic]

Figure 19. Initial Simulation Graph.

In this data, we could see where the source was coming from, but there was a series of additional peaks that made it hard to aim on. We increased the correlator window size to 128 bits and averaged the correlations two additional times. Also we ran it through two thresholds to filter out lower signals. The following figure was obtained by running the simulation with these values.

Bit-depth of ADC 2 bits

Value of Correlator Threshold 80

Value of Averaging Module Threshold 50

Number of Averaged Correlations 1

Width of Correlator 192

Width of Correlator Window 128

[pic]

Figure 20. Final Simulation.

From this simulation, we could definitely derive where the voice was coming from. When we fed this data into the aiming algorithm, it made guesses that were within about five degrees of the source. The most important parameter change was to change the bit depth of the ADC to 2 bits. The correlator does a much better job making binary decisions on square-wave inputs than on curves made by 8-bit numbers.

Parts

|Description |Part # |Source |Quantity |Price |

|Microphone |270-090C |Radio Shack |2 |$0.75 |

|Stepper Motor |42BYG228 |Jameco |1 |$14.95 |

|Stepper Motor Controller |EDE1204 |Jameco |1 |$8.95 |

|Stepper Motor Driver |L293D |Mouser |1 |$2.00 |

|Project Box | |Lab |1 | |

|Laser Pointer | |Lab |1 | |

|Soiderable Circuit Board | |Lab |1 | |

|Op-amp |OPA27EZ |Burr-Brown |10 | |

|Resistors |10 K Ω |Lab |18 | |

| |20 KΩ |Lab |4 | |

| |39 KΩ |Lab |4 | |

|Potentiometer | |Lab |10 | |

|Capacitors |0.01 uF |Lab |8 | |

| |0.006 uF |Lab |4 | |

|FPGA |XSV-300 |Xess |1 | |

|Power Supply |1200-CA1 |Interplex |1 | |

|4 MHz Oscillator |OSC4 |Jameco |1 |$1.89 |

Test Cases

Our system has three distinguishing stages and there are requirements on output data for each stage. Therefore, we plan to test each stage separately before we assemble them, making sure that each stage will give the output that we intend it to be.

State0 Tests

Before we built anything, we ran a simulation to test how our correlator and aiming algorithms performed. This gave us valuable insight on how to design the actual hardware.

Stage1 Tests

We tested all components of this stage such as the amplifier, filters, and ADC

manually. That is we will use the display to output of the components so

that we can observe the signals. These tests can be run by sending a wave from the function generator to the module and reading the output on the oscilloscope.

Stage2 Tests

We will store patterns of input signals in memory. Then run the correlator and use the analyzer to display and observe the output signals. We also can test this using Verilog to simulate this part of the system. The threshold and averaging unit use simple adders and comparators. We will test these parts manually by inputting various signals, then use the analyzer display and observe the output.

Stage3 Tests

The aiming algorithm can be tested using software. We will write a test program in Java to test the algorithm that we use by simulating input and seeing what the algorithm will output. The same algorithm in hardware will need to be tested as well, which can be done by inputting 7-bit numbers and seeing if the aiming module outputs a turn or hold signal.

The stepper motor controller can be tested manually by giving various 5 volt inputs and test to see if the motor turns in the correct direction.

Complete Project Tests

After the complete project is built, there are several test cases that we want to conduct to see if the platform functions correctly. First, we want to vary the environments that the platform is in. These environments include rooms with background noise, silent, background voices, and periodic waves. Also we need to input various types of sounds to the unit. These include voice, clapping, walking, low frequency, and high frequency. It will also be a good test to see what happens if there are two or more loud sound signals present. Short and long sounds will also need to be tested.

Design Issues

There are numerous problems that could occur when designing and testing this project. Many of these problems will have to be overcome during the testing phase of the project. These problems involve tweaking parameters such as thresholds, bit-depths, and searching algorithms. This section will outline the various problems we expect to encounter through the life of the project.

Preserving Validity

At many points in our design, signals must be ignored because they are not valid. Most modules will output a valid bit to tell the next module it is alright to use that data. It is very important that we propagate validity from the beginning of our pipeline to the end assuring that no module will use data that is invalid.

Timing Between Modules

It is important that every digital module run on the same clock. There may be issues when one module has data ready before another module is ready to use it. We may have to buffer or slow some modules down so data does not get lost.

Threshold Values

There are three threshold filters in our design. Each of these threshold modules has a cutoff value that we must set. It is very hard to know what to set this value at before we start testing. As we test each module, we will try to determine what a good value will be, but it will be hard to tune each module without the whole working system present.

ADC Bit-depth

A good size for the samples that the ADC converts will be hard to find. One bit samples will be easier to correlate but will not be very accurate. Depending on the performance, we may need to increase the bit-depth. Increasing the bit-depth in the middle of the design would require many changes to the subsequent modules.

Dependencies

Many of the parameters we can tweak in testing are dependent on other parameters. As we tweak one, we many need to tweak several others. This dependency will make it hard to isolate problems as they occur.

Ambient Noise

Background noise hits the microphones constantly from all sides. This adds signals that randomly correlate all over our samples. To combat this, we are running the samples through a threshold before the correlator.

Echoes

Sound that echoes off walls and items in the surrounding area will cause the correlator to find peaks in an area that is (90-CorrectAngle) * 2 degrees off (for a wall that is parallel to the microphones) from where we should be aiming. We found this to be true in our Matlab simulation. Luckily the echo signals are weaker than the peaks the aiming algorithm should be paying attention to, so the “minimum max” requirement of the aiming algorithm will do a good job of filtering these peaks out.

Stepper Motor Driver Chips

These chips are very sensitive and burn out easily. Extreme care must be taken when handling these chips and 5 decoupling capacitors must be used per chip to assure these chips stay in working order.

Preliminary Reviewer Comments

Overflow in Correlator Function

Reviewer Comments

According to the correlation function presented in the report, if input A is equal to input B, the correlator function will output three. Since the width of sliding window is 64, the correlator will sample 64 pairs of input at a time. If all of the 64 samples are equal, the output becomes 192, the product of 64 and 3. However, the output is a 6-bit bus, which is compatible for 64 only. So, overflow will happen and an 8-bit bus should be used. Overflow may cause serious problem in digital design and it should be carefully evaluated.

Response

This observation is based on an unclear portion of the explanation of the correlator. At the time the document was written, the exact bit depth of the correlator was not known. Thus the width of the output bus was not known. Now that we have run several Matlab simulations, we now know the depth we will use for correlation and thus, the required bus sizes.

Aiming algorithm

Reviewer Comments

We are concerned about the aiming to the source. The motor will move one step of 1.8 degree at a time either to right or left. If the source is far away, the 1.8-degree range will become significant. As shown in 19, since the source is not on the equipotential line of the STP, the aiming algorithm may cause the STP to move one step towards left. However, after moving one step left, the source is not on the equipotential line either, which may causes the STP moving right. If the happen, the STP may toggle left and right. The range X can be found by the following equation.

X = 2 * D * sin 0.9(

If the distance D is small, the toggling problem may not happen. But if in a large conference room, the toggling problem may have a significant effect.

[pic]

Figure 21: STP toggle problem.

To solve this problem, the aiming algorithm should be design carefully. To move the STP, instead of detecting whether the source is on the equipotential line or not, a test range should be applied. For example, if the different of the two values from the microphones is not large enough, do not move. Another possible way to solve this problem is to keep a history of movement. If the previous five movements are flipping left and right, the STP should stay until a new source appears.

Response

This issue is resolvable by designing the mover module such that it will refuse a request for a one-position step if the last movement was also a one step move. This has the unfortunate side effect that our arm may be off target by 2.7 degrees but we believe that this is based on a worst case scenario and our average will be closer to the projected 1.8 degrees.

Frequency of the Step Signal to the Stepper Motor IC

Reviewer Comments

We think that the frequency of the step signal to the stepper motor IC in the third stage may be too high. According to the data sheet for this IC (EDE 1204), the maximum frequency for the step input signal is 5 KHz. However, outputs that come of the averaging module in the second stage at 12.5 KHz ( = 50 KHz sample rate / 4 correlation results per average ) , which is higher than the maximum for the IC. This can cause the motor to move slower than expected, since the IC might not respond to inputs higher than 5 KHz.

Response

The initial design did not indicate how fast the motor would be driven. It is a very good point that the driver circuit must not be driven faster than 5kHz. To take this into account, we have designed a new module called the “Mover Module” which takes care of delaying each step signal to the Step Motor Driver Module. The motor will be driven at a rate of 100Hz, which is well below the acceptable rating.

Final Reviewer Comments

Two-Sound-Sources Problem

Reviewer Comments

In their final design report, group H claims that their STP can aim at the sources that is closest to the current position of the microphones if there are two sound sources that emit sound at the same time. After carefully examining their final design, we have concluded that their current design will not be able to differentiate the case of multiple sound sources from that of a single sound source. We call this a two-sound-source problem. The following figure illustrates the two-sound-sources problem.

[pic]

Figure 1: The two-sound-sources problem.

M1 and M2 are the microphones that are used in the project, while S1 and S2 are the sound sources that may happen simultaneously. If both sound sources emit signal at the same time, the signals from both sources will add up and be perceived by the microphones as one signal. In the figure above, signals D1 (from S1) and D2 (from S2) will add up and perceived by M1 as one signal (D1+D2). The same thing happens with signals D3 and D4. There is no way the microphone they are using can differentiate between the sound signal that originates from S1 and the one that comes from S2. Since the rest of the design depends on the output of the microphones, the entire design also will not be able to differentiate those signals.

Furthermore, the combined signal (D1+D2) that is obtained by combining D1 and D2 will depend on the phase shift between the two signals. Even though S1 and S2 are two identical sound sources that emit signal with exactly the same characteristic (same frequency, same amplitude, etc), the combined signal that is received by M1 and M2 may differ. This is because the relative distances of S1 and S2 to M1 and M2 are different, and the phase shift of one signal to another depends on the distance traveled by each signal.

Since M1 and M2 may now received different signals, correlating the sample data from M1 and M2 does not give much sense. The result of the correlation indicates how similar is one signal from another. The higher the result of the correlation, the more similar the two signals will be. Since in this case we may have two different signals, the correlation result may be low or high. If it is low, the threshold module will probably filter it out. If it is high, the threshold module will not be able to filter it, and therefore, the aiming algorithm will have a false source location to aim at.

Currently, we do not have any good solution to this problem. One simple thing is to assume that there is always be a single sound source. After talking with the group directly about this issue, they have decided that they will not handle this case due to the time constraint. They said, in theory, their STP will indeed choose the source that is closest to the current position of the microphone, but in practice, it is hard to get it right, and the design will become very complicated if they decide to handle it.

Response

Because of algorithmic changes in our final design, the new behavior of our design is to point somewhere in between the two sources. This is because both sources are generating correlation peaks corresponding to their location at different times. Our final algorithm simply averages all the correlation peaks and thus will point somewhere between the sources. We found that attempting to aim at a single source when two sources are present requires more computationally intensive algorithms than we have time to design and much more detailed history than the FPGA has memory for.

Changes In Design

Codec Threshold

Looking at the data on the logic analyzer on the correlations we found it more effective to threshold the audio data to one bit instead of two-bit. We now have defined “1” to be any positive number such that the one of the top four bits of the 20-bit codec output is “1”. The correlations were much clearer once the sampling was changed to one-bit.

Aiming Algorithm

We stripped the max finding decay out of our aiming algorithm leaving simply the max finder. We then followed this by an averaging unit that accumulated 64,000 maxes before making the choice on where to aim. We found that the decay was not robust enough to handle many of the cases. So by removing it and just averaging over a long time (64,000 correlations is 1.33 seconds) the aiming algorithm typically finds the angle to the source within 10 degrees.

The reason this works is the output of the correlator can be treated as a random variable centered around the angle to the sound source. The expected value of the average over 64,000 correlations is equivalent to the expected value for each output (by the central limit theorem).

Wire Placement and Arm Construction

During testing, we found that the stepper motor did not have enough torque to turn the Lego arms that were supporting the microphones. We swapped out the Legos for cardboard to find that the tension on the microphone wires was causing the stepper motor to skip steps when the wires were laid straight back from the platform. Ideally, the microphone wires would go through the center shaft of the motor to the circuitry that would be located inside the platform. But for our purposes, we attached the wires so that they protrude vertically from the platform to relieve tension when the motor turns.

Meeting Requirements

Because our stepper motor was underpowered, we could not use arms that were as long as we had desired. We had to remove an inch off of each side. The accuracy of our system is reduced by about 15% because of this. To compensate for this, the movement requests are multiplied by two so there is a net reduction of accuracy of 50% which only allows the arm to be accurate to 3.6 degrees.

Further, the variance of the correlation output is higher than expected. Once the arm is pointing at the source, it will fluctuate about the source. This induces undesirable errors while aimed correctly. Also, while not entirely unexpected, if a source appears part way through the averaging process, the arm will not swing all the way toward the first source. The distance completed toward the first source is proportional to the number of correlations received from that source. This causes lag when the arm is trying to track a moving object.

A current problem with our design is that the threshold is set at a relatively high level to avoid ambient noise in the lab. In theory, some type of adaptive threshold would be ideal but we did not have time to implement this. Thus our project requires the source to be loud conversational voice (greater than 65dB) at distances 5 feet or more.

Despite these problems, our platform was still able to aim accurately enough to focus a laser beam on a source within roughly ten degrees. Except the strength of the stepper motor, all of the individual requirements detailed in the requirement section were met.

Performance Data

Testing Accuracy

|Distance (ft) |Loudness |Time To Point (sec) |Accuracy (inches) |

|1.0 |Quiet Talking (60dB) |1.5 |2.0 |

|3.0 |Quiet Talking (65dB) |1.6 |2.0 |

|10.0 |Loud Talking (70dB) |3.0 |10.0 |

|20.0 |Shouting (80dB) |10.0 |12.0 |

Moving Sources

|Aiming Lag (ft) |Source Speed (ft/sec) |

|1.0 |1.0 |

|2.0 |3.0 |

|2.5 |5.0 |

Intensity to Activate

|Distance(ft) |Loudness |

|1.0 |60 dB |

|5.0 |65 dB |

|10.0 |70 dB |

|15.0 |75 dB |

|20.0 |80 dB |

References

Asahi Kasei Microsystems Company. “AK4520A – 100dB 20Bit Stereo ADC & DAC”. San Jose, CA. 2000.

Applied Motion Products. “Wiring Diagrams”. . Internet. April 2001.

E-lab Digital Enginnering, Inc. “EDE1204 Bi-Polar Stepper Motor IC”. Independence, MO. 1998.

Feico W. Dillema, Paul J.M. Havinga, Paul Sijben, Gerard J.M. Smit. “Audio Source Location For A Digital TV-Director.” University of Twente. The Netherlands.

Franco, Sergio. Design with Operational Amplifiers and Analog Integrated Circuits. McGraw-Hill. New York, New York. 1998.

Horn, Delton T. Basic Electronics Theory. McGraw-Hill. New York, New York. 1994.

Lancaster, Don. Active Filter Cookbook. Synergetics Press. 1996.

Lenharth, Brian. Private Correspondence. 2001.

Spread Spectrum Scene. “All About Correlators”. . Internet. April 2001.

Texas Instruments. “L293D Quadruple Half-H Driver”. Dallas, TX. 1990.

Xess Corporation. “XSV Board V1.0 Manual”. Apex, NC. 2000.

Appendix A – Sliding Window Correlator

[pic]

Appendix B - Correlator

[pic]

Appendix C – Matlab Simulation Code

%Main function

w = wavread('real.wav');

w = w * 128;

w = fix(w);

w = bithresh(w,40);

x = w(:,1);

y = w(:,2);

x = x(63000:65000);

y = y(63000:65000);

'about to corr'

'go'

t = ourtotalcor(x,y,64,54);

save 'Z:\cordata_t' t

%surf(t);

t2 = thresh(t,5);

t2 = avrg2(t2);

t2 = avrg2(t2);

t2 = thresh(t2,5);

surf(t2);

%avrg2 reduces the y component of the data by 2 by averaging.

function out = avrg2(data)

%avrg2 reduces the y compnent of the data by 2 by averaging.

for row = 1:length(data(:,1))/2,

out(row,:) = data(2*row-1,:) + data(2*row,:);,

end

%thresh thresholds the data.

function out = thresh(data, value)

%thresh threshholds the data.

out = data;

out(find(out ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download