10
Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF) System EE2013 Project Matric No: U066584J February 9, 2010 1 Introduction Figure 1: Frequencies Assigned to Each Number Dual Tone Multi-Frequency (DTMF) system: the telephone dialing pad acts as a 4-by-3 matrix and associated with each row and column is a frequency. For example, the tone generated by the button \1" is obtained by two fundamental tones with frequencies 697Hz and 1209Hz, i.e., y(t)= 1 2 (sin 2697t + sin 21209t) In this project, The following assumptions are made 1. The sampling rate, Fs = 32768 Hz, 2. The tone usually elapses around 0.5s when a button is pushed, 3. An idle state for another 0.5s between the button pushing. There are three tasks to be completed in this project, 1. Write a function that can generate the corresponding DTMF tones when any button is pushed. 1

Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

  • Upload
    others

  • View
    25

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF) System

EE2013 Project

Matric No: U066584J

February 9, 2010

1 Introduction

Figure 1: Frequencies Assigned to Each Number

Dual Tone Multi-Frequency (DTMF) system: the telephone dialing pad acts as a 4-by-3 matrixand associated with each row and column is a frequency. For example, the tone generated by thebutton “1” is obtained by two fundamental tones with frequencies 697Hz and 1209Hz, i.e.,

y(t) =1

2(sin 2�697t+ sin 2�1209t)

In this project, The following assumptions are made

1. The sampling rate, Fs = 32768 Hz,

2. The tone usually elapses around 0.5s when a button is pushed,

3. An idle state for another 0.5s between the button pushing.

There are three tasks to be completed in this project,

1. Write a function that can generate the corresponding DTMF tones when any button is pushed.

1

Page 2: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

2. Generate and plot the DTMF tones when the five numerical numbers of your Matric No.have been dialed. You may hear your generated tone using sound command in Matlab.

3. Using frequency analysis methods to analyze the signals that you generated in Step 2. Writea program to retrieve the number that the signal represents.

2 Algorithm

2.1 To generate corresponding DTMF tones when button is pushed

In this section, we are required to write a function to generate a corresponding DIMF tones whenits button is pushed. A straight forward convention would be to take in the number of the button,and output the digital signal generated by the corresponding frequencies.

As a requirement, the sampling frequency of the signal is set as 32768 Hz while this signal willlast for 0.5 seconds. Hence a vector of time, t, is initialised from 0 up to 0.5 with 32768

2 = 16384parts.

To determine the corresponding frequencies, two switch-case command is used: first oneto assign the frequency to the corresponding row of the numpad, and second one to assign thefrequency to the corresponding column of the numpad.

Finally, the result is generated by typing in the formula provided from the project descriptionusing the frequencies determined earlier.

2.2 To generate and plot the DTMF tones when the five numerical numbers ofmy Matric No. have been dialed

A function is created to generate and plot the DTMF tones given the input numerical numbers.In addition to what is required from the project description, I have implemented this functionsuch that it can input any number of any length, not to be restricted by a five digit Matric No.Furthermore, the dial tones will be played to verify the input results.

For a better presentation, this function will not take in any parameter, but will prompt userto input the dial numbers. At the end of the computation, it will return a digital signal consist ofthe dial tones of all pressed numbers. Each of the signal is of 0.5 seconds long and will be idle foranother 0.5 seconds between two successive tones.

To generate the digital signal, the previous function, generate dial is used to input individualnumber. A for loop will keep updating the final return value with signals corresponding to theinput number. After the assignment, the sound of the tones will be played and the signal of thetones will be plotted in time domain.

2.3 To analyze the signals generated from the previous section using frequencyanalysis methods

In this section, a function retrieve data.m is created to perform frequency analysis to the signals.This function will read the digital signals generated from the previous section, and perform a basicFast Fourier Transform (FFT) to identify the major frequencies of the signals. A vector consist ofthe number identified will be displayed in order.

Before performing frequency analysis, the input digital signals is truncated at every one secondpoint to retrieve individual signals corresponding to the numbers dialed previously. The truncationcan be done using a for loop to assign a new variable with the portion of the original signals.

2

Page 3: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

After the truncation, each individual signal can now be analyse using FFT. Since the givenfrequencies in this project are whole numbers, by using frequency resolution of 1 Hz, we shouldobtain a clear frequency response with clean spike at the frenquency components. A single-sidedFFT is sufficient in this case since the signal is real and symmetry. In order to monitor thealgorithms, the frequency response of each signal is plotted in different graphs.

Next, is the identification step. As explained in the previous paragraph, the frequency compo-nents of the signal should be easily identified as a clear spike with normalized magnitude 0.5. Tocheck which frequency exists in the signal, a while loop is used to search for spikes through thewhole frequency spectrum (16384 points). If the normalized magnitude of any frequency points isnear to 0.5, that frequency is identified as one of the components in the signal.

Finally, there should be only two frequency components identified from the previous step. Aswitch-case condition is used to mark the row and the column of the numpad using the identifiedfrequencies. The dialed number is now easily found by taking the coordinates of the numbercorresponding to the numpad shown in Figure 1. The previous steps are repeated until all numbersare found. The return variable will be the vector of dial numbers in correct sequence.

3 Source Codes

The original source codes will be shown in this section. generate tones.m, dial tones.m, andretrieve dial.m are the Matlab .m file corresponding to the tasks 1, 2 and 3 from the projectdesciption menu.

3

Page 4: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

3.1 generate tones.m

4

Page 5: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

3.2 dial tones.m

5

Page 6: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

3.3 retrieve dial.m

6

Page 7: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

4 Results

Different results can be obtained by inputing the different numbers. In this section, the resultgenerated by inputing my Matric. No, 66584, is presented.

>> signal = dial_tones;

Please Dial Your Number : 66584

>>

Refer Figure 2 for the graph of signal in time domain.

Please Dial Your Number : 66584

>> retrieve_dial(signal)

ans =

6 6 5 8 4

>>

Refer Figure 3 to 7 for the graphs of signal in frequency domain. Figure 7 to 11 corresponding tofrequency responses of dial tones of 6, 6, 5, 8, 4.

5 Conclusion

Matlab is a very powerful program to solve engineering problem, both numerically and analytically.In this project, I have learnt that Matlab can be used to generate and analyse signals easily. Withcurrent computational power of Matlab and computers, the efficiency in doing signal processing inelectrical engineering field has greatly increased.

7

Page 8: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

Figure 2: Signal of Dial Tones of 66584 in Time Domain

Figure 3: Signal of Dial Tones of 6 in Frequency Domain

8

Page 9: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

Figure 4: Signal of Dial Tones of 6 in Frequency Domain

Figure 5: Signal of Dial Tones of 5 in Frequency Domain

9

Page 10: Touch-tone Dialing: Dual Tone Multi-Frequency (DTMF

Figure 6: Signal of Dial Tones of 8 in Frequency Domain

Figure 7: Signal of Dial Tones of 4 in Frequency Domain

10