Telephone Exchange

Design Photos Schematics Back to projects

Introduction

This miniature, 8-line home telephone exchange (PABX) works with standard telephones and features high-quality, user-friendly progress tones. Connection to telephones is via a two-wire unbalanced loop with a common ground. Only pulse dialling is supported although the exchange could be adapted to use a DTMF tone decoder. Subject to local telecom regulations, an outside line could be connected. There is already a spare transformer winding which would be suitable for this. Connection of unapproved devices to the UK public telephone network is illegal.

History

I've been making telephone exchanges since I was 12 or 13. My dad brought telephones home from work for me. My first efforts were manual exchanges with some form of switchboard in my bedroom and extensions around the house. I wasn't allowed to install old telephones just anywhere so I had to put them in places like the garage and the shed.

An early attempt to make an automatic exchange using relays and a uniselector ended in tears. My first working exchange used reed relays controlled by a Commodore PET personal computer. I co-built another using CMOS bilateral cross-point switches as a 2nd year undergraduate project, and I designed a third for my final year project. My supervisor told me I couldn't spend the rest of my life designing telephone exchanges!

This is the first exchange I've designed in 17 years. My interest was re-kindled when I came across an article by L D Gunn in Wireless World of August 1980+. His ingenious "Miniature, ten-line telephone exchange" used only 22 relays. It was enhanced by J H Kuiper whose "16-line PABX with options" was published by Wireless World in four parts from November '83.     + See page 49 Sept '80 for corrections.

Other designs include: G F Goddard's "Miniature automatic telephone exchange" using relays and uniselectors, published in Wireless World Feb '72 with modifications by P F Gascoyne in April '72. Practical Wireless ran a design by J Thornton Lawrence using TTL logic and reed relays in Feb '75 with corrections in March '75 and modifications by G M Rossetti in March and August '76. The Maplin "Digi~Tel" by Robert Kirsch, using CMOS crosspoint switches, appeared in "Electronics" the Maplin magazine in September '82. Finally, Elektor published the "Microprocessor-Controlled Telephone Exchange" by A. Rigby in October '90 with corrections in January '91.

I was going to build a copy of L D Gunn's exchange until, whilst mulling over ways to replace some of the relays with opto-isolators, I discovered the variety of different opto-devices that are now available and had the idea of using opto-coupled triacs for switching. I also discovered the TLP598G "photo-relay" for which the manufacturer's data sheet lists telephone exchanges as one application. I used these and the more conventional phototransistor type opto-isolators in this design.

I always wanted to make a truly all-electronic exchange with zero moving parts. The challenge was that standard telephones require a high AC voltage for ringing. Most designs handle this by having at least one relay per line. This is a perfectly practical approach that I would probably take myself if I were designing a commercial product. The main advantages of opto devices are their reliability, small size, low cost and silent operation. The analogue circuitry of this exchange fits on a single eurocard.

Overview

The analogue circuitry comprises the following parts:

Call sensor

When the exchange is idle, power is applied to the call sensor via a TLP598G photo-relay. The sensor comprises 8 CNX35U opto-isolators - one for each line. When an extension is lifted "off-hook", its associated opto-isolator asserts a sense line. If only one sense line is asserted, the controller latches the binary code of the originating extension and initiates a call. The call sensor is powered-down until the end of the call.

Originating Loop

The calling line is connected to the originating loop by an opto-triac. Loop current flows through transformer T1 secondary, and through the CNX35U loop status opto-isolator which detects dialling pulses and, ultimately, hang-up.

A small time delay is allowed for things to settle down before dial tone is delivered to the caller via the primary of transformer T1. If the loop is not closed at the end of the time delay, the exchange reverts to the idle state.

Destination loop

