voice activated mouse click - uvic.caece.uvic.ca/~elec499/2004b/group11/elec499 final...

30
Voice Activated Mouse Click By: Dylan Hoen & Chris Young Submitted to Dr. Peter Driessen April 2, 2004

Upload: others

Post on 24-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

Voice Activated Mouse Click

By:

Dylan Hoen

&

Chris Young

Submitted to Dr. Peter Driessen

April 2, 2004

Page 2: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

i

Table of Contents List of Figures………...…………………………………………………………………....ii Summary………………...………………………………………………………………...iii 1.0 Introduction ................................................................................................................1 1.1 Purpose of the Project ......................................................................................1 1.2 Considering the Options...................................................................................1 2.0 Discussion...................................................................................................................2 2.1 Understanding the Hardware Circuits ...............................................................2

2.1.1 Power Supply Circuit ........................................................................................2 2.1.2 Analogue Filter Circuit......................................................................................4 2.1.3 System Clock Circuit.........................................................................................7 2.1.4 User Control Circuit .........................................................................................7 2.1.5 Pic to Mouse Circuit .........................................................................................8

2.2 Understanding the 18F258 Series Pic................................................................9 2.2.1 Reasons for Choosing the Pic ...........................................................................9 2.2.2 A/D Converter.................................................................................................9

2.3 System Software................................................................................................9 2.3.1 Software Timing Considerations.....................................................................10 2.3.2 Voice Detection Algorithm.............................................................................10

3.0 System Testing ..........................................................................................................12 3.1.1 Testing the Mouse...........................................................................................12 3.1.2 Software Testing.............................................................................................13 3.1.3 Testing the Mic ...............................................................................................14

3.2 Costs of Parts and Accessories........................................................................14 4.0 Using the Device .......................................................................................................15 15 5.0 Conclusions...............................................................................................................16 Cited References…………………………………………………………………………..20 General References………………………………………………………………………..20 Appendix A – Pic 18F258 Features Appendix B – Pic Software Appendix C – Software Program Written to Determine the Filter Coefficients Appendix D – Derivation of High Pass and Low Pass Filter Coefficients Appendix E – Cost Breakdown

Page 3: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

ii

List of Figures Figure 1. Block Diagram of the Device.................................................................................2 Figure 2. Power Supply Circuit..............................................................................................3 Figure 3. Analogue Filter Circuit...........................................................................................4 Figure 4. Simulated Frequency Response of the Analogue Bandpass Filter..........................5 Figure 5 System Clock Circuit ..............................................................................................7 Figure 6. User Control Circuit..............................................................................................8 Figure 7. Pic to Mouse Circuit..............................................................................................9 Figure 8. Software Algorithm.............................................................................................11 Figure 9. Mouse Power Consumption testing.....................................................................12 Figure 10. User Interface....................................................................................................15

Page 4: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

iii

Summary This final report is required for the completion of an undergraduate project course for the Department of Electrical Engineering at the University of Victoria. The following report discusses the motivation, research, design and testing of a voice detection device. This device was created specifically to be integrated into the existing testing software. This report will discuss the design and testing considerations required in the implementation of the Voice Activated Mouse. It will also discuss the voice detection algorithm that was implemented on the PIC. Finally, this report will outline the technical details needed to properly use the device.

Page 5: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

1

1.0 Introduction

1.1 Purpose of the Project Verbal Response time to a given stimulus is often required for many psychology experiments. Many experiments include patients verbally responding to visual stimulus such as a picture on the computer screen. Often, it is not the actual response that is important, but the time that it takes for the patient to respond. In the past, patients have been asked to click a button (or press a key) as they verbally respond so that the response time could be recorded. For tests involving gestural knowledge and gestural memory responses, a physical response could distort the results. As a result, a device is required that would detect a verbal response, and have the ability to transmit a voice detection signal to a computer, where the response time could be calculated.

1.2 Considering the Options Two attempts have been made to solve the response time recording problem in the past, neither of which worked particularly well.

