Page 1 of 2

Connecting raspberry pi to phone line

Posted: Sat Aug 31, 2013 7:58 pm
by jon889
I'd like to have an API for my landline phone. (So I can do things like have notifications on various devices)

Is it possible to connect the phone line to the GPIO on a raspberry pi? At least/start just detect an incoming phone call, not getting the number or sound.

Re: Connecting raspberry pi to phone line

Posted: Sat Aug 31, 2013 8:11 pm
by ddxfish
How about a GPIO to serial adapter and a serial modem?

Re: Connecting raspberry pi to phone line

Posted: Sat Aug 31, 2013 8:17 pm
by FTrevorGowen
Don't think I'd want to try a "direct" connection - IIRC there is (or was) ~50V on one of the wires. Of course you could try using the Pi's serial port (via appropriate level-shifting buffers) or a USB-serial cable with an old-fashioned RS232 modem.
Trev.

Re: Connecting raspberry pi to phone line

Posted: Sat Aug 31, 2013 10:25 pm
by plugwash
All phone interfaces MUST be isolated. Not only are the voltages higher than you usually see in most electronics, there may under certain conditions end up being a substantial voltage between the phone line and local ground.

The ringing signal on a phone line is about 90V AC at about 20 Hz.

Most likely if I was designing a simple ring detector i'd use an opto-isolator with a diode connected across the LED in inverse-paralell. Then a capacitor in series to block DC and set the current to something appropriate for the opto isolator.

Re: Connecting raspberry pi to phone line

Posted: Sun Sep 01, 2013 2:38 am
by Heater
Wow, someone still has a phone line? I have not seen one for ten years.

I would not connect anything to a phone line except a proper modem or a phone of course.

If you just want to detect calls I'd be looking at detecting other phenomena like the ringer sound.

Re: Connecting raspberry pi to phone line

Posted: Sun Sep 01, 2013 9:29 am
by redhawk
As already mentioned the voltage output is quite shockingly high from the telephone line any access to ringer/off-hook detection or audio output would require a suitable circuit with isolation i.e. opto-coupler and high impedance audio transfer.
An easier option would be to use a dial-up modem all you need to do is check the serial buffer and look for "RING" for incoming call.
If you have caller ID enabled (AT+CID=1)?? (must be supported and enabled by your landline provider) then the incoming call number may also be included.

Richard S.

Re: Connecting raspberry pi to phone line

Posted: Sun Sep 01, 2013 2:40 pm
by plugwash
Heater wrote:Wow, someone still has a phone line? I have not seen one for ten years.
Hmm, is dry ADSL (ADSL without a phone line) common where you live?

Here in the UK while I belive dry adsl exists in theory it's almost impossible to find an ISP actually offering it and once you have a phone line you may as well use it. I belive the situation in the US is similar.

Re: Connecting raspberry pi to phone line

Posted: Sun Sep 01, 2013 2:51 pm
by Heater
plugwash,

What I mean is that in Finland and Scandinavia nobody I know uses a land line for phone anymore. I have not seen one in home since last century and we don't have them in our offices. There are not even public phone boxes anymore. The mobile phone totally replace all that ages ago. Can't remember the last time I saw an actual good old fashioned phone for sale or rent.

I had a DSL line back in 1998 or so, shortly after my 14.4 modem. Now a days most people get their internet from cable companies or via 3g modems.

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 12:59 pm
by InsaneCarl
Have you considered maybe buying a cheap old-fashioned phone and using it as an adapter? If all you want to do is detect a ring, you could either use a microphone to detect the sound, or connect the phone's speaker cable to the pi. All you would need is a resistance.

In theory, you could also have the pi pick-up if you connect a relay instead of the switch the phone used.

For audio, you can buy an external USB sound card and connect that to the appropriate cables for the phone handle's speaker and mic.

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 5:16 pm
by W. H. Heydt
Heater wrote:
Sun Sep 01, 2013 2:38 am
Wow, someone still has a phone line? I have not seen one for ten years.
I maintain a POTS (Plain Old Telephone Service) line in part as a disaster preparedness tool. In many potential disasters, a POTS line is the very last communications system to fail. Cell towers are only good until their batteries run down (typically about 4 to 8 hours without utility power).

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 5:24 pm
by fruitoftheloom
InsaneCarl wrote:
Mon Sep 23, 2019 12:59 pm
Have you considered maybe buying a cheap old-fashioned phone and using it as an adapter? If all you want to do is detect a ring, you could either use a microphone to detect the sound, or connect the phone's speaker cable to the pi. All you would need is a resistance.

