My Homemade PBX
We believe that this document is fully human-written.
Hacker News Article AI Analysis
Content Label
Human
AI Generated
0%
Human
100%
Window 1 - Human
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
intercom 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-Northern 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.
I did gain access to a lot of junked electronic components that would allow me
to build complex projects. Also I had learned 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. Perhaps it will satisfy the
next person who asks about it after reading the brag reference I inserted into
this old Usenet posting.
Window 2 - Human
Specifications
Eight telephone extensions with roughly telco spec voltages and currents (48V onhook,
90VRMS 20Hz 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
FlashPut current call on temporary hold, await command
00Ring all stations
01xSet ring ring pattern:
0 --- ---
1 -- -- --
2 - ----
3 ---- -
4 ----
5 -
6 - -
7 - - -
8 - - - -
9 ------
02Ring again -- redial last extension,
if busy ring me back when it becomes free
03x*xSpeed dial x (0-9)
04xPark/unpark call against extension x
(put on hold so you can hang up / retrieve from hold.)
05Park/unpark call against own extension
06xForward calls to extension x, or to outside
line with 069...
060Cancel call forward
081x...Set speed dial x (0-9) with digits that follow
082Disable/enable ringing for outside calls
09Join incoming outside call in progress
9Get outside line. If outside line already
on hold, send a flash on it
#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.
Window 3 - Human
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 line.
Extension 1 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 1
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 1 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. It is 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.
Window 4 - Human
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 line 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 K1 is 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", i.e. 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's all there is to it, except for very careful sequencing of the relays.
For example, the control signal to K1 is 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 DTMF 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:
The top device is a Crystal Semiconductor 8870 DTMF receiver.
Window 5 - Human
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 (LM358) 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.
Next, here is the circuit that generates the ring waveform:
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 I had to salvage an
audio output transformer out of a junked hi-fi 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 it is 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)
+5V regulated for the digital electronics
-48V unregulated but very well filtered for the line circuits
Not shown is the circuit 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.
Window 6 - Human
Instead of the 600 ohm resistor in the default tree brach, it has
a DTMF dialer block consisting of a "5089" DTMF generator, a 74LS139 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 offhook, 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 scan in.Digital Tone Generation
The DACs take unsigned 8-bit linear audio samples. The following waveforms
need to be generated.
Silence.
20Hz sinusoid for the ring voltage.
Sum of 350Hz and 440Hz sinusoid for dial tone.
Sum of 440Hz and 480Hz sinusoid for audible ringing.
Sum of 480Hz and 620Hz sinusoid for busy signal.
The samples all stored in an EPROM. 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.)
ns = 8640
pi = 3.14159265#
OPEN "tones.asm" FOR OUTPUT AS #1
PRINT #1,"; Digitized ring, dial, audible ring, and busy tones"
PRINT #1," .org 0"
FOR i =