6

I am working on a project and would like to connect an old fashioned landline phone to a raspberry pi. I then want to be able to dial some number on the phone and then have the raspberry pi play a prerecorded audio file based on the number dialed. I am planning on writing the program to handle calls in Java but am having difficulty turning the landline signal into something the raspberry pi can work with. I also want the raspberry pi to be able to ring the landline phone. Neither device will be connected to the outside world.

  • 1
    So basically you want to have a RPi emulate landline phone base station? – Algimantas Dec 10 '16 at 15:55
  • 1
    Yes the pi will be emulating an operator and switching station. The program is almost complete and requires a number as input, I just need to figure out how to dial the input on the phone and send it to the raspberry pi and vice versa. – cwiegand Dec 10 '16 at 16:06
  • 1
    Also I have not yet tried a modem, I was planning on using the GPIO header on the pi. I am currently trying to wire rj-11 to USB adapter, is that what you mean? – cwiegand Dec 10 '16 at 16:11
  • 1
    I guess you could use the pi's audio output to control an acoustic coupler? – Giskard42 Dec 10 '16 at 17:15
  • 1
    I believe the Asterix PBX community may have some useful knowledge here. – pjc50 Dec 10 '16 at 19:20
5

It depends how 'old' you phone is. If it's touchtone, it's somewhat easier, if decadic dial a little more challenging. you should read up on phones before starting, and this is a good reference.

You can break the problem into parts:

  1. Power the phone. This is normally a 48 VDC line with a 680 Ohm series resistor (called the subscriber ballast If I remember correctly). So if you short the line (Red-Green) you get about 70 mA. The phone/exchange understand the state of the line by the voltage detected on the line (from the exchange end they detect the current flowing to the subscriber). You could probably get away with 24 VDC and a 320 Ohm resistor.

  2. Ring tone. This is typically a 20 Hz AC signal at about 60 V RMS. You need this amount of signal to ring the older electromagnetic ringers which represented about 3-5 W load. The Touch tone phones still needed a high voltage ring tone, but do not draw any ringer power (they just detect the 20 Hz tone). To generate this signal you can use a small audio amplifier (if you need the higher power) and something like a 120 - 6 or 9 V transformer. Feed the amplifier into the 9 V end, and AC couple the 120 V side to the phone line. If you configure this correctly there is no reason it cannot provide both dial tone (anything from 50 Hz - 400 Hz) and ring tone.

  3. Audio input/output. This is relatively easy and a circuit such as this provides the information you need. From memory audio is about 1.2 V RMS on the line. This phone tap schematic was used to allow a tape recorder to either record, or play music to the line depending on which connector (Mic or output was used).It's not a great circuit as you have to position the pot carefully at the high end to get enough signal output to the line. Notice however the back to back zeners to clip the ring tone voltage!!

enter image description here

  1. Dailing. If it's a touch phone then it just feeds audio tones onto the line. It it's decadic dial the phone will short the line with the dial pulses. I'm assuming here that you need this to tell the Raspberry Pi which 'virtual' phone number you are dialing. You could find these pulses in the audio channel, or look at the line voltage with an A/D.

When the phone goes off hook you should have between 8 and 15 VDC on the line (you need this to power the Dial Tone phone), On hook close to 48 VDC for a normal phone line. This will alter if you use less line voltage.

| improve this answer | |
3

If your telephone has DTMF dialling (dual tone multi frequency) then you'll need to interface the RPi with a DTMF decoder chip like this one: -

enter image description here

You'll also need to send a DC loop current to power the phone. Somet5hing like 25 mA with an open circuit voltage of 12 volts will power most phones quite easily but don't try and supply a hard 12V dc to the phone because you might get smokde. Maybe 12V through a 220 ohm resistor. The phone should power at this level and you will be able to wire the DTMF decoder to the line via a capacitor and resistor arrangement something like this: -

enter image description here

Now, when it comes to ringing the phone's bell that's a different story. In my experience you will need an AC voltage of 30V to 50V to get the bell operating. The industry standard in the UK (as per the old BS6305 is 70 V at 20 Hz (from memory)) but, you might get it to work at 50 / 60 Hz so you might need to set up an experiment.

I would recommend you use relays to switch the AC ring voltage to the line so that the DC is removed when the bell voltage is active. This also gives you the possibility of applying cadence to the bell voltage to simulate a US or UK bell cadence.


With a 220 ohm terminating the line for speech, sidetone might be a little high but there are ways to make the impedance more like the 600 ohms typically used (more modern phones rely on a complex impedance but this would be a small refinement that probably isn't necessary).

If you phone uses an old fashioned dial (i.e. it is a pulse dialler) then counting the dialled pulses using the RPi is quite doable I would suggest.

| improve this answer | |
  • What if I were to use a digital to pulse converter and then counted the pulses? Would that work well or would it be better to keep everything digital and then use the DTMF decoder? edit: is a digital to pulse converter a DTMF decoder/encoder? Also "dtmf to pulse converter" not "digital to pulse" – cwiegand Dec 10 '16 at 16:31
  • I don't know how to visualize what you call "digital to pulse converter". – Andy aka Dec 10 '16 at 16:33
  • Sorry, dtmf to pulse converter. They are adapters that you can buy the allow you to use your old vintage phones with standard home phone lines. – cwiegand Dec 10 '16 at 16:35
  • Ok it looks like that works for detecting the number dialed! Now if I am using a pulse system instead of DTMF, how do I send audio back over the two wires, is it just as simple as playing the audio as if it were from an audio jack? – cwiegand Dec 10 '16 at 16:41
  • The 12 voll power dc that feeds through the 220 ohm I mentioned is they key. If you tested a 24 volt supply for an op amp it can both drive the dc through the resistor and superimpose an audio signal back to the phone. – Andy aka Dec 10 '16 at 16:55
0

The OP may be interested to note that there is at least one commercial offering doing exactly what they aimed to do - Steelowltech - maybe they got the inspiration from here as I am sure I saw somewhere that underneath the casing is an RPi...!

| improve this answer | |
  • Ha that's great, mine IS for an escape room and it's working well. I pretty much built that device over the last month. It has almost all of the same features. Escape rooms are catching on and I should have guessed that there was a product like that already that I could have bought. Well, it was a good experience. – cwiegand Dec 27 '16 at 13:06
0

I use one of these with my raspberry pi and a relay board to monitor my sump pump.

https://www.amazon.com/Dakota-Alert-Slave-Dialer-AD-01-S/dp/B006U3WUQS

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.