jon889
Posts: 2
Joined: Sat Dec 29, 2012 1:56 am

Connecting raspberry pi to phone line

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.

User avatar
ddxfish
Posts: 75
Joined: Wed Aug 07, 2013 5:17 pm
Location: Florida
Contact: Website AOL

Re: Connecting raspberry pi to phone line

Sat Aug 31, 2013 8:11 pm

How about a GPIO to serial adapter and a serial modem?
My Pi Guides: http://www.etcwiki.org/wiki/Category:Raspberry_Pi
My AIM screen name: ddxfish
Always happy to chat about the Pi!

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5116
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Connecting raspberry pi to phone line

Sat Aug 31, 2013 8:17 pm

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.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

plugwash
Forum Moderator
Forum Moderator
Posts: 3463
Joined: Wed Dec 28, 2011 11:45 pm

Re: Connecting raspberry pi to phone line

Sat Aug 31, 2013 10:25 pm

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.

Heater
Posts: 13683
Joined: Tue Jul 17, 2012 3:02 pm

Re: Connecting raspberry pi to phone line

Sun Sep 01, 2013 2:38 am

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.
Memory in C++ is a leaky abstraction .

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Connecting raspberry pi to phone line

Sun Sep 01, 2013 9:29 am

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.

plugwash
Forum Moderator
Forum Moderator
Posts: 3463
Joined: Wed Dec 28, 2011 11:45 pm

Re: Connecting raspberry pi to phone line

Sun Sep 01, 2013 2:40 pm

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.

Heater
Posts: 13683
Joined: Tue Jul 17, 2012 3:02 pm

Re: Connecting raspberry pi to phone line

Sun Sep 01, 2013 2:51 pm

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.
Memory in C++ is a leaky abstraction .

InsaneCarl
Posts: 1
Joined: Mon Sep 23, 2019 12:50 pm

Re: Connecting raspberry pi to phone line

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.

W. H. Heydt
Posts: 11014
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Connecting raspberry pi to phone line

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).

fruitoftheloom
Posts: 20929
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Connecting raspberry pi to phone line

Mon Sep 23, 2019 5:24 pm

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 !!
Retired disgracefully.....

User avatar
davidcoton
Posts: 4200
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Connecting raspberry pi to phone line

Mon Sep 23, 2019 6:39 pm

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).
Signature retired

trejan
Posts: 749
Joined: Tue Jul 02, 2019 2:28 pm

Re: Connecting raspberry pi to phone line

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.

User avatar
davidcoton
Posts: 4200
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Connecting raspberry pi to phone line

Mon Sep 23, 2019 8:51 pm

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.
Signature retired

wh7qq
Posts: 1340
Joined: Thu Oct 09, 2014 2:50 am

Re: Connecting raspberry pi to phone line

Mon Sep 23, 2019 9:07 pm

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.

User avatar
bomblord
Posts: 175
Joined: Sun Jul 14, 2019 2:54 am

Re: Connecting raspberry pi to phone line

Mon Sep 23, 2019 10:00 pm

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.

drgeoff
Posts: 9901
Joined: Wed Jan 25, 2012 6:39 pm

Re: Connecting raspberry pi to phone line

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.

User avatar
bomblord
Posts: 175
Joined: Sun Jul 14, 2019 2:54 am

Re: Connecting raspberry pi to phone line

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.
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.
Last edited by bomblord on Tue Sep 24, 2019 1:40 am, edited 5 times in total.

User avatar
Imperf3kt
Posts: 2892
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 1:10 am

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.
55:55:44:44:4C
52:4C:52:42:41

User avatar
bomblord
Posts: 175
Joined: Sun Jul 14, 2019 2:54 am

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 1:13 am

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.

User avatar
rpdom
Posts: 15426
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 7:34 am

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.

User avatar
rin67630
Posts: 568
Joined: Fri Mar 04, 2016 10:15 am

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 10:39 am

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...

User avatar
rin67630
Posts: 568
Joined: Fri Mar 04, 2016 10:15 am

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 11:03 am

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

plugwash
Forum Moderator
Forum Moderator
Posts: 3463
Joined: Wed Dec 28, 2011 11:45 pm

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 11:16 am

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.

User avatar
rpdom
Posts: 15426
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Connecting raspberry pi to phone line

Tue Sep 24, 2019 11:29 am

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.

Return to “General discussion”