In theory, you could also have the pi pick-up if you connect a relay instead of the switch the phone used.

For audio, you can buy an external USB sound card and connect that to the appropriate cables for the phone handle's speaker and mic.

WoW a response to a 6 year old post !!

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 6:39 pm
by davidcoton
InsaneCarl wrote:
Mon Sep 23, 2019 12:59 pm
Have you considered maybe buying a cheap old-fashioned phone and using it as an adapter? If all you want to do is detect a ring, you could either use a microphone to detect the sound, or connect the phone's speaker cable to the pi. All you would need is a resistance.

In theory, you could also have the pi pick-up if you connect a relay instead of the switch the phone used.

For audio, you can buy an external USB sound card and connect that to the appropriate cables for the phone handle's speaker and mic.
Note that, depending on where you live, wired connections to the telephone (device or line) may not be legal. In the UK any connected equipment must be type approved (read: expensive testing).

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 7:13 pm
by trejan
davidcoton wrote:
Mon Sep 23, 2019 6:39 pm
In the UK any connected equipment must be type approved (read: expensive testing).
The requirement for BABT approval is long gone. The EU directive which scrapped it came into force around 2000. All you need is CE approval but that isn't specific to this situation.

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 8:51 pm
by davidcoton
trejan wrote:
Mon Sep 23, 2019 7:13 pm
davidcoton wrote:
Mon Sep 23, 2019 6:39 pm
In the UK any connected equipment must be type approved (read: expensive testing).
The requirement for BABT approval is long gone. The EU directive which scrapped it came into force around 2000. All you need is CE approval but that isn't specific to this situation.
Shows how long ago I did anything related to phones! That's one piece of EU common sense.

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 9:07 pm
by wh7qq
W. H. Heydt wrote:
Mon Sep 23, 2019 5:16 pm
Heater wrote:
Sun Sep 01, 2013 2:38 am
Wow, someone still has a phone line? I have not seen one for ten years.
I maintain a POTS (Plain Old Telephone Service) line in part as a disaster preparedness tool. In many potential disasters, a POTS line is the very last communications system to fail. Cell towers are only good until their batteries run down (typically about 4 to 8 hours without utility power).
Our brilliant county Mayor purchased iPhones for all the emergency responders. At the first threatened non-disaster, the iPhones proved useless because the cell circuits were filled with local callers..."...the sky is falling!" It wasn't the battery backup, rather the congestion of the network.LMAO.

I have buried copper wire here on a house built in '86. Fiber runs down the street but the telco won't install unless I dig the trench and put in conduit to the street...in spite of a big federal subsidy to provide rural broadband. In the mean time, the 911 dispatcher has no confusion over my location whereas if I call 911 from my cell phone, it lands in a different county and they have no idea.

Neighbor across the street has DSL via fiber...no problem except when the AC goes down (often here) and the modem doesn't work without it.

Back on topic, many of us still have old phone modems lying around that came out of service for obsolescence, not for failure. Lots of RS232 adapters are around and cheap. Just be sure the adapter is for 3.3V rather than 5V or higher GPIO lines.lest the Pi gets overcooked.

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 10:00 pm
by bomblord
My place of work uses an ethernet to telephone line adapter for an automated calling system coming out of the back of a bog standard Windows PC.

The Software on the PC handles all the technicalities though and It's an active adapter that has to be plugged in and it also splits it out so that it can have a network connection and a phone line connection. There's no special setup that was done on our end aside from plugging it in and running the software. A quick google search doesn't actually turn up the product in question so I have no clue where it came from but I can tell you for a fact they do exist.

You can also just chop off the ends of an ethernet cable and splice a telephone end onto it with the right wiring setup but I feel like that might not accomplish your goal.

Re: Connecting raspberry pi to phone line

Posted: Mon Sep 23, 2019 10:24 pm
by drgeoff
bomblord wrote:
Mon Sep 23, 2019 10:00 pm
You can also just chop off the ends of an ethernet cable and splice a telephone end onto it with the right wiring setup but I feel like that might not accomplish your goal.
Unless your goal is a fried RPi and a not too pleased phone company.

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 1:05 am
by bomblord
drgeoff wrote:
Mon Sep 23, 2019 10:24 pm
bomblord wrote:
Mon Sep 23, 2019 10:00 pm
You can also just chop off the ends of an ethernet cable and splice a telephone end onto it with the right wiring setup but I feel like that might not accomplish your goal.
Unless your goal is a fried RPi and a not too pleased phone company.
Many phone lines use Cat 5 cables and just exclude the unused wires and I have seen phone lines running into ethernet jacks on a punch panel for VOIP it won't fry anything. I'm not saying he wire the GPIO pins into a phone line.

