|
Analog telephone exchangeMotivationA few years ago, an analog phone exchange would probably be one of the last things I thought I would build. However, last year I decided to dig into the old POTS (Plain Old Telephone Service) standard, search Finn (the norwegian equivalent to Craigslist) for old phones and start designing a phone exchange. Why on earth would I do this?
Here's a demo of the finished phone exchange: Hardware architectureThe first questions that came to my mind was how old school this was going to be:
In other words, I've made some modern twists to an otherwise old design. Another important design decision was to have line interfaces as separate PCBs, both to be able to use different kinds of physical interfaces (such as wired POTS, wireless etc.), and because the mainboard otherwise would be very large and full of similar circuitry. If I were to make another revision of the main board, I could simply plug the interface boards into the new main board. I also use 100 mil pitch edge card connectors because they give me a warm fuzzy retro feeling ;) (And of course it saves me the effort of not having to solder a connector.) This is how the architecture ended up: Main boardThe heart of the main board is a PIC32MX575F512H microcontroller. This does really all the heavy lifting.
POTS line interface boardThe line interface board holds all the circuitry required to interface a single POTS phone to the main board:
I actually implemented both methods, but ended up using the method with no bias during ringing for it's simplicity. However, there is one caveat. To detect when a phone goes off-hook, you detect an increase in bias current. If the phone rings and there is no bias voltage, you couldn't detect that the phone is off hook. The way I solved this was to monitor the H-bridge current for the ringer circuit using an ADC on the MCU. If the ringer current rises above a threshold, the phone would be considered off hook and the ringer stops immediately. Autopatch boardThe autopatch board enables dialing into the phone exchange from a handheld radio, or answering incoming calls on the handheld radio.I decided to use a simple FM "walkie talkie" transceiver module for this purpose. I first tried SA818, but turned out to be completely unsuitable due to a large TX delay. It took almost a full second from enabling the PTT line until the TX audio became undistorted. Sounds like a coupling capacitor in the AF path charging up to a certain bias level very slowly. Second try was the RDA1846S module (link here). This is a lot better and has only milliseconds of delay before TX is at full power and undistorted. Firmware architetureThe firmware was written in bare metal C, although in an "object oriented way" with a context/handle for each of the phone lines. DTMF decoding is done with the Goertzel algorithm, matched for each of the 8 different frequencies used for DTMF. Four instances runs in parallell to be able to decode DTMF continously on all four audio buses. There is a big state machine handling all phone states, callbacks for events like off-hook, new DTMF data etc.Assembling it all togheterHere is the whole assembly with a CNC routed aluminium front plate for subrack mounting, toroidal transformer, main board and all interface boards.Permanent mountingI mounted the phone exchange in my "home lab" rack together with my networking and home automation equipment.It is powered from a 2.5 kWh 37 V (10S) battery pack made from Nissan Leaf battery modules. This powers my main UPS, but rather than using the UPS to go from 37 VDC -> 230 VAC -> 24 VDC I use a DC/DC converter to go directly to 24 VDC. This means that in a power outage I'm able to use the phone exchange for months after the UPS has turned off. Not that I would ever need it ;) Setting up a private phone networkI mounted a Diamond X-30 antenna on the roof for the autopatch, which will give me plenty of range when I'm cross country skiing or hiking in a nearby mountain and need to dial home for some reason. My daughters room was upgraded with a phone mounted next to the bed, and the last image shows the underground cable from our house to my parents house.It's been giving us and our daughter a lot of fun, and has also proved to be really useful. LinksCommentsYou need to be logged into Facebook in the browser for comments to appear |