According to Mike Mason (chair of the UVic Psychology department) an external device was created 4 years ago that was too noise sensitive to be effective. It was basically a threshold trigger device in which the any sound above a certain level would set it off. The department encountered problems when typical testing environment sounds (example: moving chair, outside sounds, footsteps) would be interpreted as a voice response. To make matters worse, the device would only work on computers that had the old Macintosh mouse connector, which has now been replaced by new USB mice.

The second attempt involved using the existing mic and communication hardware that comes with Mac computers. A program was written to detect voice responses and return the response time to the testing software. This program worked well in quiet testing environments, but when they tried to demo it at a conference, the background noise (human voices) severely affected the detection accuracy. Furthermore, the voice detection program (that worked with the mic) would have to be specifically modified to work with computers that have either a different operating system and/or communication hardware. The current setup will need to be drastically modified to be compatible with G5 computers and the Mac Os X operating system.

The problems that the other devices encountered were carefully examined and considered when the Voice Activated Mouse Click was created. We built is so that would work with all computers, have an accurate voice detection algorithm in a noisy or quiet environment, and give the user greater control over important device parameters. In addition, itis powered completely through USB power, thus, giving the user freedom of using the device on a laptop without having an external power supply.

Page 6: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

2

2.0 Discussion

2.1 Understanding the Hardware Circuits

A device was build consisting of several circuits attached to a Logitech USB mouse. These circuits included: an analogue filter circuit, power supply circuit, system clock, user input circuit, Pic to Mouse-Click circuit, and a LED display circuit. The device detects human voice in noisy environments, and causes the computer to interpret the voice as a mouse click. By connecting the voice detection device to the Logitech mouse, the device can be used on almost every computer available (both Mac and PC). The computer will not have to recognize the additional voice detection circuits added to the mouse, thus, the device will work on most computers (assuming that the appropriate drivers are installed).

Figure 1. Block Diagram of the Device

2.1.1 Power Supply Circuit The device was designed in such a way that it would be completely powered through a USB connection, thus, eliminating the need for an external power source when used on a laptop. A circuit was built to give us a larger voltage range (including a negative voltage) because the typical USB voltage range 0-5V would not be sufficient. Our input signal was very close to 0 volts therefore we needed to create a negative voltage to power the op amps. If a zero voltage reference was used (that wasn’t ground), we wouldn’t have enough impedance and

Page 7: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

3

noise would flow back into the ground wire. This problem was eliminated by generating a -3V supply, which was used for the negative Op-Amp power supply and ground was used as the 0 volt reference. After the signal had been amplified by a factor of 100 and filtered, it was passed to another Op-Amp circuit using 2.048 volts as its ground. We had to do this because the pic microcontroller would not except negative voltages through it’s A/D converter. A stable 4.096 voltage IC was used as the A/D reference voltage for the pic (2.048V is exactly half of 4.096V allowing for equal positive and negative voltage swing). Our capacitor charge pump power supply generated a lot of noise in its output voltages and also sent noise back through its power input to the rest of the circuit. The power supply was run at 10 KHz because it operates most efficiently at that value. When switching the capacitors between series and parallel, we found that it caused current surges and voltage jumps at a rate of 10 KHz (that was amplified at a factor of 1000 by our audio amplifier circuit) giving us a very poor signal to noise ratio. In attempt to improve the signal to noise ratio, we filtered the output with an RC filter circuit using fairly large (4700uF) capacitors and small (10 ohm) resistors. When this circuit was tested, it was determined that the signal to noise ratio was even worse. After some investigation we found that the power supply was sending noise back through its power input and into the power supply for the rest of the circuits. We used another RC filter (10ohms / 100uf) to filter out this noise and obtain a much better signal to noise ratio. We discovered that the power supply produced an adequate amount of power at 100 KHz, therefore, the power supply was changed to 100 KHz, which greatly reduced the amount of noise in the circuit.

Figure 2. Power Supply Circuit

Page 8: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

4

