This is only a preview of the Electronics TestBench issue of Silicon Chip. You can view 34 of the 128 pages in the full issue, including the advertisments. For full access, purchase the issue for $20.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).
Silicon Chip’s Electronics TestBench 47
48
+50V
+50V
Silicon Chip’s Electronics TestBench
L""
I
--------1
C Q9
D3
PNl00 1N4007
.,.
~VAC
~
R21
560n
I
RLYl _ _ _ _ _...;..:.::....:....._,..
~12v
DPDT
I
--~ I
+12V
.,.
TIP
01
■■
ZD2
11VlJ
TRANSFORMER
I
I
C4
2.2
R17
560n
JI
DPDT
R16
560n
J4
1c
D4{t)
~I
- -
- -
QS
PNl00
Q2
Q4
PNl00
PNl00
.,.
.,.
.,.
D6
+sov
TONE VOLUME
VRl
220k
+12V AUDIO
,
C22 +
1000 •
63VW+
Q6
J3
1
82:=II]
-~
.c¼
":" 4
i;
RS
C13
10kt, 0.1
;J~io
SPl
+12v-~
•&&&
VR2
100k
.,.
Cll
220pFI
car-
T
T
T
6
4
C12 .&.
":"
--------------;..;;.i2
47+
2
INT
20 PAO
22 PA2
24 PA4
13
6
17
TMR/
BT
T
TOUT I
C19.&. C27 ii
XEN
~I_ 1O.lI
7
.___ _ _-'-IAIN
_
12
.
.
DV
XO 9
,---------------1Dl
IC3
Rll
X2
. - - - - - - - - - - - - - - 1 3 EN MC145436
lM 3.58MHz
.----'-14""' D4
XI 10
112 18
PB0 PC0
]l DS
l D2
":"
+5V
+5V
I c2s J.i ~
CU
470
0.l +35VW-.,.
rCo ' ~..~OLUME
f
8
.,.
Tu~
C24 +
470 •
35VWi
D12
.,.
D2
1N4007
1N4007
+12V AUDIO
100
1 14 1 ,
i
47 _
.
.,.
J
~ f
-C30 +
470 •
35VWi
Dl
. 1N4007
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
Silicon Chip’s Electronics TestBench 49
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
50
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,
Silicon Chip’s Electronics TestBench
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.
Silicon Chip’s Electronics TestBench 51
Professional Telephone Test Equipment
LB200 phone
test set.
LB100 phone
test set.
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.
Relay driver
►
One of the side-benefits to the
deregulation of the Australian telephone industry is increased access
to installation, service and maintenance work for approved personnel.
However, the availability of suitable
equipment has sometimes been a
problem.
A Brisbane company, Telephone
Technical Services, recognised the
TG100
tone generator
52
TG100 ►
tone tracer
need for a range of high-quality telephone and line test equipment and
is now importing the US-made “TestUm Inc” range.
Of particular interest are the phone
test sets (called “butt phones”)
which offer a broad range of testing
facilities. There are two in the range,
the “Lil’ Buttie” LB100 and the “Lil’
Buttie pro” LB200.
The big difference between
the two is an LCD panel on
the Pro model which reveals
even more information about
the line under test, including
on-hook voltage, off-hook
current, the number dialled,
stored numbers, setup and
call waiting information and
even call ID information.
Other equipment in the
Test-Um range includes the
TG100 tone generator, the
TT100 tone tracerm the
TP100 “Tell-All” tester for
both phone and data lines,
and similar devices.
For further inforrmation, contact Telephone
Technical Services on (07)
3286 6388, fax (07) 3286
6399, or visit their website
at www.ttservices.com.au
(see advert page 55).
Silicon Chip’s Electronics TestBench
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.
Tone injector
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.
DTMF detection
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.
Silicon Chip’s Electronics TestBench 53
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
54
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
Silicon Chip’s Electronics TestBench
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.
|