You are on page 1of 10

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

Matric No: U066584J February 9, 2010

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., 1 () = (sin 2 697 + sin 2 1209) 2 In this project, The following assumptions are made 1. The sampling rate, = 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

2. Generate and plot the DTMF tones when the ve 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. Write a program to retrieve the number that the signal represents.

2
2.1

Algorithm
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 when its 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 will last for 0.5 seconds. Hence a vector of time, t, is initialised from 0 up to 0.5 with 32768 = 16384 2 parts. To determine the corresponding frequencies, two switch-case command is used: rst one to assign the frequency to the corresponding row of the numpad, and second one to assign the frequency to the corresponding column of the numpad. Finally, the result is generated by typing in the formula provided from the project description using the frequencies determined earlier.

2.2

To generate and plot the DTMF tones when the ve numerical numbers of my 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 function such that it can input any number of any length, not to be restricted by a ve 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 user to input the dial numbers. At the end of the computation, it will return a digital signal consist of the dial tones of all pressed numbers. Each of the signal is of 0.5 seconds long and will be idle for another 0.5 seconds between two successive tones. To generate the digital signal, the previous function, generate dial is used to input individual number. A for loop will keep updating the nal return value with signals corresponding to the input number. After the assignment, the sound of the tones will be played and the signal of the tones will be plotted in time domain.

2.3

To analyze the signals generated from the previous section using frequency analysis 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 basic Fast Fourier Transform (FFT) to identify the major frequencies of the signals. A vector consist of the number identied will be displayed in order. Before performing frequency analysis, the input digital signals is truncated at every one second point to retrieve individual signals corresponding to the numbers dialed previously. The truncation can be done using a for loop to assign a new variable with the portion of the original signals.

After the truncation, each individual signal can now be analyse using FFT. Since the given frequencies in this project are whole numbers, by using frequency resolution of 1 Hz, we should obtain a clear frequency response with clean spike at the frenquency components. A single-sided FFT is sucient in this case since the signal is real and symmetry. In order to monitor the algorithms, the frequency response of each signal is plotted in dierent graphs. Next, is the identication step. As explained in the previous paragraph, the frequency components of the signal should be easily identied as a clear spike with normalized magnitude 0.5. To check which frequency exists in the signal, a while loop is used to search for spikes through the whole frequency spectrum (16384 points). If the normalized magnitude of any frequency points is near to 0.5, that frequency is identied as one of the components in the signal. Finally, there should be only two frequency components identied from the previous step. A switch-case condition is used to mark the row and the column of the numpad using the identied frequencies. The dialed number is now easily found by taking the coordinates of the number corresponding to the numpad shown in Figure 1. The previous steps are repeated until all numbers are found. The return variable will be the vector of dial numbers in correct sequence.

Source Codes

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

3.1

generate tones.m

3.2

dial tones.m

3.3

retrieve dial.m

Results

Dierent results can be obtained by inputing the dierent numbers. In this section, the result generated 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 >> Refer Figure 3 to 7 for the graphs of signal in frequency domain. Figure 7 to 11 corresponding to frequency responses of dial tones of 6, 6, 5, 8, 4. 6 5 8 4

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. With current computational power of Matlab and computers, the eciency in doing signal processing in electrical engineering eld has greatly increased. 7

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

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

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

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

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

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

10

You might also like