2.1.2 Analogue Filter Circuit The band pass filter was designed to let the common frequencies of the human voice through (150Hz-4500Hz) while eliminating the 60Hz noise (that is common around most computers) and frequencies above our 10kHz nyquist sampling frequency. The sound was picked up from a speaker and the signal was sent through an audio transformer, increasing the voltage. The signal was amplified by a factor of 100 then it was put through a 4th order high pass and a 4th order low pass filter. The signal was then stepped up from a ground of zero volts to a virtual ground of 2.048 volts and put through a user-adjustable amplifier. It was then read through the A/d converter where it was processed in software.

Figure 3. Analogue Filter Circuit

Page 9: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

5

Figure 4. Simulated Frequency Response of the Analogue Bandpass Filter

The first plot in Figure 4 shows the strength of the signal in dB. The second plot shows the aliasing noise level for various frequencies in dB (valid for frequencies less than the 10 KHz Nyquist sampling frequency). The third plot shows the phase, but it might not be accurate due to certain limitations in the demo version of Micro Cap 7 simulation software. The fourth plot is the signal transmitted as a fraction of the original signal. The fifth plot is the aliasing noise as a fraction of the original signal amplitude (valid for frequencies less than the 10 KHz Nyquist sampling frequency).

2.1.2.1 Testing of the Analogue filter Circuit Using an Oscilloscope When testing the band pass filter on batteries, the circuit worked fine, but when tested on a power supply, we got a large 60 Hz noise signal. The high pass filter corner frequency ha d to be raised from the original 40 Hz to 120 Hz to solve this problem. The analogue filter was hooked up to a sine wave generator and an oscilloscope in order to ensure that it had a reasonable frequency response. Initial tests revealed that the filter had:

? a peak at 1.5KHz

? -3dB points at 500Hz and 4 KHz

? -6dB points at 400Hz and 5.8KHz

Page 10: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

6

At 120Hz the signal was virtually non-existent. In order to ensure that lower voice frequencies were not filtered out (and that the 60Hz noise was completely eliminated), we changed several of the filter parameters. The final frequency response is as follows:

? 1.3 KHz peak

? -3 dB at 260 Hz and 3.6 KHz

? -6 dB at 210 Hz and 5.2 KHz

? -12 dB at 180 Hz and 8.7 KHz

? -18 dB at 134 Hz and 11.4 KHz

60 :Peak of 2 Volts at 1.3KHz

0.050 1 = 0.025 =

2 4020log(0.025) 32.04

Hz

dB

? ?? ?? ?

? ?

Other points of interest were tested to ensure that there was no aliasing:

at 10KHz:measured amplitude peak amplitude

400 20.2

20log(0.2) 13.9794

mV V

dB

?? ??

? ?

If we were looking at a 5 KHz signal: The original software routine had band pass filters that had a range of or 2? ? , therefore we had to look at the frequency with the highest aliasing noise in that range.

5KHz 2 7071Hz? ?

Aliasing would occur at: 20 7 13KHz KHz KHz? ?

at 13KHz:measured amplitude peak amplitude

230 20.115

20log(0.115) 18.786

mV V

dB

?? ??

? ?

Page 11: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

7

Results indicate that the aliasing components and noise are at acceptable levels.

2.1.3 System Clock Circuit This is the minimum amount of wiring and support components needed to operate a pic microcontroller.

Figure 5 System Clock Circuit

(We could not locate any ceramic resonators so we constructed the following circuit for our clock.)

2.1.4 User Control Circuit This section outlines the user-controlled aspects of the device. There are several dials and buttons that give the user control over things such as gain, response time, and enable/disable mouse click. The dials are connected to potentiometers that are connected to a stable 4.096V reference and to ground. The A/D converters reference voltage also connected to the 4.096V voltage. The value is read as an integer between 0 and 255, linearly proportional to the amount that the potentiometer has been turned. The program maps the 0-255 value to a set of discrete predefined vales which it uses for processing.

Page 12: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

8

Figure 6. User Control Circuit