The called extension is connected to the destination loop by an opto-triac. There are two paths through the loop: for DC only via transformer T2 and a TLP598G photo-relay; and for AC via the AC ringing generator and a TLP3043 opto-triac. The paths are switched alternately producing the required ring-ring effect interspersed with silence. The 598 and 3043 light emitting diodes are connected back-to-back as a safety interlock. The TLP3043 contains a zero-crossing circuit to ensure a clean switch.

Ring Trip

Ring trip

The ringing voltage applied to the line is that of the ringing generator plus a DC offset. The average voltage equals the DC supply. Only AC can flow during ringing because telephone bells are AC coupled. Answering creates a DC path through the telephone allowing DC to flow.

The 47-ohm resistor samples the line current. The voltage across it is low-pass filtered to attenuate the AC component. When the call is answered, the DC component operates the BC640 PNP transistor which asserts the Trip input to the controller. A high voltage PNP transistor is required. The BC640 has a VCEO of 80V.

Ring trip is an appropriate name for this circuit because it's quite critical in operation. Too much AC current, due to too many telephones connected in parallel across the same line, leads to false triggering. This is why BT approved appliances must quote a REN. This circuit was developed and tested with a 50Hz ringing supply. BT has an even harder job to distinguish DC from AC because they use 162/3Hz!

Transmission bridge

Transmission bridge

The secondaries of transformers T1 and T2, and the 2µ2 coupling capacitor form the transmission bridge. The transformers act as low frequency chokes, passing DC to the carbon microphones whilst presenting a high impedance to audio frequencies.

The transformers were salvaged from an old cordless telephone. Similar types can also be found in modems and other mains-powered telephone appliances.

The primary of T1 is connected to the tone generator. The primary of T2 could be used for an outside line facility.

Tone generator

The tone generator takes up approximately one quarter of the analogue board area. It was felt that high quality sinusoidal tones were worth having. Square waves and /or 50Hz mains hum sound unpleasant and are not user-friendly. This little exchange sounds like the real thing!

An LM324 quad op-amp generates three independent sine waves. The fourth amplifier is used as a supply splitter to generate a 2.5V virtual earth. Wien bridge oscillators are used with a simple diode shaping circuit to control the amplitude. The resultant harmonic distortion is minimised by adjustment of the presets and by subsequent low pass filtering.

The tones are coupled to the originating loop via transformer T1. An emitter follower drives the primary. The required tone combination is selected using a 4016 quad bilateral switch. To prevent clicks, the 2.5V virtual earth is connected in the gaps between rings. When all the switches are off, the emitter follower goes tri-state and thus does not load the speech path.

The frequencies are best adjusted using a frequency counter and oscilloscope. Adjust the frequency in small steps by alternating between the presets. Shift the frequency with one and then correct the shape and amplitude with the other. Keep each pair of presets at roughly the same resistance. Frequency accuracy of around 1% is easily achieved. The UK and US frequencies are as follows:

UKUS
Busy400 Hz
Engaged400 Hz
Ringing400+450 Hz440+480 Hz
Unobtainable400 Hz
Dial tone350+450 Hz350+440 Hz

UKUS
Tone 1350Hz350Hz
Tone 2450Hz440Hz
Tone 3400Hz480Hz

Short bursts of instability on the virtual earth are visible on an oscilloscope. I suspect the load is too capacitive for the LM324 as a unity gain follower. Looking like overly rounded CW envelopes; the bursts are low level and too high in frequency to be audible.

Controller

The controller, comprising 3 programmable logic devices (PLDs) plus discrete HCMOS, occupies an entire eurocard. RC delays and Schmitt triggers are used for timing. I would use a single chip micro-controller if I were making more than one of these!

The Atmel ATF16V8B PLDs were programmed using the Atmel version of WinCUPL downloaded from www.atmel.com for free.

The master PLD is a state machine with the following states:

Idle1117
Off-hook0113
Dial tone0102
Dialling0011
Ringing1106
Answered0000
Engaged1015
Unobtainable1004

