This is only a preview of the February 1998 issue of Silicon Chip. You can view 29 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Multi-Purpose Fast Battery Charger; Pt.1":
Items relevant to "Command Control For Model Railways; Pt.2":
Items relevant to "Demonstration Board For Liquid Crystal Displays":
Items relevant to "Build Your Own 4-Channel Lightshow; Pt.2":
Articles in this series:
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
This 2-line Telephone Exchange Simulator can be used to test
telephone handsets, fax machines, modems, answering machines
and other telephone equipment such as diallers on burglar alarms.
It contains the all the circuitry necessary to accept decadic (pulse)
or DTMF (tone) dialling.
Telephone Exchange
Simulator For Testing
Have you ever wanted to test the modem
section on a piece of electronic equipment
but were unable to afford the luxury of a
small PABX? Or are you in the production
side of electronics and need to simulate a
telephone exchange to test the finished
product? Well, this Telephone Exchange
Simulator can overcome these problems.
By MIKE ZENERE
Testing faulty or new pieces of tele
phone equipment over the switched
network is illegal and can incur
large fines if you are detected. Best
not to do it. What you really need is
a test box which can automatically
detect decadic or tone dialling and
can display the progress of a call via
LEDs on the front panel. The unit to
be described can also be an interface
between your fax machine and PC,
enabling you to scan in documents
or pictures.
Modems and faxes present a real
problem if you want to test them.
Say you have a fully approved and
working modem or fax and you want
to test it out. Sure, you can legally
test them over the phone lines but
you need two phone lines to do it and
that’s not always easy. It might be easy
enough if you have two lines coming
into your residence but if yours is
a commercial organisation, getting
access to telephone lines which are
already connected to your PABX is
not convenient or legal either. So this
Telephone Exchange Simulator fills a
real need.
The Telephone Exchange Simulator
is housed in a plastic instrument case
and has a telephone socket on each
side. You can connect two telephone
handsets and place a call between
them, in either direction. The phones
can use either decadic (ie, pulse) or
tone (DTMF) dialling and the unit
will automatically detect either mode.
In the following example, a tele
phone will be used to illustrate the
call procedure but it could be any sort
of appliance that might use the public
switched telephone network (PSTN).
February 1998 25
26 Silicon Chip
Fig.1 (left): the heart of the circuit is
the 68705P3 processor which controls
all the phone functions apart from
DTMF decoding which is done by IC3.
A call is made in this way: lift the
handset of one telephone and listen
for dial tone. At this point both the
LOOP LED and the DIAL TONE LED
should be on, signifying that a call is
in progress. Also an audible sound
should be heard from the internal
speaker. Start dialling, noticing that
the dial tone disappears and either
the DTMF LED or the LOOP LED are
flashing, in accordance with the digits dialled. If the exchange receives
a correct number, ring tone will be
heard in both the speaker and the ear
piece as well as an audible ringing of
the phone.
If the called phone is answered, the
second LOOP LED and the CONNECT
LED will light, showing that the call
is connected. A speech path is now
formed from one telephone to the
other.
This simple test procedure will
not only enable you to test typical
telephone handsets but it is also very
useful for testing cordless phones.
And as already noted, it will let you
test fax machines and modems and
answering machines too.
Some useful terminology
Listed below are some terms that
may be useful:
On hook: the telephone receiver is
on the phone and the phone is disconnected from the line.
Off hook: the telephone receiver is
off the phone and the phone is connected to the line.
Dial tone: the sound you hear when
you first pick up the receiver before
you start dialling.
Ring tone: the sound you hear when
the exchange is calling the other end.
Busy tone: the sound you hear when
you have called the other end but their
phone is in use.
No progress tone: the sound you
hear when the wrong number has
been dialled.
How it works
Fig.1 shows the complete circuit of
the Telephone Exchange Simulator.
At the heart of the circuit is IC1, a
February 1998 27
Where To Buy A Kit
A complete kit of parts for the Telephone Exchange Simulator is available
from the author who owns the design copyright. This kit includes all components, including the programmed microprocessor, transformers and case.
The price is $190.00 plus $8.50 for postage and packing. If the documented
source code is required on disk, please add a further $20.00.
Please make payments (Postal Orders only) payable to M. Zenere, 1/83
Headingley Road, Mt. Waverley, Victoria 3149. Telephone (03) 9806 0110.
Also available is a kit for the Magnetic Card Reader featured in the January
1996 issue of SILICON CHIP. The Card Reader can store up to eight magnetic
cards in memory and can be used as a door lock. The kit price is $68.00
plus $7 for postage and packing.
68705P3 single chip microcontroller.
This device is a complete computer
on a chip and controls the entire exchange simulator.
This device is somewhat old now
but as they are in plentiful supply
and fulfil the requirements of this
project, they were used. A review
of the functions of the 68705P3 was
featured in the September 1992 issue
of SILICON CHIP.
Another key feature of the circuit
is the two Line Loop Detectors, comprising zener diode ZD1, diode D9
and transistor Q8 for the first detector
and ZD2, D13 and Q9 for the second
detector.
Line loop detectors
Line loop detectors are the curse
of the telephone exchange designer
and at first glance these two line
loop detectors may appear to be quite
simple but the amount of design time
and testing that went into this part
of the circuit was enormous. In fact,
more time was spent getting this part
of the circuit to work properly than
was spent on the rest of the project,
including writing the article.
The line loop detectors are used
to sense a low resistance loop in the
line; eg, someone has lifted a handset.
It was decided that a loop current
of 20-25mA minimum would be
required to cause the Simulator to
accept that a call was being made.
Looking at the line one circuit, we
can see that the basic telephone circuit is made up of +50V, resistor R15,
RLY2 contacts, the telephone handset
itself, RLY2 contacts, resistor R17 and
ground. With the telephone on-hook,
the line appears as an open circuit to
the exchange and as such, no voltage
28 Silicon Chip
is developed across R17.
When the telephone handset is
lifted, a low resistance loop is placed
across the TIP and RING of socket
J1 and as current flows through the
loop, a DC voltage is developed across
resistor R17. Just how much voltage
depends on the type of telephone,
modem or whatever is making the call.
But in any case, we need to produce
around 12V across R17 to get our 2025mA flowing through the circuit.
When the voltage across R17 reaches or rises above this level, the loop
detector comes into play. Zener diode
ZD2 conducts via diode D13 and feeds
current into the base of transistor Q9
to turn it on. This pulls pin 23 of IC1
low, which signals to the processor
that a call is under way.
“So what’s so hard about loop detection?” you may ask. Well not much
at this point but let’s go to the other
end where after the correct number
has been dialled by the calling end,
bursts of 50Hz ring current are fed out
to the called telephone.
The exchange is now in calling
mode and is sending bursts of 50Hz
at 200V peak-to-peak imposed on
50V DC at one instant and then in the
next, is sending 50V DC to line. This
means that at any time the called end
answers the call, the telephone may
be seeing anything between +150V to
-50V in the ring cycle or straight 50V
DC. In any case we want the exchange
to answer the call within a short time
and to turn off the ring current.
To help with the explanation, let’s
divide this up a bit.
Case 1: Relay RLY4 is not operated
as we are between ring bursts, thus we
are sending 50V DC to line. The circuit
path is now +50V, R16, RLY4 contacts,
the telephone, RLY4 contacts, resistor
R21 and ground (ie, 0V).
No current flows in the loop until
the telephone is answered at which
point more than 12V appears across
resistor R21. This causes zener diode
ZD1 to conduct via diode D9, causing
base current to flow into transistor Q8
which now turns on. This pulls pin
22 of IC1 low; the processor is now
signalled.
Case 2: Relay RLY4 is operated as
we are sending ring current to the
line. The circuit path is now +50V,
ring transformer T1, RLY4 contacts,
the telephone, RLY4 contacts, resistor
R21 and ground.
Remember, at this point the tele
phone is unanswered but a capacitor
in the phone passes the AC to the
bells or ringer and causes voltage
fluctuations across resistor R21. These
may well be enough to turn on the
line loop detector if the voltage rises
above +12V, causing the exchange to
think the phone has been answered.
This is where the problem lies, as
how can the exchange tell if the call is
being answered or it is being tricked
by the ring current? The answer lies
in the software.
Let’s assume that the capacitor in
the phone is quite large and is causing
a 50Hz AC signal to appear at the line
loop detector. This in turn is causing a
signal to be sent to the processor. Anything above 12V will cause the line
loop detector to be on and anything
below 12V will cause it to be off.
As the 50Hz AC ring signal is symmetrical, the line loop detector will be
on for less time than it is off. How can
this be? Well, a complete cycle takes
20ms so each peak is active for 10ms.
This would normally send a square
wave to the processor but as we need
to reach +12V before the loop detector
operates, the signal to the processor
now has a longer on time than off time.
When the call is answered, the line is
biased positive by the +50V rail on
one side of transformer T1.
This has the effect of lifting the
line DC potential and causing the line
loop detectors to be more on than off.
The signal to the processor now has a
longer off time than on time. During
the calling cycle the processor is doing
what we will call a data acquisition
on its associated line loop detector
port pin. In this case, line two’s line
loop detector is being read by the
software at 800 times a second and
a record is kept of its on and
off times. This information is
sent through a subroutine in
software and if the conditions
are right the call is deemed to
be answered.
Power supplies
The Telephone Exchange
Simulator requires five different supply rails to work
properly and these are derived mainly from a 12V AC
transformer. The different
sections are described below.
The logic side of the board
draws around 150mA and
its 5V rail is derived from
the 12V secondary winding
using a half-wave rectifier D1
and a 2000µF filter capacitor
C26. This feeds 3-terminal 5V
regulator REG1.
There are two 12V supplies
one of which powers the
audio section of the circuit
involving dual op amp IC2
while the other 12V rail
powers the relays. Separating
the relay circuitry from the
op amp section helps reduce
noise and distortion.
The first 12V source is
derived via diode D2 and capacitor C30, while the second
12V rail source is derived
from diode D1 and capacitors
C25 and C14.
+50V supply
Three diodes, D6, D7 &
D8 and three capacitors C22,
C23 & C24 make up a voltage
Fig.2: the component layout of the PC board. The LEDs are bent at rightangles to
tripler from the 12VAC and
protrude through the front panel.
this produces around 50VDC.
This voltage is used to drive
the telephone handsets and
provide our speech path to the other will stop sending ring current in a
When the processor is running
end.
very short period. The two line re- properly, it toggles its EXCHANGE
lays RLY2, and RLY4 were needed to
OK port pin every second or so which
200V supply
totally isolate the high voltage from
temporarily turns on transistor Q5 and
The voltage to ring a standard issue
the rest of the circuit.
discharges C15.
Telstra phone is quite high and conWhile C15 is unable to charge via
Watchdog circuitry
sidering a customer could be over 4km
R18 and R26, the output of the 555
from the exchange a voltage of 200V
timer stays high, allowing the proThe watchdog circuitry is used to
peak-to-peak (70V RMS) is required. prevent the processor from “locking cessor to continue normal operation.
The simplest way to provide this is up” and thereby causing the unit to If the program were to lock up, Q5
to use a step-up transformer fed from
become inoperative. The circuit em- would remain off and allow C15 to
6VAC.
ploys a 555 timer IC4 which is used in charge thus switching pin 3 of the
Notice that one side of the output an astable mode to reset the processor.
555 low. The reset line of the prowinding is tied to +50V DC so that If allowed, IC4 would oscillate at a cessor would now be pulled low via
if the called end is answered in the
frequency of about 0.25Hz, as set by diode D11 and is held low until the
middle of a ring burst, the simulator
555 changes state. At this point the
the values of R18, R26 and C15.
February 1998 29
processor starts again and continues
its pulsing of its port pin.
Audio monitoring
When testing equipment, it is useful
to hear what is being sent from the
calling end or even from one caller to
another. With DTMF dialling, tones
are sent from the telephone to the
exchange and are decoded by a special
chip. If you suspect your telephone or
modem is not sending DTMF you will
be able to pick it up.
Capacitor C18 is used to provide
DC isolation between op amp IC2b
and the external telephone circuit.
When an AC signal appears (due to
DTMF, tones or voice) across C18
they are amplified by IC2b. This op
amp drives a complementary output
stage consisting of transistors Q6 &
Q7 and these drive the loudspeaker
via coupling capacitor C28.
SILICON CHIP SOFTWARE
Now available: the complete index to all
SILICON CHIP articles since the first issue
in November 1987. The Floppy Index
comes with a handy file viewer that lets
you look at the index line by line or page
by page for quick browsing, or you can
use the search function. All commands
are listed on the screen, so you’ll always
know what to do next.
Notes & Errata also now available:
this file lets you quickly check out the
Notes & Errata (if any) for all articles published in SILICON CHIP. Not an index
but a complete copy of all Notes & Errata text (diagrams not included). The file
viewer is included in the price, so that you can quickly locate the item of interest.
The Floppy Index and Notes & Errata files are supplied in ASCII format on a
3.5-inch or 5.25-inch floppy disc to suit PC-compatible computers. Note: the File
Viewer requires MSDOS 3.3 or above.
Relay driver
❏
Floppy Index (incl. file viewer): $A7
❏
Notes & Errata (incl. file viewer): $A7
❏
Alphanumeric LCD Demo Board Software (May 1993): $A7
❏
Stepper Motor Controller Software (January 1994): $A7
❏
Gamesbvm.bas /obj /exe (Nicad Battery Monitor, June 1994): $A7
Under normal conditions the processor’s port pins are low, thereby
leaving the relay driver transistors in
the off state. When the processor wishes to enable a relay its associated port
pin goes high and causes base current
to flow to the transistor which turns
on to operate the relay. The diode
across each relay coil prevents any
spikes from damaging the associated
transistor when it turns off.
❏
Diskinfo.exe (Identifies IDE Hard Disc Parameters, August 1995): $A7
Tone injector
❏
Computer Controlled Power Supply Software (Jan/Feb. 1997): $A7
❏
Spacewri.exe & Spacewri.bas (for Spacewriter, May 1997): $A7
❏
I/O Card (July 1997) + Stepper Motor Software (1997 series): $A7
ORDER FORM
PRICE
When making a call, certain tones
are sent to the calling end to inform
the user as to what’s happening; eg,
ring tone, busy tone or no progress
tone (wrong number). The tones are
injected in the following way. One
port pin is used to try and reproduce
all of the tones required. This process
comes pretty close to doing what we
want.
IC2a is configured as an amplifier
with its gain set by trimpot VR1 and
resistor R10. The signal waveform
from the processors is rounded off by
R32 and C6 and it is then coupled by
C29 to the op amp which amplifies it
and sends it out to line via R13 and C7.
POSTAGE & PACKING: Aust. & NZ add $A3 per order; elsewhere $A5
Disc size required: ❏ 3.5-inch disc
❏ 5.25-inch disc
TOTAL $A
Enclosed is my cheque/money order for $A__________ or please debit my
Bankcard ❏ Visa Card ❏ MasterCard
❏
Card No.
Signature_______________________________ Card expiry date______/______
Name ___________________________________________________________
PLEASE PRINT
DTMF detection
Suburb/town ________________________________ Postcode______________
Send your order to: SILICON CHIP, PO Box 139, Collaroy, NSW 2097; or fax your
order to (02) 9979 6503; or ring (02) 9979 5644 and quote your credit card number
(Bankcard, Visa Card or MasterCard).
30 Silicon Chip
✂
Street ___________________________________________________________
DTMF (dual tone multi frequency)
detection is done using IC3, a Motorola MC145436 tone decoder which
receives the incoming tones via a
filter network comprising resistors
R12 & R14 and capacitor C11. When
Inside the Telephone Exchange Simulator. Note that the PC board and wiring
layout of the prototype pictured here has been fairly significantly modified in
the final PC board depicted in Fig.2.
a valid tone is detected the DV line
(pin 12) of IC3 goes high, signalling
to the processor that a digit is being
pushed. At this point the processor
enables the decoder’s output pins by
taking the EN line high (pin 3) and
reads in the data.
Assembly procedure
Most of the circuitry of the Tele
phone Exchange Simulator is accommodated on a PC board measuring
161 x 128mm. The components off
the board are the power transformer
and speaker.
By the way, the prototype shown in
the photos has undergone a number
of fairly substantial changes so the assembly notes apply only to the circuit
of Fig.1 and the PC component layout
of Fig.2. Note also that the prototype
photos show two power transformers
inside the rear panel but the final ver-
sion uses just one power transformer.
You can begin the PC board assembly by mounting the four standoffs,
one on each corner of the board. Next,
all of the resistors, links relays, diodes
and capacitors can be soldered in.
Screw the 7805 regulator to the heatsink with the screw, washer and nut
provided and solder this into place.
The remainder of the components,
with the exception of the ICs can then
be mounted.
This done, mount the two telephone sockets and transformer and
glue the speaker onto the side of the
case with some silastic.
You will need to drill holes for the
mains fuse and cordgrip grommet for
the mains power cord. The mains wiring can be run, taking care to insulate
with heatshrink any exposed termi
nals. Don’t forget to attach the earth
wire to a solder lug separately bolted
to the case rear panel. An earth wire
should also be run from this point
to a solder lug securely bolted to the
front panel (not shown on photo of
prototype).
Temporarily connect up the sockets, speaker and transformer with
longer pieces of wire to enable you to
test the board out of the case.
Testing
Before proceeding, it is well to note
that although the ring transformer (T1)
looks fairly insignificant, it puts out
quite a bite if you get caught across its
output. I found this out the hard way!
Without any ICs plugged in, turn on
the power and check voltages around
the board, especially the supply rails
to the processor. If all is OK, turn off
the power and plug in the ICs. Turn
on the power again and use a small
screwdriver to short out the TIP and
RING connectors of each telephone
line in turn. Each time you do so,
the LOOP LED for that line should
come on.
February 1998 31
Use cable ties to neatly secure the wiring and insulate the terminals of the
fuseholder with heatshrink tubing, to prevent accidental contact with the mains.
Be sure to earth both the front and rear panels of the case (see text).
Plug a phone in at each end and lift
one of the receivers. Listen for dial
tone and use trimpot VR1 to set the
tone to the desired level. If the tone
level is too high, you may swamp the
DTMF from the phone, causing the
Exchange to miss any dialled digits.
Also at this time use the volume
control (VR2) on the front panel to set
the volume coming out of the speaker.
With the receiver off hook, hit some
of the keys on the telephone and listen for tones through the speaker. If
all seems well, you can shorten the
wires and solder them to the posts. If
you have connectors that are spaced
at 0.1 inch you can use these instead
of hard wiring.
Storing a telephone number
As this is a two-line telephone exchange simulator we need a telephone
number for each end. These are stored
in the serially fed EEPROM, IC5. Pick
up one end and wait for dial tone. Hit
*6805 and wait for two beeps before
32 Silicon Chip
dialling in your telephone number of
up to 20 digits in length. When this
is done, hit the # button to terminate
and wait for two beeps. You have
now programmed that extension with
its own number. Do the same for the
other end and yes, you are allowed to
have the same number at both ends.
Detailed talk-through
For this procedure we’ll assume a
phone is plugged in at each end.
Lift the handset for line one. This
causes a voltage of more than 12V to
appear across the line loop detectors,
thus signalling the processor.
The exchange now realises that
you want to make a call so it switches
RLY1 over and starts injecting Dial
tone out through its port pin, through
op amp IC2a where it is amplified,
through RLY1, through C1 and out
to the line.
At the same time, the tone is also
fed to op amp IC2b via C18 and R27
where it is amplified and buffered by
transistors Q6 & Q7. This audio is now
heard through the speaker. The user
starts dialling and the tones are passed
by C1 back through RLY1, through C10
and the filter network to the DTMF
decoder, IC3. Once a tone pair has
been recognised, DV (pin 12) on the
MC145436 goes high, signalling to
the processor to get the data in. The
digit is retrieved and stored until the
whole number is complete or until
it gets a wrong digit, at which time
the “No progress” tone is sent back
to the caller.
Once the correct number has been
loaded, the exchange starts toggling
RLY4, causing bursts of ring current
to be fed out to line. Also ring tone is
sent back to the user to indicate what
is happening. If the second phone is
answered, the line loop detector signals to the processor to stop sending
ring current and RLY4 remains in its
normal state.
The ring tone is stopped and RLY3
operates, causing a speech path to be
established. The call is now complete.
During the progress of the call the
LEDS on the front panel will be operSC
ating to indicate the progress.
|