Buttons and switches were also on the device. These buttons include enable/disable of the clicking, voice training, and background noise training. These buttons connect a TTL input pin to +5 Volts when pressed. These pins are normally connected to ground through a 10K resistor.

2.1.5 Pic to Mouse Circuit This section outlines the signal connection between the voice detection device and the USB mouse. When the program decides to click the mouse, it sends a positive signal to the base of the transistor, which switches the transistor on. When the transistor is turned on, it connects the mouse button to ground causing a mouse click.

Page 13: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

9

Figure 7. Pic to Mouse Circuit

2.2 Understanding the 18F258 Series Pic

2.2.1 Reasons for Choosing the Pic The software was originally written for a 16F876A pic, but since it does not have a hardware multiplier, we were unable to do any complex software routines on it. As a result, it was decided that a more powerful 18 series pic would be used. A 18F258 pic was used because it had the ability to use 4 A/D converters with an external voltage reference. It also has a timer for precise sampling periods, which is required for a digital filter. The pic had sufficient I/O pins that were used for button input and LED output. This pic is a relatively compact component that would fit nicely into our circuit. It met our limited power requirements (5 V and 200mA shared between the circuit and the mouse). Refer to Appendix A for the feature set of the 18F258.

2.2.2 A/D Converter The A/D converter was used to read in the voice signal and the positions of the user controlled dials. An external 4.096 V reference was used for stable A/D reads to avoid power supply noise. The chip has a 10 bit A/D converter but it was set to 8 bit mode so that we could use 8 bit numbers to avoid using unnecessary clock cycles in the computations. The chip has an 8 by 8 hardware multiply that was used extensively in the algorithm.

2.3 System Software

Page 14: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

10

2.3.1 Software Timing Considerations The entire human voice spectrum had to be captured so we need to analyze frequencies as high as 5 KHz. In order to avoid aliasing, we either had to sample at 20 KHz or create a sharper low pass filter. We opted to use the 20 KHz sampling frequency. A 20 MHz clock crystal was used to drive the pic. The pic divides the clock frequency by four, thus, giving us a 5MHz instruction rate which allows for approximately 250 instructions per A/D sample. The algorithm was programmed in the C language; therefore, many of the instructions were used up as load and store instructions. It is estimated that ¼ of the instructions were available to do the multiplying, adding, comparing, and decision-making. It was impossible to implement many of the voice detection routines that we initially intended on using because of the low instruction count constraint. It is possible to run a PIC18F258 at 40 MHz using a 40 MHz clock or a 10 MHz clock in a 4 times phase lock loop mode but these clock crystals were not in stock at the local electronics stores. In addition, we tested the clock at the 4 x 20 clock speed and noticed that it actually ran at about 60MHz, showing that the phase lock loop was unstable at this speed. Had we implemented this over clocking, our results would have been inconsistent and probably temperature dependant.

2.3.2 Voice Detection Algorithm Five software band pass filters were used to filter the incoming signal. Each of these band pass filters were connected to 2 envelope detectors, which work at different speeds. The fast envelope detector was used to mark the time of the start of the voice and the slow envelope detector identifies if it is the target voice or not. A value will be obtained from each of the 5 fast and 5 slow envelope detectors, which will be compared with similar values stored in memory. These stored values are obtained when the device is put in training mode and samples of background noise and target voice are processed in a similar way as the above. During the comparison, a "vote" process occurs (best 3/5) to determine if the sampled signal is more similar to the voice sample than the background noise sample. The fast envelope detector vote starts a timer. If a subsequent vote is false, the timer is reset. If the slow envelope detector vote determines that the signal is the target voice, the device waits for the timer to count up to a predefined value (user controllable), then a mouse click will occur. The psychology program adjusts for this user-defined time lapse when determining the exact response time. When the device is triggered it sends a mouse click signal to the computer. Once this is done, the device will wait a certain amount of time (this wait time is determined by the user controls) before it is ready to detect another signal.

Page 15: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

11

Figure 8. Software Algorithm

In figure 7, the boxes represent partially-overlapping band pass filters. Each target frequency is half of the target frequency of the previous band pass filter.