edit: Amazon even sells wires with RJ11 on one end and RJ45 on the other. But it probably won't actually do what you're wanting just was kind of defending myself there.

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 1:10 am
by Imperf3kt
bomblord wrote:
Tue Sep 24, 2019 1:05 am
drgeoff wrote:
Mon Sep 23, 2019 10:24 pm
bomblord wrote:
Mon Sep 23, 2019 10:00 pm
You can also just chop off the ends of an ethernet cable and splice a telephone end onto it with the right wiring setup but I feel like that might not accomplish your goal.
Unless your goal is a fried RPi and a not too pleased phone company.
I literally have seen phone lines running into ethernet jacks on a punch panel for VOIP it won't fry anything. I'm not saying he wire the GPIO pins into a phone line or into a POE switch.
Was it jammed in forcefully?
Last I checked RJ11 and RJ45 are not compatible.

Be aware that in some countries (Australia, for example), it is illegal to use phone cables or ethernet patch leads for anything except the specified use. Even running the cable through a wall to reach another room is illegal without a licensed technician to install it.

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 1:13 am
by bomblord
Imperf3kt wrote:
Tue Sep 24, 2019 1:10 am
Was it jammed in forcefully?
Last I checked RJ11 and RJ45 are not compatible.
Not directly no but it's punch panel. All your doing is adding or subtracting wires to change between a phone and an ethernet jack.
Imperf3kt wrote:
Tue Sep 24, 2019 1:10 am

Be aware that in some countries (Australia, for example), it is illegal to use phone cables or ethernet patch leads for anything except the specified use. Even running the cable through a wall to reach another room is illegal without a licensed technician to install it.
That's an interesting bit of info I was not aware of it seems really odd to me but I guess that's how they do it there. At work we just have spools of ethernet cable lying around to slap ends onto nobody has a license for it and our sysadmin can't follow standards anyway xD. Heck, I literally just got done putting ends on a set of 3 cat 6 cables for someone.

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 7:34 am
by rpdom
bomblord wrote:
Tue Sep 24, 2019 1:05 am
Many phone lines use Cat 5 cables and just exclude the unused wires and I have seen phone lines running into ethernet jacks on a punch panel for VOIP it won't fry anything. I'm not saying he wire the GPIO pins into a phone line.
VOIP uses Ethernet, not phone lines.

Structured wiring is often used to carry phone signals. often with an adaptor each end between RJ11 and RJ45.

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 10:39 am
by rin67630
W. H. Heydt wrote:
Mon Sep 23, 2019 5:16 pm
In many potential disasters, a POTS line is the very last communications system to fail.
Do you really know what is today behind your POTS?
Very probably a network converter in the internet cabinet just across the street...

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 11:03 am
by rin67630
jon889 wrote:
Sat Aug 31, 2013 7:58 pm
I'd like to have an API for my landline phone. (So I can do things like have notifications on various devices)

Is it possible to connect the phone line to the GPIO on a raspberry pi? At least/start just detect an incoming phone call, not getting the number or sound.
You ought to build an telephone ringing opto-isolation circuit.
Please read that:
http://www.epanorama.net/circuits/telephone_ringer.html

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 11:16 am
by plugwash
I don't know whereabouts in the world you live, but here in the UK openreach POTs lines (not sure about virgin ones) are still delivered from the telephone exchange. If the customer has FTTC/VDSL then the line is diverted to a FTTC cabinet where the VDSL is terminated, but the POTs still continues back to the exchange.

This matters because telephone exchanges have significant backup power capability, cell sites and FTTC cabinets tend to have much less.

Re: Connecting raspberry pi to phone line

Posted: Tue Sep 24, 2019 11:29 am
by rpdom
plugwash wrote:
Tue Sep 24, 2019 11:16 am
This matters because telephone exchanges have significant backup power capability
Actually very little, but enough to keep them running for a few hours. I have been in the main telephone exchange in the city centre here where I was setting up a couple of servers for them. It was a huge almost empty room where all the old equipment used to be. The actual exchange was two server racks in a corner of the room. It doesn't take much of a decent sized UPS to run that. Where I was working at the time we had a room full of batteries and a big UPS that could run the whole building for a few hours, plus a couple of generators that would keep us going for as long as we had a supply of fuel, but we did have some large computers and cooling systems running off that.