The apparently random encoding is critical. ST_IDLE must be 7 because that is the power-on reset state. The other values were found (by trial and error) to make the design fit.

Although CUPL is a declarative language, the source code for the state machine looks almost procedural:

sequence State
{
  present ST_IDLE
    if !RESET & SEIZE next ST_OFF_HOOK;
    default next ST_IDLE out IDLE out TRIG;

  present ST_OFF_HOOK
    if RESET next ST_IDLE;
    if !RESET & TIMEOUT next ST_DIAL_TONE;
    default next ST_OFF_HOOK;

  present ST_DIAL_TONE
    if RESET # !B next ST_IDLE;
    if !RESET & B & !TIMEOUT next ST_DIALING out DIAL;
    default next ST_DIAL_TONE out DIAL;

  present ST_DIALING
    if RESET # !B next ST_IDLE;
    if !RESET & B & TIMEOUT & UNOB next ST_UNOBTAINABLE;
    if !RESET & B & TIMEOUT & !UNOB & ENG next ST_ENGAGED;
    if !RESET & B & TIMEOUT & !UNOB & !ENG next ST_RINGING;
    default next ST_DIALING out DIAL;

  present ST_RINGING
    if RESET # !B next ST_IDLE;
    if !RESET & B & TRIP next ST_ANSWERED out DEST;
    default next ST_RINGING out DEST;

  present ST_ANSWERED
    if RESET # !B next ST_IDLE;
    default next ST_ANSWERED out DEST;

  present ST_UNOBTAINABLE
    if RESET # !B next ST_IDLE;
    default next ST_UNOBTAINABLE;

  present ST_ENGAGED
    if RESET # !B next ST_IDLE;
    default next ST_ENGAGED;
}

append TRIG.d = B & !A;

This compiles to:

State0.d  =>
    RESET
  # !B & !State0
  # !B & !State1
  # State0 & State2
  # State0 & !TIMEOUT
  # State1 & !State2 & !TIMEOUT
  # ENG & State0 & !State1 & !UNOB
State1.d  =>
    !B
  # RESET
  # State0 & State1
  # State1 & !State2 & TIMEOUT
  # State1 & State2 & !TRIP
  # !ENG & State0 & !State2 & TIMEOUT & !UNOB
State2.d  =>
    RESET
  # !B & !State0
  # !B & !State1
  # !State1 & State2
  # !SEIZE & State0 & State2
  # State0 & !State1 & TIMEOUT
  # !State0 & State2 & !TRIP

DIAL and DEST are asserted in if and default clauses so that they don't suffer a one-cycle dropout on state changes. The append statement routes dialling pulses to the TRIG output to clock the 74HC191 counter and re-start the timer. This causes a change of state from ST_DIAL_TONE to ST_DIALING. The timer is re-triggered by each dialling pulse. Timeout occurs at the end of dialling.

Timing

The next state may be ringing, engaged or unobtainable. The number dialled is compared with that of the originating extension to detect engaged; '9' and '0' are unobtainable. The counter starts at 11112 so the final count is one less than the number dialled.

The slave PLD controls tones and ringing. The rate or "urgency" of the ring is controlled by an adjustable low frequency Schmitt trigger oscillator. The ring pattern repeats every 16 cycles:

4 cycles1 cycle3 cycles8 cycles
RingPauseRingPause

The PLD source and compiled JEDEC files are available for download here:

16V8.MASTERState machinePLDJEDEC
16V8.SENSECall sensorPLDJEDEC
16V8.SLAVERinging / TonesPLDJEDEC

TLP598G "Photo-relay"

TLP598G

This device contains a pair of optically controlled N-channel MOSFETs, joined at the source, with reverse backing diodes. The drains and the common source terminal are externally accessible. In DC circuits, the FETs can be connected in parallel to increase current handling capacity by joining the drains. The device is connected into AC circuits by the drain terminals only. AC current flows through one FET and one diode at a time.

See also