Analog telephone exchange
Telecommunication in various forms has always been a fascination of mine. Playing around with discarded telecom gear as a kid was always a source for fun experiments, but also frustration. It can be quite complicated, public documentation is generally scarce and often we are left with plenty of subscriber side devices that won't operate without it's central office counterpart. Even a plain old analog telephone takes a considerable effort to fully bring to life and operate without hooking it up to the central office exchange. Today, November 30 2026, marks the end of an era here in Sweden. The national copper telephone network will officially be closed down. It's sad but inevitable. But there are ways to keep using analog telephones (and modems!). I figured it would be an appropriate time to publish what I've been working as a slow going project for quite some time now. Nowadays we can get these plug-and-play VoIP adapters for hooking up analog phones to a software based PBX like Asterisk or even a Cisco router if you want to get fancy. But while these solutions are generally very good and flexible they take away some of the inherent charm of something analog. In this project I will design a small 8 line analog telephone exchange. This is often referred to as a PBX, a Private Branch Exchange.

How to interface to a telephone

There are two types of interfaces connected to an analog telephone line commonly referred to as FXS (Foreign eXchange Subscriber) and FXO (Foreign eXchange Office). They are often mixed up. FXS is the interface that connects to a subscriber and that drives the line and provides power, dial tone, ring voltage etc. FXO is the interface on for example a telephone or a modem on the subscriber side of the line.

FXS interface specifications

The standard analog telephone line is one pair of wires. The FXS has to provide a DC voltage across to power the subscriber telephone. The DC supply is common referred to as the "battery voltage" and the bidirectional audio is riding on top of this. A telephone typically goes "off hook" by creating a DC path across the lines. This has to be detected by the FXS interface. To ring the telephone, the FXS interface superimposes a high voltage AC signal on top of the DC voltage. This makes it's way to the AC coupled ringer on the telephone. Here in Sweden the telephone standard for an FXS interface looks something like this: - Battery voltage: -48 Volt (one wire of the line is at DC ground and one a -48V) - Ring voltage: 90 Volt AC 25Hz - Line impedance: 600 Ohm - Dial tone: 425 Hz The use of a negative battery voltage has historical reasons but one important reason is that it reduces corrosion compared to a positive supply. For a local PBX with relatively short indoor cable runs this is of limited importance. Many small scale PBXes and FXS VoIP interfaces work with lower positive supply voltages such as +24V. This is what I will do in my design as well. With short lines the higher voltage is still enough to power a phone. The same goes with the ringing voltage. It's often enough with around 50 Volt AC to ring a mechanical bell if the line is short ans sometimes even lower for electrical buzzers and modems. Once the line is off hook the FXS interface should provide an audio path between the line and the audio routing of the exchange. This path could be a bidirectional, a transformer basically, or a more complicated hybrid with one path in one direction an one path on the other direction.

Concept and block diagram

I wanted this exchange to be modular to accommodate different types of line interfaces. Not just for flexibility but also for experimentation. Therefore the design is based on a motherboard with slots to accommodate different configurations and line types. The motherboard contains power supplies, control logic and analog signal routing. Extension cards contains line interfaces and feature cards. I decided to to with eight line card slots (FXS type). Signal routing is handled using CD4051 analog 8:1 multiplexers. Each line slot is connected to a 8:1 multiplexer that connects the line to either a termination resistor, 425Hz tone generator, or one of the 6 available audio busses. This means that the PBX can in theory handle 6 concurrent calls which I think is plenty for a PBX with 8 extensions. The termination resistor is there to provide silence. Sending progress tones of varied cadence is just a matter of switching between the tone generator and termination resistor. It's important to keep lines terminated at all times, otherwise the line will sound funny on the subscriber end or even start to feedback. In an active call two lines are connected to the same bus and therefore terminated. For control I decided to go with a commonly available Arduino Nano. It is a bit limited in number of IO pins but for this I need so many control pins that a chain of HC595 shift registers is a reasonable approach anyway so it's enough.

FXS interface card