Page 16: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

12

3.0 System Testing

3.1.1 Testing the Mouse

3.1.1.1 Determining the Mouse Power Consumption The mouse was taken apart and rewired enabling us to determine its USB power consumption. It is important that we had sufficient power to operate the mouse and voice detection device simultaneously. It was determined that the mouse uses 29mA in the stand by mode, and 52mA when the mouse is tracking (the LED gets brighter). These values are much lower than what we had initially predicted. The remaining 148mA (USB max is typically 200mA) is more than sufficient to operate the voice detection device.

Figure 9. Mouse Power Consumption testing

Page 17: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

13

3.1.2 Software Testing We wrote a program in Java to determine the first order and second order filter coefficients for the high pass and low pass filters. This program starts with a specifi c sine wave and its amplitude was recorded. This sine wave was put through the filter with a variable input coefficient and the resulting amplitude was compared to the original amplitude. The Coefficients were adjusted based on whether the amplitude was higher or lower than 3 dB from the original and the process was repeated 20 times. The coefficients of the final run

through were accurate to a factor of 20

6

1 12 10

? ? ?? ?? ?

. The test was repeated for each of the

target frequencies. The results of these tests are as follows: Refer to Appendix C for the Source Code.

Low Pass Filter Coefficient Results

? ?( ) ( ) 1 ( 1)y t c x t c y t? ? ? ? ? ?

? ?2 2( ) ( ) 1 ( 1)y t c y t c y t? ? ? ? ? ?

4 sample/cycle: First order 3DB ratio = 0.7509617805480957 First order 6DB ratio = 0.5857863426208496 Second order 3DB ratio = 0.864356517791748 Second order 6DB ratio = 0.7667346000671387

8 sample/cycle: First order 3DB ratio = 0.5857863426208496 First order 6DB ratio = 0.35640573501586914 Second order 3DB ratio = 0.6944746971130371 Second order 6DB ratio = 0.5298819541931152

16 sample/cycle: First order 3DB ratio = 0.3318209648132324 First order 6DB ratio = 0.20199346542358398 Second order 3DB ratio = 0.4498744010925293 Second order 6DB ratio = 0.3215975761413574

32 sample/cycle: First order 3DB ratio = 0.1793208122253418 First order 6DB ratio = 0.10701799392700195 Second order 3DB ratio = 0.26179075241088867 Second order 6DB ratio = 0.1777663230895996

64 sample/cycle: First order 3DB ratio = 0.09365320205688477

Page 18: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

14

First order 6DB ratio = 0.055086612701416016 Second order 3DB ratio = 0.14140748977661133 Second order 6DB ratio = 0.09343862533569336

High Pass Filter Coefficient Results 0

1

0

1

0 1 1

0

( 1)

1( ) ( 1) ( 1)

( )

n c

n cd c

d cn x t n x t d y t

y td

?

? ?? ?

? ? ?? ? ? ? ? ?

?

4 sample/cycle: First order 3DB ratio = 1.5537397589683533

8 sample/cycle: First order 3DB ratio = 2.414218051433563

16 sample/cycle: First order 3DB ratio = 5.02737563085556

32 sample/cycle: First order 3DB ratio = 10.15314115381241

64 sample/cycle: First order 3DB ratio = 20.355483129024506

Refer to Appendix D to see the derivation of the formula for this high pass filter.

3.1.3 Testing the Mic The microphone that we had originally purchased did not work to our standards. The signal that it would produce was much too weak when compared to the noise level in the circuit. As a result, we obtained an internal computer speaker to use as the input device. It was determined that this speaker had an impedance of 8 ohms. The speaker was connected to an audio transformer that had 8 ohm impedance on one side and 1.2k on the other. A Plexiglas box was built around the speaker in order to maximize its sound collecting ability and it was suspended on a coat hanger wire to reduce the vibrations transmitted to it through the table.

3.2 Costs of Parts and Accessories The complete cost of the voice activated mouse click was found to be $182.12. See appendix E for a breakdown of the cost of the parts.

