Microcontroller-Based Telephone Exchange
Microcontroller-Based Telephone Exchange
60
World Academy of Science, Engineering and Technology 46 2008
A. Overview of the Microcontroller-Based Telephone Most of the telephone exchange systems are implemented
Exchange System with phone line interface module design. In this paper, line
This paper demonstrates the eight line telephone systems driver and switching circuit will be used which has eight
with full signaling and switching functions similar to those of internal phone lines. The executed programs of this paper are
the central office systems. The eight telephones are connected the technical features, the hardware design and the control
to the switching devices and common line. In microcontroller software of telephone exchange system.
system, PIC16F877A microcontroller is utilized to control
tone control, ring relay and on/off-hook switch when the II. BORSCHT FUNCTIONS
telephone is used. Tone generator is used to get dial tone, busy
tone, and ring tones. Ringing is generated at the receiving end B: Battery - 48V central office battery supplies DC loop
of the phone being called. Ring relay is used to get tone and current (about 40 mA) to energize the voice transmitter and
ring processes. DTMF is the basis for voice communication the outgoing signal circuit. The battery feed must provide the
control. Each number consists of a combination of two following for the local loop:
frequencies. DTMF decoder converts the DTMF tones to the 1. Power (typically 48V DC) to the subscriber’s
binary numbers and sends to the microcontroller. telephone set
In the signaling and switching system, transistors and relays 2. The capability to allow signaling to and from the
are used to switch audio signals and control signals and to telephone set
decode the DTMF signals. These switches are controlled by 3. Low DC resistance
powerful software procedures to be implemented. 4. High AC impedance
Battery feeds are 24V DC for telephone operation, 90V AC O: Overvoltage protection - Bypassing or fusing or a
for ringing and 5V DC for microcontroller, DTMF receiver combination to prevent damage from lighting, power line
and decoder. DC power supplies are needed mainly to produce induction, or accidental power line contact.
the large voltages required to power the phone during normal R: Ringing -Ringing is often provided by means of a
operation. dedicated ringing generator that is connected onto the loop by
means of a relay. It is possible to generate ringing voltages at
the line interface if the current generators have a high enough
voltage source available to them. Or alternately, a switching
PHONE
converter with step up capability can be place on the interface.
PIC 16F877A
MICRO SWITCH
NUMBER
Connection of the AC ringing signal to the loop for outgoing
CONTROLLER 1 TO 8 signaling (typically about 90V at 20Hz, interrupted for 4s of
1 TO 8
every 6s).
S: Supervision - Detection of loop current to signal
demand for service (or off-book), termination of connection
(or on-hook), and dial pulsing of routing codes for setting up
the switches along the route (or detecting the same as outputs
of a multi-frequency Touch Tone signaling unit).
C: Coding / Decoding - Provision of the PCM CODEC
functions for connection to a digital switching system (only
provided in recent digital switching machines).
H: Hybrid - Two-wire to four-wire conversion before
COMMON LINE
61
World Academy of Science, Engineering and Technology 46 2008
A. Power Supply
In most power supply applications, the standard 60Hz AC Fig. 3 Output Voltage of Pi Low-Pass Filter
power line voltage must be converted to a sufficiently constant
DC voltage [6]. In Fig. 2, the output of a bridge rectifier must If the ripple voltage is calculated, this formula can be used.
be filtered to reduce the large voltage variations. The capacitor
filtered the output of the bridge rectifier. The filtering concept
Vr = Io (1)
showes a nearly smooth DC output voltage from the filter. The 2 fC
small amount of fluctuation in the filter output voltage is
called ripple. where Vr is the ripple voltage in Volts, I is the current taken by
In this paper, there are three kinds of power supply: 5V DC the circuit in Amps, C is the value of the smoothing capacitor
for microcontroller, DTMF and switching devices 24V for in Farads, and f is the frequency of the peaks from the full-
telephone operation and 90V for ringing. wave rectifier, in Hertz. This frequency will be double the
normal mains frequency, i.e. 100Hz in the case of the UK
mains supply, or 120Hz in the case of the US mains supply.
62
World Academy of Science, Engineering and Technology 46 2008
impossible to use more than 4700µF capacitor, pi low-pass circuit, transformer center tap is kept 12V DC is got because
filter is used in this circuit. of the bridge rectifier. 12V DC is reduced by using transistor
Q1. Q1 acts as a voltage follower. Q1 base is stabilized by
using 6.2V zener diode. Q1 emitter is 12-6.2 = 5.6V. Zener
diode is used with a transistor because sufficient current is
needed. If only zener diode is used, the current is not enough.
C5 and C6 are reduced the output ripples from 12V. Diode D7
protects the transistor from the reverse current that emerges
from logic circuit. 0.6V is reduced and the output voltage is
Fig. 4 RC Filter Circuit got 5V passing through diode D7. 5V is supplied the
1 microcontroller 16F877, DTMF MT8870D and switching
j 2∏ fC devices. Using 5V zener diode regulator is cheap.
vo = vi ∗ [ ]
R + j 2∏ fC
E. Powering the Telephone
= vi ∗ ( 1 )
1 + j 2∏ fCR Telephones require large DC voltages for standard
operation. When a phone is in the on-hook state (receiver in
vo = vi ∗ ( 1 ) (2) cradle) the required voltage is 24V DC. This is said to be
2
1 + ( 2∏ fCR ) called the idle voltage. When the phone is in the off-hook state
(receiver has been picked up) the required voltage is 12V DC.
In this equation the more the frequency, the less the output When the phone is on-hook no DC current actually flows.
voltage. DC current is needed but noise frequency is 100 Hz This is because the only circuitry connected to the line is the
that is twice of the line frequency. ringer circuitry, which includes a capacitor. The capacitor will
C1 and D5 are used because AC for ringing and DC for only allow AC signals to pass through such as the ringing
telephone operation are used together. When AC converts to signal.
DC, ripples are appeared. C1 reduces the output ripples from When the phone becomes off-hook the resistance of the
the bridge rectifier and low pass filter reduces the output whole phone circuitry was found to be 600Ω. Once off-hook,
ripples again from C1. This circuit is called pi-filter. R3 DC current can now pass through the phone.
(470Ω/1W) limits the current that draws the telephone. D6
protects the circuit from the reverse current. In this paper, R1,
C2 and C3 act as a pi low-pass filter, to eliminate harmonics of
the supply frequency.
63
World Academy of Science, Engineering and Technology 46 2008
64
World Academy of Science, Engineering and Technology 46 2008
I. Generation of Progress Tones RA0:RA3. The microcontroller needs to send DTMF tones to
A Telephony network needs a system whereby users can be the telephone line. RA0:RA3 read or write binary number
informed of the current state of their telephone. Signals such while decoding tones. RB1 bit is configured as input pin from
as dial tones, ring tones and busy tones do just this. Without on-hook and off-hook the phone line. The microcontroller uses
these signals the user can be left wondering if the network is RB0 bit to scan 25HZ ringing signal. RB2 is used to control
even responding to their requests. the ring relay. The common line of relay contacts relay pin 4,
ring tone can be heard. RB4 is utilized to control the tone
J. DTMF Detection generator. PORT C is just used to know which phone is using
DTMF deals with interpreting which buttons on the with LED signals. PORT D is used to sense the eight phones.
telephone the user presses. When a button is pressed on a
phone, a signal representing that button can be transmitted. IV. SOFTWARE OF THE SYSTEM
This design will be based around only interpreting DTMF The firmware program for the microcontroller is compiled
tones. The telephone exchange system needs is a DTMF with the CCSC Compiler Tool suite version 8.02 from HI-
detection system. TECH Software. The source code is written in the MPLAB
The circuit connects to the phone’s audio line via a IDE version 7.5 from Microchip Corporation.
capacitor, which is used to block any DC current from going
to the DTMF receiver IC. The DTMF tone was received. The
circuit when tested was able to detect all DTMF tones and
handle a tone separation as small as 90 ms.
When a button is pressed on a phone, key frequency passes
through C10 and R24 to DTMF. The input tone signal is
decoded by the DTMF decoder and the decoded number can
be read by the PIC at D0-D3 output pins. There is no tone
signal, the output is ‘0’. If key ‘1’ is pressed, the output is
‘0001’. PIC microcontroller knows which number is pressed
by scanning the output from DTMF decoder.
65
World Academy of Science, Engineering and Technology 46 2008
V. IMPLEMENTATION OF STATE CONTROL SYSTEM time because only one common line is used. If two pairs are
Firstly, when the telephone is off-hook, a signal is sent to used, two common lines must be used.
the microcontroller which the microcontroller understands to
receive the phone number and the first digit is dialed. The first
digit is internal code (*). When the code is dialed, the
microcontroller knows whether the code is correct or wrong. It
begins the routing process. If internal key (*) is received, the
number the user want to call is entered. When the number is
correct, the call progress starts. If there is invalid code or
invalid phone number or idle called phone or self call, busy
tone will be heard. In call progress state, there are four sub
states: tone wait, tone generate, ring wait and ring generate. If
the called phone is off-hook, success state begins. If the caller
phone is on-hook in any state, the state must be idled and if
the time is out, the busy tone will be heard.
TABLE I
PHONE STATE REQUIREMENTS
Phone
State Ring Generated Tone Generation
Connection
On Hook Ring Circuitry No No Tone
On Hook -
Ring Circuitry Yes No Tone
Ringing
Off Hook Audio Circuitry No No Tone
Off Hook-
Audio Circuitry No Dial Tone
Dial
Off Hook-
Audio Circuitry No Busy Tone
Busy
Off Hook-
Audio Circuitry No Ring Tone
Ring
Off Hook-
Audio Circuitry No No Tone
Connect
VI. CONCLUSION
The design concept for the microcontroller-based telephone
exchange system has been defined.
The telephone exchange system demonstrates call switching
concepts. In this paper, 220V transformer steps down to 90V,
50Hz. It is not a standard design but useful. 24V DC is
Fig. 11 State Chart of the Control Program
employed for telephone operation because telephone
exchanges are used only for the surroundings, buildings and
ACKNOWLEDGEMENT
offices within 500 yards and 24V DC is for low power
consumption. But 48V DC can be used for long distance. 5V We would like to thank U Kyaw Zwa Soe, U Aung Aung
zener diode voltage regulator is applied because it is enough to Thein and Dr. Win Aye for their comments on the early drafts
operate and the required current is not more than 1A. of this paper. We would also like to thank the referees for their
Instead of using ready made tone generator IC, oscillator help in improving the clarity of the presentation.
based tone generator is used. Hence, there is no need to spend
the foreign exchange. Continuous tone is dial tone, discrete REFERENCES
tone (2 second on/off alternatively) is call progress tone or [1] http://www.innovexpo.itee.uq.edu.au/2001/projects/s369342/poster.pdf
ring tone and fast tone (0.5 second on/ off alternatively) is [2] http://www.nps.gov/nhl/DOE_dedesignations/Telephone.htm
busy tone. If tone generator IC can easily be got, there will be [3] http://en.wikipedia.org/wiki/Private_branch_exchange#PBX_functions
[4] http://www.mitedu.freeserve.co.uk/Design/dcpsu.htm
more functions to operate. Although only human can [5] http://www.radio-electronics.com/info/circuits/lc_lowpassfilter/
understand these tones, it is not convenient for the machine. lc_lpf.php
Only one processor is used for all functions because there is [6] http://en.wikipedia.org/wiki/ powersupply
no much function. Hybrid is not used but common line and [7] http://en.wikibooks.org/wiki/Communication_Systems/Telephone_Syste
m
ground line are employed because there is no switch matrix. [8] R.Blake. “The Telephone System. Comprehensive Electronic
This circuit is a kind of non-extensible exchange that is Communication”, 1997, pp. 325-344.
compact and low cost. A pair of telephones is used at the same [9] S.J.Bigelow, J.J. Carr, S.Winder, “Understanding Telephone
Electronics,” Fourth Edition, Butterworth-Heinemann, 2001.
66