This card goes into one of the eight line interface slots on the motherboard. It provides an FXS interface for connecting a regular subscriber telephone or modem. Sometimes also referred to as a "SLIC", Subscriber Loop Interface Circuit. My design is a simplified version of the Motorola MC3419 concept, but based on commonly available parts. That being said, corners have been cut and this interface is not intended to support lines across town but is perfectly fine for lines within the same building. Line supply and off hook detection 24V DC is supplied to the line through Q2 and Q3 which forms two gyrator circuits with one shared decoupling capacitor that AC isolates the line from the supply and ground. This is a very important part of the interface since it keeps the line balanced and maintains line impedance. Without this there will be a significant signal loss and impedance mismatch. Line DC current is limited by R1 and R11. A phone generally needs around 20-100mA DC current to function properly. The voltage drop across these resistors is also used to detect off hook state using Q1 and Q4. There must be a current flowing through both for the line to be considered off hook. This makes detection more reliable. Audio path The line can be considered as a balanced bidirectional audio signal. Capacitor C3 removes the DC component and connects the line to one side of a 600:600 audio transformer. This transformer together with the two zener diodes D3 and D4 offers protection for the rest of the exchange. Ring signal injection This is one of the more tricky parts of a line interface. A high voltage AC signal is to be injected onto the line while maintaining the DC supply. It is also very important to be able to quickly detect off hook state during ringing and immediately remove the high AC voltage. Otherwise the connected phone may get damaged. This is often referred to as "ring trip". I have solved this using a 2-pole relay that injects an AC coupled signal onto both legs of the line. Ideally this AC voltage should come from a floating transformer winding. R8 and R10 limits the current. To isolate the rest of the circuit from the high AC voltage there are two diodes, D2 and D5. When the line is on hook there is no DC current flowing through the diodes and they are effectively blocking AC. When the line goes off hook the diodes are biased by the DC current and AC is passed. This means it's very important to sequence this correctly. Never turn the ring AC on while the line is off hook, and during ringing turn the AC off as soon as the line goes off hook. I did experiments using opto-triacs instead of a relay and while it works a relay actually offered better isolation and is more commonly available. To avoid clicks and pops on other lines while relays are operated I use a 12V relay and a 1kOhm series resistor for filtering. The ring AC voltage is a high amplitude signal and great care must be taken to isolate it from the signal path when line is not ringing. Interface The FXS card have two connectors that plugs in to one of the motherboard line interface slots. J2 is the high voltage connector carrying the +24V line voltage and the AC ring high voltage. J3 is the low voltage connector carrying control signals and audio. These two connectors are on separate grounds and isolated from each other by the opto-couplers and transformer. The line itself hooks up to J1. Two 10 Ohm resistors on each leg of the line aids balancing and acts as fuses in case of a catastrophic event.

Motherboard

In my design the motherboard have eight "line" interface slots. A line in this case is an interface for hooking up a subscriber/extension/telephone. Depending on what type of line card is installed, different kind of equipment could be hooked up. I wanted this modularity so I could experiment with different FXS designs and other types like a radio patch or computer audio I/O, without having to redesign/rebuild the entire motherboard. Control In order to make this design flexible and accessible I decided to use a common Arduino Nano as the main controller. It does not natively have enough I/O pins so a chain of five '595 shift registers are used to provide 40 outputs that are used to control the various parts of the PBX. Audio routing On the motherboard there are six audio buses. Each of the line interface slots can connect to any of the six audio buses through CD4051 multiplexers. One per line slot. Two lines connected to the same audio bus can communicate. This also means that the exchange can in theory handle up to six simultaneous calls. Besides audio buses, each line can be connected to either a termination resistor or a common progress tone. It's important to keep all active lines terminated at all times. Progress tone generation For simplicity there is only a single shared progress tone oscillator. It's a simple Wein-bridge design with a pair of diodes for level control. When adjusted to 425Hz it sounds like a real Swedish exchange, but it can be tuned to any frequency of choice. Dialing and DTMF decoding The hook status of each line interface is directly connected to the controller. This means the software can handle pulse dialing. But in order to support DTMF dialing there is also a single DTMF decoder on board that can listen on any of the eight line interfaces. Some care must be taken to release the decoder as soon as it's not needed since it's a shared resource. Compared to actual legacy telecom gear a 8:1 ratio between number of lines and number of DTMF decoders is quite reasonable. Expansion Along with the eight line slots there are also three generic expansion slots. These slots have more pins and have access to all six audio buses at the same time (no multiplexer). These slots would be suitable for features like trunk interfaces, caller ID or music on hold. The expansion slots are part of the shift register control chain so each slot can contain shift registers for control pin expansion. There is also an extra fourth expansion connector that is smaller and without access to any analog audio buses. This can be used for things like status LEDs. High voltage AC AC signal for ringing is generated using an on-board software controlled H-bridge. This can then be fed into an off-board step-up transformer and then back onto the AC ring signal supply that reaches all line interfaces. The idea with this is to make it flexible since depending on what phones are connected the ring AC signal requirements may be different. Some modern phones may be just fine with 24V AC so in that case no step-up transformer is required. Others with big mechanical ringers may be really power hungry so even an external buffer and big step-up transformer may be required. Power supply The PBX is designed to be powered with a single 24V DC supply. The onboard DC/DC converter provides +/- 5V that supplies both digital logic and bipolar supply for analog audio multiplexers and op-amps. When an external AC buffer board is used (see above) it needs to be supplied with 24V DC as well but it can come from the same source.
This article is currently being updated! Check back in a bit for the rest!

Write a comment

Name or handle

E-mail (optional and not visible to others)

Comment


Code from above