Page 19: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

15

4.0 Using the Device

Figure 10. User Interface

The following are the necessary steps to use the device:

1. As soon as the device is plugged into the USB port of most computers, the operating system will automatically detect the device and install the drivers for the mouse. Initially the device should be switched into disabled mode.

2. Adjust the trigger time and the reset time dials to your preferred values. While saying “aahhhhh” adjust the gain so that the green LED (labeled “Good Gain”) lights up while making sure that the red LED (labeled “Gain Too High”) doesn’t light. This ensures that the voice signal is at an appropriate level for the software analyzer.

3. While being as quiet as possible, push the button that is labeled “Train Back Ground Noise Level”.

4. While saying “ahhhh” at a normal speaking level, press the “Train Voice” button. A sample of the state of all of the filters is taken at the exact moment that the button is pushed.

5. The device has now been trained and it is ready to be enabled by flipping the switch into the enabled position. The device will now click when it detects the target voice.

Page 20: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

16

5.0 Conclusions This project involved in depth research and intensive problem solving. It was more complex than what we had originally thought and it involved implementing knowledge in areas such as digital signal processing, communications, electronic devices, analogue filters, microcontrollers, java and C programming, and hardware. Though we experienced many set backs and design changes, we are happy to say that the final product exceeded the performance expectations outlined by the psychology department. Even though long hours were spent overcoming the numerous challenges we encountered, the sense of accomplishment that we received made it well worth it. The practical knowledge that we have gained this assignment goes way beyond the classroom.

Page 21: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

17

Cited References [1]. “The Bypass Capacitor in High-Speed Environments.” Texas Instruments,

November 1996, Application Report, literature number SCBA007A. (1 March 2001). [2] "Digital Filter Design Writing Difference Equations For Digital Filters" Brian T. Boulter, [Online serial] (2000), Available at: http://www.apicsllc.com/apics/Sr_3/Sr_3.htm General References Ghaemmaghami, S.; Deriche, M.; Boashash, B.; TENCON '97. IEEE Region 10 Annual Conference. Speech and Image Technologies for Computing and Telecommunications'., Proceedings of IEEE , Volume: 2 , 2-4 Dec. 1997 Pages:743 - 746 vol.2

Ngoc Bui; Monbaron, J.; Michel, J.; Acoustics, Speech, and Signal Processing [see also IEEE Transactions on Signal Processing], IEEE Transactions on , Volume: 31 , Issue: 1 , Feb 1983 Pages:323 - 329

McAulay, R.J.; Quatieri, T.F.; Acoustics, Speech, and Signal Processing, 1990. ICASSP-90., 1990 International Conference on , 3-6 April 1990 Pages:249 - 252 vol.1

Page 22: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

18

APPENDIX A

Pic 18F258 Features

Page 23: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

19

Page 24: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

20

APPENDIX B

Pic Software

Page 25: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

21

APPENDIX C

Software Program Written to Determine the Filter Coefficients

Page 26: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

22

APPENDIX D

Derivation of High Pass and Low Pass Filter Coefficients

Theory taken from [2]:

http://www.apicsllc.com/apics/Sr_3/Sr_3.htm

Page 27: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

23

2nd Order Low-Pass Filter 4 / (5 )196 60

8 / (2.5 )136 120

16 / (1.25 )82 174

32 / (0.625 )196 60

64 / (0.3125 )24

samples cycle KHznew old

samples cycle KHznew old

samples cycle KHznew old

samples cycle KHznew old

samples cycle KHz

? ? ?

? ? ?

? ? ?

? ? ?

? 232new old? ?

Page 28: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

24

2nd Order High-Pass Filter

1 20 1 1

-1 -20 1 2

( )n n z n z

H zd d z d z

? ?? ??

? ?

1 2 1 20 1 2 0 1 2

0 1 2 0 1 2

0 1 2 1 2

0

( ) ( )( ) ( 1) ( 2) ( ) ( 1) ( 2)

