5 April 2012
Notice how the audio is cap coupled to the reference biased input stage. You will also notice that I tap off the MT8870’s op-amp output at pin 3 to capture the audio out through a unity gain non-inverting buffer. This way, any faults or issues in the audio chain will not affect the DTMF decoding functions.
The Output Enable and Power Down lines are brought out to the connector but do not have to be actively driven. Internal resistors make these active without having to connect them, but they are available if you want to use them.
I also added an NPN transistor to sink the current from the relay that takes the phone Off-Hook at our command. A small series resistor at the base lets a TTL or CMOS output from our logic or our microcontroller control this directly. A protection diode protects the transistor from back EMF spikes that can occur from relay coils.
Fig. 6 – Using two transformers, a passive hybrid 2-to-4 wire conversion circuit could be implemented without any active components. The receive audio was effectively subtracted from the transmit and visa versa.
Fig. 7 – The solid state hybrid typically uses op-amps to cancel out the unwanted receive audio from the transmit and visa versa.
Fig 8 – Our floor plan indicates where our new components will go and also defines the signals on the connectors. This approach is not only useful while building, it is also useful during the debug phase.
Fig. 9 – Adding to the same circuit board, we were able to fit the DTMF and audio in and out functions on the same perf-board. Status LEDs will make debug very easy since we should be able to visually read the DTMF codes and see the telephone status.
Fig. 10 – Prototyping is a bit harder with perf-board and discrete wires, but it can result in a tougher, longer lasting prototype that can actually be deployed.
I can engage the relay manually by jumpering 5V to the transistor base resistor or by placing a jumper over connector CNX1 pin 7 and 8. This is a male SIP header with adjacent 100 mil spaced pins. A standard Shunt Jumper fits easily onto these two pins, which connect the coil current sink path directly to ground. This setup provides an example of how clever assignment of pin functions on connectors can make debug and test easier.
I added LEDs for Off-Hook and Ring Detect as well as data bits (D0-D3). Another LED indicates when data is valid. Looking at the schematic, you will notice that the Ring Detect and Off-Hook Detect LEDs light up when active, and the data lines and data valid lines light up at logic 0.
Digital output lines have an easier time sinking current than they do sourcing current. I could have added a bus driver and/or inverter, but in this case, a visual indication of the codes is sufficient. I can invert the logic levels in my head to verify the data values. It is binary where a lit LED represents an inactive logic 0 state.
A 2-to-4 wire circuit (also called a hybrid circuit) is used to turn the single full duplex two-wire telephone lines into two sets of two wires, one for transmit audio, the other for receive audio. The 2-to-4 wire circuit can subtract the transmit signal from the received signal to prevent or limit feed back and echo. The transmit signal is attenuated to limit output power to the telephone line. High frequency AC bypass capacitors and discrete filters can be used to clean up noisy signals. This functionality allowed older telephones to work without chips and semiconductors.
The Hybrid function was initially done using a clever passive technique that involved two transformers. (See Fig 6.) The signals buck each other to cancel out the unwanted signals. A resistive impedance balancing value is used to match to the transformer’s impedance.
Since semiconductors are lower cost than transformers (because of the copper), solid state circuits have been traditionally used to accomplish this 2-to-4 wire conversion. Op-amps are great for this setup because they have current limiting, short circuit protection, thermal shutdown, and quad packages.
One of the most popular public domain solid state hybrid circuits comes from an out of print applications data book from National Semiconductor, which provided a fairly common hybrid circuit for telephony engineers. (See Fig. 7.)
In our case, we have a center tapped transformer. I took advantage of it when implementing the audio stages in and out. My initial thought was to wire in a hybrid circuit that subtracted the transmit audio from the receive, and subtracted the receive audio from the transmit. After some consideration, I decided that I didn’t want to limit the possible functionality in any way. For example, you could use this circuit to turn old wireless phones into intercoms, remote controls, PA systems, or even wireless data links. How many old wireless phones do you have in your junk boxes?
In addition, multiple transmit signals can be routed to the output stages through analog switching or through Summing circuits made from op-amp. For example, a DTMF transmitter, a talking speech module, a modem, and an acknowledge beep tone can all be routed to the transmit stage and engaged as needed. Likewise, the pure receive audio stream can be buffered and applied to several different input circuits – like Caller ID, speakerphone, modem receiver, and handsets. If echo cancellation and feedback control are needed for a local function, such as a speakerphone, they can be implemented later.
The audio transmit signal is limited to a 5V swing since it is centered around the 2.5V VCC/2 DC reference. This limit provides enough level to hear an acknowledge tone. This signal is also good to allow me to test with the headphone outputs from most common audio sources. In my case, I will be using one channel of a stereo headphone output jack from an old boom box.
If you want to pump more audio power out, instead of using a unity gain non-inverting amplifier, the op-amps could provide gain and be run at 12V instead of 5V. In this manner, a beefier transmit signal can be sent out. The resistor based voltage divider reference would have to change from 2.5V DC to 6 VDC as well at the input of the op-amp. This is why I placed a redundant 2.5V reference instead of tapping off of the MT8870’s reference voltage pin.
Did you notice that there are 2 free op-amps available to use as you see fit?
Floor planning – An Addition
Since I have room on my perf-board, I will add these circuits to the prototype from part one of this project and wire directly to the header. I first update the floor planning placement diagram to include the new functions and connectors on the board. (See Fig. 8.) This also defines the signals on each connector.
Note how the two new 8 Pin SIP headers are 300 mils apart. This setup allows standard 16-pin debug header cables to connect board-to-board, or to solderless breadboards for prototyping.
I will be using sockets for the ICs on the prototype. This option is always a good idea when prototyping.
Constructing the Prototype
Instead of soldered breadboard circuit boards, I used generic perf-board and discrete wires for this design. This technique is harder, but it results in tougher and longer lasting boards.
I have found that the thin copper on many proto-boards shears easily if a board is stressed, and that can cause an intermittent fault – the worst kind. I have also seen the copper oxidize and deteriorate over time. If we are going to build something that we plan on using, it may as well last.
A PC board is the best solution. We will eventually have PC boards for making this and other projects more accessible to students, hobbyist and inventors. (Let us know if this is a board you would want.)
The female SIP headers I am using make good board-to-board connectors, but they are also ideal for test and debug. Small 24 gauge wires fit snugly into the receptacles, making it easy to probe with a scope or meter.
Eventually, I will mount this board in an enclosure, but for now it is a discrete prototype board, and treating it gently is important. With a little time and patience, I was able to add all the components and wire them together. (See Figs. 9 and 10.)
I always like to try and color code the wiring, but it’s easy to run out of colors pretty quickly on any large design. Generally, I use reds and oranges for power supply and blacks and browns for grounds. Blues and greens make good signal wires.
Notice that I did not wire the switched line telephone connector to the relay. I have no immediate plans to use this feature, and I could always add it if I did want it.
You may also notice how I create a little ground island from which all the grounds star outward. Instead of daisy chaining grounds, it is better to have them all common to a point. This way interconnect resistances don’t add ground error voltages cumulatively. I did the same with the 5V wiring, but it is more important to do with the grounds.
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