Introduction
DTMF (Dual Tone Multi-Frequency) signals are commonly used in telephone networks. Whether it is a home phone, mobile phone or program-controlled exchange, DTMF signals are often used to send and receive numbers. DTMF technology can also be used in power line carrier communications and other occasions. It can be seen that DTMF dialing and decoding are widely used in communication systems and other aspects. Usually, the detection of DTMF signals is implemented using dedicated chips or DSPs, but the cost is relatively high. This article introduces a low-cost DTMF dial decoder implementation based on MSP430F133. MSP430F133 is a 16-bit RISC structure MCU from TI with a minimum instruction cycle of 150ns, 8KB Flash ROM, 256B RAM and a built-in 12-bit ADC.
DTMF signal
DTMF signal is a coding method that uses 8 frequencies in the audio range to represent the 16 characters on the dial, 0~9, A~D, */E, #/F. The 8 frequencies are divided into two groups, high frequency group and low frequency group, which are used as column frequency and row frequency respectively. The signal of each character is composed of the superposition of two frequency sinusoidal signals from the column frequency and the row frequency. The frequency combination method is shown in Figure 1.
According to CCITT Q.23, the technical indicators of DTMF signals are: the transmission/reception rate is 10 numbers per second, or 100ms for each number. During the transmission of each number, the signal exists for at least 45ms and no more than 55ms, and the rest of the 100ms is silent. A frequency error of no more than ±1.5% is allowed at each frequency point. Any signal that exceeds ±3.5% of the given frequency is considered invalid and refused to be received. In addition, under the worst detection conditions, the signal-to-noise ratio shall not be less than 15dB.
DTMF dialing
The circuit schematic of the DTMF dialing part is shown in Figure 2. The circuit mainly consists of a resistor network and a filter composed of 4 I/O lines. The resistor network constitutes a 4-bit DAC, and the high-pass filter and low-pass filter form a bandpass filter to filter out the harmonic signals of the dual audio. A 600Ω 1:1 transformer is used at the output end to interface with the telephone line. The output level of the telephone line can be adjusted by changing Rx.
The software uses a table lookup method to simulate the generation of two sine waves of different frequencies. First, determine a suitable sampling interval, sample the sine waves of each frequency and normalize them to 0~7 (3-bit data), and make a corresponding sine table. The sine table should ensure that the frequency error of the synthetic signal is within ±1.5%, and the number of sampling points should be as small as possible. In order to reduce the waveform distortion, the total signal time recorded by the sine table corresponds to an integer number of cycles of the original signal, and the sampling starting point is selected at the peak of the positive waveform. The sampling interval of this design is selected as 122us to ensure that the frequency error is within ±1%. The number of sampling points and frequency error of each frequency signal are shown in Figure 3.
The DTMF dialing program flow chart is shown in Figure 4.
DTMF decoding
To decode DTMF using software, the analog signal must first be converted into a digital signal and then sent to the CPU for processing. The analog-to-digital conversion can be achieved by using the built-in 12-bit ADC of MSP430F133 plus a simple interface. The ADC interface circuit is shown in Figure 5.
A metal film resistor with a precision of 1% should be selected. The ADC reference voltage is selected as the internal 2.5V:
DTMF decoding can determine whether it is a valid DTMF signal and which number is received by calculating the spectrum value of the received signal at 8 predetermined frequency points. In addition, a series of validity checks are required to prevent misjudgment.
FFT can be used to calculate the spectrum value at N frequency points, but it is not suitable for this application. Because it calculates many unnecessary values, the amount of calculation is too large; and in order to ensure frequency resolution, the number of FFT points is large. In addition, it cannot be processed in a sample-by-sample manner, which is not conducive to real-time implementation.
Since only the spectrum values of 8 specific points need to be known, a DFT algorithm called the Goertzel algorithm can effectively improve the computational efficiency. It is equivalent to an IIR filter with two poles. The 8 frequency points correspond to their own matching filters, and their transfer function is
However, the Goertzel algorithm still has a disadvantage, that is, it calculates the spectrum value at the frequency , while the exact frequency value usually only corresponds to an approximate integer k. In order to achieve the required resolution, a larger number of samples N is required. The improved method is: modify the transfer function, do not calculate the spectrum value at the angular frequency , but calculate the spectrum value at the exact angular frequency . In this way, the resolution can reach the resolution of the natural windowing (rectangular window) of the data. Its transfer function is
The improved Goertzel algorithm operation steps are as follows:
1. Recursively calculate for each sampling point (n=0,1,…,N)
The initial condition is
2. After N sample points are collected and calculated, 8 spectrum values are calculated:
Based on the selected sampling frequency of 6Khz, the required frequency resolution can be achieved by selecting N=86 samples, which corresponds to a signal of about 15ms, ensuring that one number can receive two complete DTMF signal cycles.
After the eight spectrum values are calculated, a DTMF validity check is performed to determine whether it is a valid DTMF signal. The validity check includes the following items: (1) The maximum amplitude of the high and low frequency bands must be greater than a certain threshold value, and the sum of the two must also be greater than a certain threshold value. (2) The difference between the maximum amplitude of the high and low frequency bands and the other three amplitudes of each frequency band must be greater than a certain threshold value. (3) The reverse twist test means that the maximum amplitude of the low frequency band shall not exceed the maximum amplitude of the high frequency band by 8dB, and the standard twist test means that the maximum amplitude of the high frequency band shall not exceed the maximum amplitude of the low frequency band by 4dB. (4) The ratio of the sum of the maximum amplitudes of the high and low frequency bands to the sum of the other six amplitudes must be greater than a certain threshold value.
If the above test is passed, the current cycle DTMF signal is determined to be valid, and the corresponding number can be determined based on the frequency combination. However, to confirm that a valid number has been received, two conditions must be met. First, there must be more than two consecutive cycles of valid and identical DTMF signals to ensure the signal duration, and second, there must be enough silence time in front to avoid repeated recognition.
The DTMF decoding program flow chart is shown in Figure 6.
Each iteration of decoding requires eight multiplications. Since F133 does not have a hardware multiplier, it must use "shift and add" for multiplication. Therefore, optimizing the multiplication operation will greatly improve the calculation efficiency. The optimization is considered from several aspects: try to use the register addressing method to make full use of the 150ns instruction; in addition, the multiplier of each frequency point is fixed and known, so "shift and add" can be used instead of looping and judging bit by bit, and can be fully expanded bit by bit to save the judgment action; in addition, adding a simple gain control at the front end can ensure that the subsequent operation does not overflow, saving overflow processing. After the above optimization, real-time decoding of DTMF is realized.
Conclusion The DTMF dial decoder solution has low cost and reliable performance and has been put into practical application.
Previous article:Design of wireless handheld terminal based on SX1233
Next article:Analysis of Dynamic Clock Configuration of MSP430 Series MCU
Recommended ReadingLatest update time:2024-11-17 00:18
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Hot discussion on the new regulation proposed by the Ministry of Industry and Information Technology [Rated transmission power requirement: less than 50W]
- EEWORLD University Hall ---- 2019 National College Student Electronic Design Competition Explanation and Display
- Questions about the RSL10-002GEVB schematic
- TI revolutionizes car access with Bluetooth low energy technology
- With these experiences, novices can easily choose MOSFET
- Seeking sensors that can monitor objects in the soil
- Agitek Engineers - How to Measure Cable Impedance and Loss Using a Vector Network Analyzer
- How to Layout a Circuit Board for an Op Amp
- 【RVB2601 debugging record 2】+ uGUI porting
- Visitor registration is in progress丨2021 Munich South China Electronics Show (Shenzhen International Convention and Exhibition Center) invites you to participate!