( ) ( 1) ( 2) ( 1) ( 2)( )

( ) ( 1) ( 1) ( 1)( )

1

( ) ( )1 1

Y HX

Y d d z d z n n z n z Xd Y t d Y t d Y t n X t n X t n X t

n X t n x t n X t d Y t d Y tY t

dCX t CX t C Y t

Y tC

C CY t X t

C C

? ? ? ?

?

? ? ? ? ?? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ??

? ? ? ? ??

?? ? ? ?? ?? ? ?? ?? ? ? ?

1( 1) ( 1)

1C

X t Y tC

?? ?? ? ?? ? ??? ?

2sec

sec

2

cycles

tsample

t cyclesample sample

cycle

? ?

? ? ?

?

?

? ?? ?? ?? ?

?

?

C=cotsamplecycle

?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?

For n=2 0

1

2

121

nnn

???

? ?2

0

21

22

2 1

2 1

2 1

d C

d C

d C

? ? ?

? ? ?

? ? ? ?

1st Order High-Pass Filter The high pass difference equation is obtained from the normalized Butterworth continuous time filter descriptions given below. 1st. order normalized Butterworth low pass filter:

1( )

1H s

s?

? (1)

The above low pass equation is mapped to the appropriate filter type using the following mapping:

Page 29: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

25

hc

dc

s??

? ;

hc? = desired high-pass 3 [dB] pass frequency. where: B = A number that controls the notch depth/width (equivalent to 1/Q).

cc? = The desired continuous time center frequency. To create a digital filter we normalize the above filter by setting cc? = 1, and map to the z-domain using the bi-linear transformation:

11wcc

zs c

z?? ?? ? ? ??? ?

(2)

The c co-efficient in the above equation is used to accomplish frequency warping. That is, to compensate for an inherent inaccuracy in the bi-linear transformation method that is a function of frequency and sample rate. Once the above mapping is performed by substituting (2) into the continuous time s-domain filter equation we obtain a z-domain transfer function of the form:

10 1

10 1

( )n

nd

d

n n z n zH z

d d z d z

? ?

? ?

? ? ??

? ? ??? (3)

For n=1

1

0

1

0

( 1)1

n Cn Cd Cd C

?? ?? ?? ? ?

Filter Coefficients

4 / 1.5020 154,-154,51

0.6003 -0.6003 0.2006

8 / 2.6784 18

0.7277 -0.7272 0.455397

samples cycle C

samples cycle C

? ?

? ?6,-186,117

16 / 5.1577 214,-214,173

0.8376 -0.8376 0.6752

32 / 10.2186 233,-233,210

0.91086 -0.91086 0.82172

64 / 20.3882 244

0.95325 -0.95325 0.90649

samples cycle C

samples cycle C

samples cycle C

? ?

? ?

? ?,-244,232

Page 30: Voice Activated Mouse Click - UVic.caece.uvic.ca/~elec499/2004b/group11/elec499 final write-up_edited.pdf · This final report is required for the completion of an undergraduate project

26

APPENDIX E

Cost Break down

COMPONENT DESCRIPTION QUANTITY COST Pic 18F258 2 $4.10 10K resistors 21 $0.30 Capacitors 18 $0.50 USB mouse Logitech 1 $42.13 logarithmic 50K potentiometer 1 $3.25

50 K linear potentiometer 1 $2.60 10 K linear potentiometer 1 $2.60 5K linear potentiometer 1 $2.60 20 MHZ Crystal 1 $8.14

Max 660 Capacitor Charge pump voltage doublers and negative voltage power supply

1 $6.10

Germanium Diodes 2 $0.45 Max 6341 4.096 V reference 2 $4.50 Lm 348 quad 741 op amp ICs 2 $4.00

741 op amp IC 1 $3.10 Speaker to use as a Mic Internal computer speaker 1 $4.50 dials 5 $0.90 LED's Lower power, super bright 8 $0.80 Breadboard Oversized 1 $48.80 Device Protective Container Container was built with Plexiglas 1 $6.00

Grand Total $182.12