EE 451 - LAB 7

DTMF Detector

Part 1: 770 Hz Bandpass Filter and Detector

In the last lab you wrote a program to generate DTMF (Dual Tone Multiple Frequency) tones using the 56002. For this lab you will build a decoder to indicate which DTMF tone is being generated. This can be accomplished in many ways. The way we will do it in this lab is to build a bandpass filter and detector for each of the eight DTMF frequencies. Thus, if the number 8'' is pressed the outputs of the 853 Hz and 1336 Hz detectors should go high, while the outputs of the other detectors should remain low. In Part 1 of Lab 7 you will design the bandpass filter and detector for the 770 Hz frequency. In the next part you will add the filters and detectors for the other frequencies to be able to detect all eight frequencies.

This lab will deal with telephone-line frequencies. A telephone line has a low-pass cutoff of about 3 kHz. Thus, we can get all the information about any signal on a telephone line by sampling the signal at any frequency above 6 kHz. For this lab we will use a sampling frequency of 8 kHz, which will make filter design easier than if we sampled at 48 kHz.

We will design the bandpass filter by placement of poles and zeros. For example, suppose we want to detect a frequency of 770 Hz. We want a bandpass filter which will pass 770 Hz (and a few hertz above and below 770), while blocking low and high frequencies. We could do this by placing a pole just inside the unit circle from 770 Hz, and zeros at 0 Hz and 4,000 Hz. It turns out that this two-pole filter will not give a suitably narrow bandpass response. However a four-pole filter, with poles just inside the unit circle at about 765 Hz and 775 Hz will give a suitable bandpass filter. Figure 1 below shows the pole-zero placement for a four-pole bandpass filter. Figure 2 shows the frequency response of this filter. Figure 3 shows the response of the filter to an in-band 770 Hz signal and an out-of-band 693 Hz signal.

To design your bandpass filter put poles just inside the unit circle at frequencies of about 765 Hz and 775 Hz. Adjust the radius of the poles until the gains at 693 Hz and 852 Hz (the signals the bandpass filter should stop) are less the 5% of the maximum gain at about 770 Hz.

The detector for 770 Hz is simple to design. One method is to just square the output signal from the output of the bandpass filter and average it over one period. Then if the output of the detector exceeds some threshold value you can set a pin high to indicate that that particular frequency is present in the input signal. Figure 4 shows the response of such a detector to a 770 Hz pulse.

You also need an external indication of when the 770 Hz signal is present, to see if your program is working correctly. To do this you must toggle an external pin on the 56002. Like the 68HC11, the 56002 has several dual-purpose pins - pins which can be used for a specific purpose (like serial I/O), or can be used for general purpose I/O if not being used for their specific purpose. The 56002 has 15 pins devoted to Port B, the the Host Interface (HI) port. When used as a host interface, the 56002 can communicate with a host computer over an eight-bit parallel bus. When not used as a host interface, the 15 pins of Port B can be used for general purpose I/O. Section 5.2 of DSP56002: Digital Signal Processor User's Manual describes how to set up Port B for use for general purpose I/O. Read this section of the manual.

1.
Design a bandpass filter to pass 770 Hz while blocking all the other frequencies of the DTMF tones. Do this as discussed above: design a four-pole filter, with poles just inside the unit circle at about 765 Hz and 775 Hz. Adjust the radius of the poles until the poles are as far away from the unit circle as possible, while the gain at the adjacent frequencies (693 Hz and 852 Hz) is about 5% of the gain at the desired frequencies.

Use MATLAB to plot the gain of your bandpass filter, and to plot the poles and zeros. Write the filter in the form of a difference equation which can be implemented on the 56002.

2.
Design the detector. First, square the output of the bandpass filter. Write this operation in the form of a difference equation. Second, design the averager. Again, write this in the form of a difference equation. Use MATLAB to plot the frequency response of this averager and verify that it is a low-pas filter. Also, use MATLAB to plot the poles and zeros of the averager.

3.
Write a 56002 program to implement your filter and detector. For debugging purposes, have your program display the output of the bandpass filter on the left channel, and the output of the detector on the right channel. When the output of the detector is above a threshold which indicates a signal of frequency 770 Hz is present, bring bit 0 of Port B high.

Verify that the frequency response of the bandpass filter matches the theoretical response from MATLAB. Verify that the output of the detector (on channel B and on Bit 0 of Port B) is high when a full-scale 770 Hz signal is present on the input, and is low when at 693 Hz or 852 Hz signal is present. Determine the minimum amplitude for a 770 Hz signal needed for the detector to indicate that a 770 Hz signal is present. With a full-scale input signal, determine the exact range of frequencies for which the detector output is high.

Bill Rison
1998-10-12