2avo2022, 0027 My Homemade POX
My Homemade PBX
Background
I've been fascinated with telecommunications from an early age. When I
was twelve or so I had an intercom system from which I could talk to
most of the house from my corner of the kids’ room, It was made out of
the amplifier from a record player, and miscellaneous parts from old TV
sets. When I was fourteen someone gave me a WW2 vintage shortwave.
receiver with a blown power supply. I was able to make a new power
supply for it, out of TV set parts, and then I spent many hours scanning
the airwaves for radio signals in my native tongue. I was always making
jntercom systems, lamp signaling apparati, even a homemade morse
clicker although I never learned the code. What I wanted to build most of all was a dial telephone system but I had no
phones and no idea how the switching apparatus could be designed.
My decision to go for a co-op and then fulltime job at Bell-Northem Research was influenced by the closeness to
telephone technology this would entail. What did I know; I ended up designing computer hardware which, while it does
run telephone central offices, has no visible relation to telephones.
1 did gain access to a lot of junked electronic components that would allow me to build complex projects. Also I had
Ieamed about microcontrollers which allow the construction of smart electronic projects. And lastly, I had begun to
frequent suburban garage sales, where telephones of every description were plentiful and cheap. ‘The stage was set to
finally build my own dial telephone system. I spent several months of evenings and weekends on this, in the 1992-93,
timeframe. I didn't draw a schematic for it, but I will give here what information I have in my notes or can remember,
This is intended for educational and/or entertainment purposes. In no way is it sufficient information to duplicate the
circuit. Pethaps it will satisfy the next person who asks about it after reading the brag reference | inserted into this old
Usenet posting.
Specifications
+ Eight telephone extensions with roughly telco spec voltages and currents (48V onhook, 90VRMS 20H sinusoidal
ringing, about 25mA loop current offhook.) Ring trip is sub-spec but can handle at least 3 "500" type rotary dial
telephone sets in parallel without false tripping, Lines are not balanced, nor is one side ground,
+ One central office line capable of inbound calls (ring detector) and outbound calls with DTMF and pulse dialing
(selectable, independent of the type of extension phones. That is, the PBX can convert tone-pulse and pulse-tone.)
+ Three internal voice buses, meaning up to three calls in progress simultaneously.
+ Telco standard call progress tones (dial, busy, fast busy, audible ringing.)
Features
The following features are available on the extension lines.
[Dial Sequence [Function
[Flash Put current call on temporary hold, await command
(oo Ring all stations
[oix [Set ring ring pattern:
0
\wandol.catnomepagelpbx html wr3101/2022, 00:27 My Homemade PBX
(o2 [Ring again — redial last extension, if busy ring me back when it becomes free
pe Spect aa (0-9)
[o4x [Parklunpark call against extension x (put on hold so you can hang up / retrieve from hold.)
(os [Park/unpark call against own extension
[ox [Forward calls to extension x, or to outside line with 069...
[060 (Cancel call forward
[08Ix... ‘Set speed dial x (0-9) with digits that follow
[ox2 [Disableienable ringing for outside calls,
o [Join incoming outside call in progress
p (Get outside line. If outside line already on hold, send a flash on it
E [Redial
Example Usage
Call arrives on outside line. All extensions that currently have outside ringing enabled (toggled with 082) ring with the
same cadence as the outside line.
Extension 5 picks up the call. All phones stop ringing.
Extension 2 picks up too, gets dial tone, Wishes to join the incoming call, so dials 09. Connected to extension 5 and the
outside fine.
Extension I dials 9. Gets busy signal. Dials 02, gets stutter dialtone confirmation, hangs up.
Extensions 2 and 5 both hang up, terminating the outside call. Extension | gets a single short ring. Picks up the phone, is
automatically connected to the outside line.
Extension 1 makes a pulse-dial call but the outside line is configured for DTMF so the PBX converts the digits.
Extension I parks the call by flashing, then dialing 05.
Extension 7 forwards all calls to an outside number by dialing 0697451576. Extension 3 retrieves the parked outside call
by picking up and dialing 041
Extension 8 dials 01800 to ring all available stations with the four-short-bursts ringing pattern, Prearranged signal for a
certain person to pick up, whatever extension they are nearest. Extension 5 picks up, call is completed.
Extension 3 wishes to access a special feature on the outside line, transmits a flash by flashing to enter command mode
(confirmed with stutter dial tone), dialing 9.
And so on.
Hardware Design Philosophy
This is not a low-cost design intended for publication and exact reproduction by others. It was completely tailored to
‘what components I already had and what was cheap to buy. Itis also not terribly efficient; if in doubt I insert an extra op-
amp buffering stage or more clamping diodes just to be sure. The low-tech relay switching matrix is because I had tons
of relays but no CMOS switches, and didn't know how to use the latter at the time anyway.
The massively oversampled digital tone generator is because I am a digital weenie,
Similarly offhook detection in the line circuits could probably be done with solid-state circuitry but I actually like the
chatter of the relays as phones are dialed.
Analog Hardware
Let's start with the line circuit. There is one of these for each extension.
\wandol cathomopagelpbx html 23101/2022, 00:27 ‘My Homemade PBX
7 ve
boon
iy
es
hey = =—z VOCE PATHS
r LT
“sa J
(rine) ug
KE (RING NS
St NETWORK
RING vores
(suorr cite
PeODe)
The voice paths 1-3 of all the line circuits are connected together. So if any given pair of line circuits select the same
voice paths with relays K3 and K4, they can talk with each other. Any line that is not currently connected to a voice path
is terminated via a 600 ohm resistor so that it doesn’t sound funny.
When the phone goes offhook, current is drawn through the 200 and 300 ohm resistors and the Tine relay K2, which
closes. Via the debounce circuit a clean OFFHOOK.- signal goes to the control complex. Pulse dialing and switchhook
flash are detected by timing the OFFHOOK- signal in software,
The large voltage changes caused by this are kept out of the voice circuitry by capacitor C2, which at 4uF is much larger
than it needs to be.
To ring the line, ring voltage is generated and relay Kis activated. This places capacitor C1 effectively in parallel with
the relay coil, shunting the potentially strong ring current around it so that it doesn’t chatter (which would result in "false
trip", Le. a false offhook indication.) However if the phone goes offhook, the capacitor is discharged by the DC current
and the line relay closes within one or two cycles of the ring waveform. The control complex then immediately cuts off
ringing by opening relay K1.
That’ all there isto it, except for very careful sequencing of the relays, For example, the control signal to Kis
synchronized in hardware to the zero crossings of the ring waveform, and the voice path is connected via K3/K4 only
‘when C2 is in steady state, so that no click results, For example, if the line has just picked up after being rung, a brief
delay occurs before the call is connected.
Connected to each voice path is the circuitry to detect DIME tones and generate audible call progress tones. I don't have
a schematic for it, but I do have a wiring diagram which is just as good:
\wandol cathomopagelpbx html a3101/2022, 00:27 ‘My Homemade PBX
J
O2pe (2x 91pF)
o.23uF
IK —> voice gue
Fovwa.
267uN
. Fu
VOIKE Bus Sun
RELAY
£ M42 \
O.tuF
1p
Ope
DecovPume (0.1yF)
100K.0.
3720
2672
ot wr
£5 kh
PortoM _Coneoesrts
Dee ott Vee GND
LKR Ven - BND
O.1pF Vee- GH
22¢F Comp. Vee
doin
‘Decoveuins (LuF)
The top device is a Crystal Semiconductor 8870 DTMF receiver. It listens to the voice bus via a super conservative
arrangement of resistors, capacitors and diodes to ensure it can't get damaged by voltage transients, Due to its high input
impedance it can always listen.
The bottom device is a DAC-08 digital-to-analog converter for generating the tones. A dual op amp (LM3S8) is used to
convert the current output of the DAC-08 to voltage, then rebuffer it after lowpass filtering, The output impedance is 600
ohms. Again, diode clamping is used to protect the electronics from harm. This circuit is only connected to the voice bus
‘when needed via the voice bus relay (not shown) as the 600 ohm termination impedance is not wanted during an actual
call
\wandol cathomopagelpbx html an3101/2022, 00:27 ‘My Homemade PBX
‘Next, here is the circuit that generates the ring waveform:
TRANSISTORS
TOK
WOT
2K
B.0LKa
‘Not shown is the DAC-08 that generates the 20Hz sinewave; it's hooked up the same way as in the voice path circuit. An
extra op amp is used as an adjustable gain stage to drive the output transistors. Not shown is the push-pull darlington pair
of output transistors running on +/- 20V and the transformer that transforms the ring voltage up to the final level. There
is no provision to eliminate crossover distortion; a "nearly sinusoidal” ring waveform is quite good enough. The
transformer needs to work at 20Hz; normal AC line transformers don't, so Thad to salvage an audio output transformer
out of a junked hiefi tube amplifier. The ring voltage is gated on and off by controlling the bits going into the DAC;
when no phone needs to be rung itis kept off for safety.
Not shown is the power supply which generates the following voltages:
+/- 20V unregulated for the ring driver
+/- 15V regulated for the analog electronics
+10V unregulated for the relay drive (12V relays but close enough)
+ SV regulated for the digital electronics
-48V unregulated but very well filtered for the line cireuits
‘Not shown is the citcuit for the outside line. In a nutshell it has a relay tree like K3/K4 in the line circuits to be able to
connect to any of the voice paths. Instead of the 600 ohm resistor in the default tree brach, it has a DTMF dialer block
consisting of a "5089" DIMF generator, a 74L$139 to control it, and an op-amp driver stage to buffer the output. More
diode clamping, and coupling to the world via an air-gap type 1:1 audio transformer (without the air gap it would
saturate due to the DC current flowing on the outside line side.) A ring detector similar to that found in a modem detects
outside line ringing, and a simple relay connects and disconnects the transformer to facilitate going ofthook, pulse
dialing and flashing,
The reason I don't show these things is not that they are more obvious than the other stuff, but that I don't have neat
diagrams I can sean in,
Digital Tone Generation
The DACS take unsigned 8-bit linear audio samples. The following waveforms need to be generated.
\wandol cathomopagelpbx html 572340112022, 00:27 My Homemade PaX
1. Silence
2. 20Hlz sinusoid for the ring voltage.
3. Sum of 350Hz and 440Hz sinusoid for dial tone.
4. Sum of 440Hz. and 480Hz sinusoid for audible ringing
5. Sum of 480Hz and 6201z sinusoid for busy signal.
The samples all stored in an PROM. Because of the way the clock frequencies worked out and because I did not wish
to bother with much analog filtering, I decided to generate tones at 86.4K samples/second, and since the tone waveforms
all repeat themselves within 1/10 second I generated 1/10 second’s worth. This required a 27512 type EPROM, which by
that time was a cheap part so the waste of resources was insignificant, The following AmigaBASIC program was used to
generate the samples (in assembler input file format.)
FOR OUTPUT AS #2
PRINT #1,"; Digitized ring, dial, audible ring, and busy tones"
PRINT #1," .org 0”
FOR i = @ TO nsv3
PRINT #1, " byte"
PRINT #1, INT(SIN(2
1 = SIN(5*i*2"pi/ns)
N(48*i*2*pi/ns)
N(4B*i*2*pi/ns)
IN(62"1*2*pi/ns)
PRINT #1, ","; INT(t1*63.99+t2*63.99+128);
PRINT #1, ","; INT(t2*63.994t3*63.99+128);
PRINT #1, ","} INT(t3*63.994ta"63.99+128)
Next
CLOSE #1
pi /ns)*127.994128) ;
The microprocessor controls all this with just seven control signals — three 2-bit tone selects for the voice paths and a 1-
bit ring voltage enable, Digital sequencing automatically gates the tones on and off at the 1/10 second points where they
cross zero, so pulsed tones don't have clicks where they are gated on and off. Likewise the ring voltage is gated at zeto
crossing points, plus a synchronization signal is generated somewhat ahead of the zero crossing point to allow the ring
relays to be switched close to it, All this makes the system "sound" cleaner and also reduces wear & tear on the ring
relay contacts.
The ABEL files for the two PALs in the digital tone section ean be found here and here.
Control Complex I/O Summary
Quite a few control signals have accumulated in the previous description. These are mapped into the 8031 CPU's address,
space as a bunch of read-only input locations and write-only output locations
[Address ead Write
|(hex)
[sooo Ha =H7 He HS Ha Wa 2 AW) Twi TNO. 02 1 08
lazoe Ma M7 M6 MS M4 MB NZ MD
laaoe bi eo ao
lasoe RE RT RE ORS Ra RZ RZ AD
lasoe / RE 52 Ts1__TS0_
jse0e sw v2 vi vo _oTMF rec @_| TDINF sender
\sa00 TormF rec 1_|
[e800 Torme rec 2,
Where, for line x, Hx is the OFFHOOK input, Mx and Lx are the controls for relays K3 and K4 respectively, and Rv is,
the control for K1 (ring relay.) For voice channel y, Dy is controls the relay that connects the tone generator to the
channel, "DTMF ree y" is the 4-bit DIME receiver listening to the channel, Vy is DTMF tone valid for the channel,
"Ty" is the call progress tone select for the channel (silence, dial, audible ring, busy.) RE is the ring voltage enable,
"DTMF sender" is the control bits for the DTMF generator. TN] and TNO control the relays that connect the outside
("trunk") line to the one of the voice paths. SW is the DIP switch that selects pulse or tone dial for the central office line.
Not shown is the offhook control for the outside line, which is connected directly to P1.1 of the 8031, and the ring detect
from the outside line, which is connected to P1.0.
The TSy and RE outputs are retimed in by the tone sequencing circuitry.
Control Complex Hardware
\wandeLcafhomepagetpbx hn or2340112022, 00:27 ‘My Homemade PAX
The control complex is an 8031 microcontroller operating at 11.0592MHz. A 2764 EPROM occupies locations 0-1FFF
hex of its address space, and an 8Kx8 SRAM occupies 2000-3FFF. The serial port is brought out to a standard RS232
connector vial a MAX232 device. The addressable 1/0 locations described earlier are implemented as a bunch of address
decoding and 74x374 octal flip-flops/tristate drivers. There is no schematic, but there is one PAL file
‘ULN2003 drivers are used for the relays.
Control Complex Firmware
The firmware is fairly well documented in the source code, The assembler used was as31, a free 8031 assembler from
the net.
The firmware was debugged by keeping a simple debug monitor and download program in ROM, and downloading the
firmware to RAM for testing. No other debug tools were used. When the firmware was finished, it was burned into
ROM. The serial port is not used with the final firmware.
Last words
It works! From a telephone, it sounds indistinguishable from the real telephone network. When a call to another
extension connects through, there is no click, you merely hear the dying oscillations of the bell as the handset is lifted
away. Phones and answering machines of every description have been tried with this and all work fine.
| wired a lot of LEDs into the circuit to show the status of all relays, the tone selects, the
ring voltage, the external ring detect. By picking up three phones and dialing different
extensions with different ring cadences, quite a neat rhythm of clicks and flashing lights
can be generated.
telephone separated from the switch by about 100m of twisted-pair telephone wire and
it worked fine.
‘The only value this thing has is entertainment value. It's great when there are guests
with bored kids, and once set up it gets plenty of attention from the adults too, if they
are engineers that is.
1 don't actually use it for anything,
It was worth building because it finally scratched that childhood itch.
Back to my projects page
\wandol cathomopagelpbx html um