16 April 2012
Control your world from your cell phone
By Jon Gabay
In our last installment, “Build your own crack POTS,” we discussed how to make a Plain Old Telephone System (POTS) interface that we could use as an access point for homes, apartments, and even business locations that maintain legacy telephone line systems. We also mentioned that even locations that have done away with the old Ma Bell telephone lines can still take advantage of our projects because the POTS interface is still in use with cable-, DSL-, and fiber-based telephony as well as with products that deliver voice over internet protocol (VoIP) – like Magic Jack.
In this installment, we will be delving into the dual-tone multi-frequency (DTMF) technology that will allow us to set up a control link through the POTS lines, which we can adapt for our own clever and innovative uses. We will also discuss the hybrid circuits that are used to turn the two-wire telephone line into a four- wire interface that separates the received voice/data signal from the transmit signal. This opens the door for other applications of our project as well.
Parts referenced here are available at the Avnet Express website. Schematics, Bills of Materials, PCB layouts, and code listings as they apply are freely available and can be used as a starting point.
It is suggested for you to take advantage of this and other Gizmo Blocks© in this series to encourage students, inventors, engineers, and hobbyist to come up with their own clever gizmos and gadgets that save energy, use it more efficiently, and provide us the next level of personalized control and safety in our lives. We are building a community here that rekindles ingenuity, innovation, and cleverness.
We invite you to dive into the technology, implement the design and share your innovations with us in video segments. Make sure you read the rules* below, but here is how it works:
1. Follow Jon Gabay’s article (here) and build the board design.
2. Create a short – 1 to 2 minute video, describing your application of the design.
3. Send me an email with the video file.
4. I will send you back an online Amazon Gift card valued at $100.00 (US dollars).
*Limit of 1 (one) gift card per person. Offer limited to the first 50 (fifty) participants who fulfill the four guidelines stated above. Offer ends April 30, 2012.
Note that common sense and Darwinian principals apply here. Please take reasonable safety precautions and seek guidance if you are new to gizmology.
The Core Functionality
Fig. 1 – Using Top Down Hierarchal Design techniques, we can ‘push’ into our DTMF block at the top level block diagram so we can define what functions we want to see in more detail. Here, we are defining what we will look for in a DTMF decoder.
Fig. 2 – Using the parametric search engine, we found the MT8870, which has all the functional blocks we were looking for at the right voltage and package.
Fig. 3 – The 6th order switch cap filters detect low (below 1KHz) and high (above 1 KHz) signals and notches out dial-tone frequencies.
Fig. 4 – Taking advantage of the chip’s internal reference and op-amp, we can center the AC waveform around 2.5V to present the entire waveform to the DTMF decoder.
Fig. 5 – Schematic of our DTMF and Audio In and Out circuitry that connects to part one of our POTS line interface project.
In part one of this project, we included the DTMF decoder and the 2-to-4 wire conversion functionality as top level blocks in our Block Diagram. Using hierarchical design techniques, we can ‘push’ into this block so we can refine the level of detail.
Inside our DTMF upper level block is the actual DTMF decoder, which is based on filtration. (See Fig. 1.) The eight constituent DTMF tones are chosen specifically to create low harmonic interference, but sharp filtering is still needed to discriminate between each tone as well as dial tones and possible false triggering from speech.
At the core is the ability to detect when a valid tone pair has been received. This function means that a timer will be needed to verify the minimum acceptable duration of valid tones before we assume they are real. This way we reduce the number of false interrupts and triggers when speech and other noises are present.
Since our digital data output is most likely going to be read by a microcontroller, high impedance tri-state outputs are desired in case we want to make this a data bus readable peripheral. That means we need an output enable signal. In addition, since there may be times when we don’t want the DTMF decoder sniffing at our audio, we want to be able to disable the chip and put it into a low power mode to save energy.
We could brute-force this by making several sharp band-pass filters and create our own decoder section, oscillator, timer, and bus drivers. While there is nothing stopping us from proceeding this way, if a good solution already exists at a reasonable cost, then that’s the best way to go. This option saves space and power, has fewer connections and is, therefore, more reliable.
The DTMF function is well covered by many chip makers and is common in the DSP world. Several manufacturers provide good solutions in a single-chip flavor that either covers receivers or transceivers for DTMF.
Taking advantage of the search engine on the Avnet Express website can save a lot of time, and it has a powerful parametric search capability. To identify a part I wanted to use, I chose 5 Volt (V) DTMF receiver only chip since we already have onboard a 5V regulator.
Notice how you can use the parametric search engine to take advantage of parts you may already have on hand or may already be using on another project. Since I already have 3.58 MHz crystals available to use, I used them as a search parameter. I also set a constraint to use a DIP package to make it easier for prototyping. The result was the MT8870 from Zarlink.
The Zarlink MT8870 is an integrated receiver only that decodes and uses digital counting techniques to detect and decode all 16 DTMF tones pairs and presents them to us as 4-bit binary codes with a data valid signal. (See Fig. 2.)
This part contains two 6th order switch cap band-pass filters, which split to cover low and high group tones using 1 KHz as the divider frequency. (See Fig. 3.) It also notches out the 350 Hz and 440 Hz tones to stop dial-tones from causing problems.
Once a tone is detected, a smoothing filter and limiter present full-scale voltage swings that are logic-level compatible, but before assuming the signal is good, a digital sequencer section counts for a valid signal duration to verify the signal is real before generating a valid data signal.
This part also uses a common crystal (3.579545) as a stable oscillator and has tri-state outputs with an enable pin. This functionality means we can add this part to a common or multiplexed bus. There is also a pin to put the chip into low power sleep mode. Not only does this feature save power, we can use it when speech or music is on the line to prevent false interrupts. There is also an inhibit pin that is internally pulled to an inactive state that I didn’t wire to, but it is there if you want to use it for anything.
A nice feature of the MT8870 is the built in op-amp. To use the internal op-amp, we have to take advantage of the on-chip VCC/2 reference to offset the AC waveform coming in from the transformer. By adding the 2.5V to the AC waveform, its voltage swings are centered on 2.5V DC.
The point is, with a single power supply, we don’t want any negative going voltage applied to our chip’s input. Not only can this damage chips, it would also introduce distortion by chopping off the bottom part of our wave. Without a negative power supply, the op-amp cannot output a negative voltage.
To achieve this setup, we create a low gain op-amp with both inputs biased by our reference. (See Fig. 4.) We can increase the gain by adjusting the 47K feedback resistor, but we don’t want to. Remember, there is a 2.5V DC level added to our waveform. If we add gain, we add to the DC level, and it will cause saturation that causes us to lose our signal. We can monitor the internal op-amp output at pin three of the MT8870.
Designing a Schematic
After reading the data sheet, I started to design. As is the case with many schematic capture programs, parts we may want to use are not in our standard library.
I created the schematic symbol for the MT8870 and assigned it a DIP 18 footprint for prototyping. If we want to make a smaller design, we can use surface mount. In order to make it easier for students and hobbyists to build, we will use a through-hole part. When we make a PCB board for student and hobbyist use, it will be through hole.
With symbol created, I entered in the schematic. (See Fig. 5.) I matched the pin-outs from the schematic of the telephone interface from the last sections. This setup will be beneficial when I wire in the new circuitry on the prototype, and I can modularize the design blocks with it. If we are clever when we make the PC boards, we can make the DTMF functional block snap onto the POTS line interface so no cables are required. Otherwise, using a simple SIP cable, we can string building blocks together for faster prototype and debug.
Review Part One of this project here: Build your own crack 'POTS' –Visit Building Innovation for more great projects from Dr. Gizmology.
Also available in the Building Innovation series: Build a 'Hall Effect' sensor interface, and Build an interfacing linear sensor