Вы находитесь на странице: 1из 12

Arduino Collection

A collection of Arduino projects. Many related to X10 home automation but


others are based on current projects. The goal for X10 stuff is to open it up
so that the hobbyist can expand X10 capabilities beyond the limitations of
the commercial software that is currently available.

Wednesday, December 9, 2009

Telephone Interface (updated 12/30/09)


This project describes an Arduino/MCU interface to a telephone land-line.
It's only been tested on a US version of the telephone system, but hopefully
it will apply to the phone system in other countries.

The basic idea was to allow the MCU to make calls by transmitting DTMF
tones, and to receive and decode DTMF tones (keystrokes) made on the
phone that was called.

There are other possibilities however. Using the complete interface, it


should be possible for the MCU to answer calls, and to transmit "room
sounds" picked up by a microphone to the other phone.

If you're only interested in sending and receiving DTMF tones and not
interfacing to a phone line, you can skip the next dozen or so paragraphs. The
schematics and code samples will still apply. 

It all begins with the interface to the actual telephone line. Unfortunately
this is trickiest part!

There are two reasons for this:

1. Phone lines require a 600 Ohm "balanced line". You can't just slap any
old circuit between your "TIP" and "Ring".
2. It's illegal!

Lets start with #2. Here I'm speaking from a US and Canadian perspective,
but I'm sure it's similar in many countries. In the US, it's FCC Part 68 that
makes it illegal to connect any unapproved device across your phone lines.
So what can they do? Well, I'm sure it's much worse than tearing off that
tag on your mattress.  I've read that if you create a problem that must be
investigated by the phone company, and it's due to a little circuit
you whipped together - your financially liable to cover the cost of the phone
companies time. And it's relatively easy to do horrible things to your phone
line during the process of creating an interface, and that leads to point #1.

When you Google "phone interface" you'll be drinking from a fire hose of
circuits, methods, and projects. I spent a lot of time researching them, and
did indeed come up with an interface that "worked". However, what I ended
up with, struck me as being sensitive to component values, and somewhat
"fragile". By this I mean, for example, that the correct "polarity" for TIP and
RING was required. Given that the line should be "balanced" I felt like I
disturbed the balance of the force. In short, after all of my experience with
electronics, I felt like I was over my head with the interface I came up with.
Ironic considering you're dealing with a system that has been around for so
long.

For those who want to ignore points 1 & 2 above, here are some of the best
resources I found, as well as the schematic for the "working" interface I
was using. Big disclaimer here! I do not recommend building your own
unapproved interface. Furthermore, I am not responsible for anything you
do with any information I am providing. Everything here you use at your
own risk.

Some of the telephone interface links I found helpful are:


Good introduction - here

Project examples - here and here

Other info - here and here and here


Just looking at the variety of this information should give you an idea what
your up against when rolling your own POTS interface. The interface that
I tried is here.

Not a very encouraging beginning is it?

Enter the "Direct Access Arrangement" DAA. This little module is an


FCC Part 68 approved interface. Does it make everything OK? I don't think
so - it really just makes it a lot easier for you to get your device FCC
approved. Will it give you peace of mind? You bet. After switching to a DAA,
the TIP and RING polarity did not matter, and everything seems to be much
more solid - calls go through 100% of the time. The DAA also saves you
from buying an isolation transformer, relay, transistor, and a large capacitor.

The problem is getting your hands on one without having to special order
54 of them from Mouser, etc. After a lot of searching, the best deal I found,
for my use, was for a Cermetek CH1817-LM (discontinued) still some left
on eBay - here. It will cost you $15-$18 shipped.

Note: If your interested in capturing caller ID, I don't think this is the DAA for
you. However, while searching I did see some that will output CID. I also ran
across the Holtek HT9032C which looks like an interesting CID chip, but they
seem to be hard to find.

Sorry if the above was long and detailed. I wrote it in the interest of saving
you a lot of time. However, as always, YMMV.

Once connected to the phone line, I wanted to do several things:


Have the Nex10 dial my cell when an event ("macro") was triggered.

Leave a message - a series of beeps.

Optionally be able to listen in on the room noise from the called


phone. (work in progress)

Capture any key presses I made from my cell. (Not sure how I want
to use this yet.)
Note that currently all the communication is initiated by the Nex10. In fact,
it is possible to use the RI (ring indicator) on the DAA to answer calls with
the Nex10. (No plans yet for this.)

To do the things above, I used 2 chips from Holtek - an HT9200B DTMF


generator to dial the call, and a HT9170B DTMF receiver to read the key
presses once connected. Both are less than 70¢ each at Futurlec.

I wired both chips per the datasheets and ran the HT9240B in serial mode.
Here is my schematic and an Arduino example sketch for the project at
that point.

I could have stopped there, but even with serial mode, the interface to the
MCU required 8 pins + power. I also want the Nex10 to accept "plug-in
modules" - so an I2C interface seemed like the way to go.

I picked the PCF8574 I2C GPIO chip to go between the MCU and the DTMF
chips. It's also available at Futurlec and is also wired per the
datasheet. (Note: the PCA8574 is a newer version and runs at the faster
I2C speed but was not carried by Futurlec.)

Both the DTMF receiver and the I2C GPIO have a nice feature that sets
an interrupt line when new data is received. I wanted to use the INT line on
the GPIO. However, because the DTMF receiver latches it's output, there
was no easy way to read multiple presses of the same key. So, I am
currently using the interrupt on the DTMF receiver (DV). Either way an
external interrupt is triggered when new tones are received. This saves me
from having to poll for changes.

Using the I2C GPIO with the interrupt line saves 5 pins on the MCU. Here is
the current schematic and Eagle files. And here is the current example
sketch for the completed project using the DAA, DTMF, and GPIO.

The short movie below describes the state of the project before adding the
GPIO. (Looks the same now - only less wires to the Arduino.)

Enjoy

BroHogan at 2:29 PM

41 comments:

Smoltis December 15, 2009 at 11:47 PM


Hi, what if I connect the unapproved device to my own PBX (in the office,
for instance)? It eliminates reason #2, I use certified device with telephone
company line and who cares about my internal telephone circuits...
Reply

BroHogan December 16, 2009 at 8:20 AM


I don't think you'd have a problem with the phone co., but I've heard that
PBX can be a different type of circuit than the phone line. You might want
to check into this before you connect anything to your PBX and cause a
problem for yourself.
Reply

Muris January 28, 2010 at 11:11 AM


Great job! I like this DAA circuit, I wish I knew about it when I was building
my phone dialer and phone line controller...
Reply

Muris January 28, 2010 at 11:18 AM


It's me again... just to tell you that you can connect both the DTMF decoder
and DTMF encoder to just one 3.58...MHz crystal. I did this with my project
here: http://www.elektronika.ba/508/phoneline-controller-v2/
Reply
BroHogan January 29, 2010 at 11:24 AM
Thank you Muris.
I was wondering if I could drive both chips with one crystal. I didn't try it
because during the build I had a lot of variables to deal with! So that's good
to know. Thanks for your comments.
Reply

CarmelaU January 30, 2010 at 11:04 PM


笑⼝常開~~天天開⼼.........................
Reply

Anonymous February 24, 2010 at 2:26 AM


keep update, please..bless you!!........................................
Reply

Anonymous October 12, 2010 at 10:51 AM


good hack
Reply

Erik August 24, 2011 at 6:29 PM


I was just wondering if it is possible to use an arduino (Uno) with DAA as a
door phone (two way audio) which connects to FXS port of asterisk ?
Reply

jeremy October 7, 2011 at 11:25 AM


heya,
id like to use this circuit as a doorbell intercom via asterisk and zoneminder
and fit it all in a double-gang box (here is a link to what i built so far)
http://i1113.photobucket.com/albums/k514/mdesade666/a53f2313.jpg
so, ANY advice and help? complete schematic? BOM? code snippets?
would be VERY helpful...
jeremy
Reply

BroHogan October 7, 2011 at 1:18 PM


heya to you too jeremy,
You should have found all the schematics and source code that I have
linked in the post above.

I should have provided everything to go as far as I took the project. It is


what it is. After that it's up to you to adapt it to your needs.
Reply

dmastuff January 3, 2012 at 12:09 PM


hey
wondering if there is any was too use this to measure how long a phone
call has been going

or would it be better to stick an opto coupler on the ring to measure the


current going through the line if a call is in progress?

thanks in advanced
Reply

BroHogan January 3, 2012 at 12:50 PM


@dmastuff
It's been a long time since I messed with this, but the DAA has an ON
HOOK signal line that maybe you can use and let the Arduino measure the
time.
If it were me I'd look at the schematic and example sketch and probably
take a shot at it.
Good luck with your project.
Reply

VapidVirupa September 19, 2012 at 9:24 AM


i would then like to ring the internal phone after the correct tone was
received (using it in conjunction with EasyVR to filter phone calls that
people don't correctly call ..... probably i need to stack these boards and put
the DAA on top of some empty shield with industrial glue for my
application.
This is for my netduino alarm ( making a alarm system and phone
filter/emergency dialer for elderly people )
http://sites.google.com/site/venvirupa/monotreme
Reply

m@tlabs November 4, 2012 at 7:34 AM


i am most curious about the power on the line, during our recent blackout
due to hurricane Sandy the only power into our phone was the still working
landline. If i could have hooked a few bright leds to it we would have had
some light too.
Reply

BroHogan November 4, 2012 at 9:21 AM


When I lived in Arkansas and before we had power I was thinking of getting
a little energy from the phone line. IIRC it's ~50V. With a buck regulator it
might be used to light LEDs and charge batteries.
However, I don't think the telephone company would appreciate it. :-)
Reply

VapidVirupa November 11, 2012 at 11:47 AM


Hey good idea i could turn on some emergency lighting ( probably battery
based topped up with the houses supply normally ) remotely using a dtmf
code for a elderly person in case of blackout or detect a drop in the house
supply and dial a code out to a monitoring station or relatives landline .....
cool is the design open source for people doing non-profit work like
myself? thanks for putting the schematics up i have my Cermetec module
now and RJ11 now to solder them to a board....
Reply

Replies

VapidVirupa November 12, 2012 at 8:55 PM


um on pin 1 of the ht9200 you have something going to CF where
does this go on the Arduino? also there is some pin on the pdf
for that chip called s/p to toggle serial parallel mode .... thanks

BroHogan November 12, 2012 at 9:19 PM


It's CE (chip enable).
For the non-GPIO example it goes to pin 3 (see sketch)

Reply

BroHogan November 11, 2012 at 12:13 PM


The design is open source - help yourself.
(Note that I am no longer active with this project so you are on your own.)
Reply
Fulano January 8, 2013 at 5:00 AM
Hello.

Is it possible to wire the dtmf's directly to the phone line?

thanks
Reply

BroHogan January 8, 2013 at 7:31 AM


If you mean without a DAA that is covered above.
In short, it's illegal, you get flaky results, and I don't support it. You are on
your own there.
John
Reply

Rich Mayfield April 4, 2013 at 12:43 PM


What about using a standard serial modem? They're like 30 bucks on
digikey:

http://www.digikey.com/product-detail/en/MT2492SMI-L-92/591-1064-
ND/1681859

Includes DAA, dtmf, all the good stuff, upgraded modules include voice
record/playback and speakerphone I/O...basically everything you want to
do, and it's an approved device. I'm pretty sure adding an arduino doesn't
compromise that. I mean, adding a computer to your faxmodem doesn't
invalidate it's fcc compliance.
Reply

kostelidis June 30, 2013 at 2:18 AM


Hello. It is an excellent post.

I have a question, what would it take if I wanted to transmit and receive


voice through the DAA? Like a real telephone?

Is it as simple as sending analog data to the TX line of the DAA and reading
analog data from the RX line of the DAA???
Reply
LuizAnonio Nascimento August 1, 2013 at 10:53 AM
Hello could you send me a schematic to make the link with the Arduino, I
learned to make this connection with the pins of the arduino right.
email: luiz_antoniosp@yahoo.com.br
Reply

BroHogan August 1, 2013 at 11:05 AM


All I have is in this post. If you look at the the example sketches (GPIO or
no GPIO) you will see the Arduino pins defined that go to the pins in the
schematic.

That's all I remember from 4 years ago. Hope it helps.


John
Reply

Jeffery Welch August 5, 2013 at 6:05 PM


Would VOIP get around the legality issues? Then there is no "phone line" to
connect to--you'd be connecting to the VOIP modem.
Reply

Replies

BroHogan August 5, 2013 at 6:55 PM


I would think so, it's not a Telco line, but I don't know for sure.
Also not sure if you would run other issues with VOIP.
Good luck!

Reply

Anonymous September 14, 2013 at 9:09 AM


This is a great circuit and I bought all of the parts and put it together
(without the GPIO). The dialer and message functions work, but I can't get
the receiver to work. I noticed after I wired everything up, I was left with
"DV" (pin 15 from the receiver) and the capacitors that on the schematic
are labeled to go to #1 and #2 on JP1. I couldn't find "DV" or the capacitors
anywhere in the code. I have a mock phone line made of a 9v battery it
seems to be working fine. I also skipped F1, F2, and V1. Thanks for any
help!
Reply
Replies

BroHogan September 15, 2013 at 6:49 PM


Sorry, it's been a long 5 years.
The receiver datasheet reminded me that DV is "valid data". My
guess is that it triggers the interrupt.

Anonymous September 16, 2013 at 4:34 PM


Thank's for your reply. I posted a topic on the Arduino forum
here: DTMF Reciever not working

Reply

Anonymous July 16, 2015 at 7:51 AM


This comment has been removed by a blog administrator.
Reply

Alexis Malolos November 21, 2015 at 9:16 PM


Sir, Have you worked on an autoanswer/ auto off hook circuit?
please let me know
Reply

Replies

BroHogan November 21, 2015 at 9:21 PM


Sorry, no. I haven't touched this project in 6 years.

Reply

Unknown December 5, 2015 at 1:47 PM


Sir, I am interested in your project. I want to use it to interface with my
alarm system , so that i can remotely
monitor/activate/deactivate my alarm system. Meaning, Free monitoring. I
am not sure which pins go to Arduino . I assume its the From MCU and To
MCU . Can you clarify?
Reply

Replies
BroHogan December 6, 2015 at 12:52 PM
I'm not anxious to re-look at a project I've done 6 years ago. I
think you can figure out which pins go where by looking at the
schematic and the pin map in the sketch. I'm pretty sure I have
provided all you need to duplicate this here.
Then if you have any specific questions I'll try to answer them.

Reply

Siddhant Luthra January 21, 2016 at 7:50 PM


Hi, I just want to send an audio signal using a regular telephone line locally
(dont need to dial), so basically the arduino will be connected to the
handheld telephone and i want to send the prerecorded audio to the phone
from the arduino. Although i do want the DTMF receiver to recognize which
key is pressed. Can you help me with this?
Reply

BroHogan January 21, 2016 at 9:03 PM


Sorry, I can't help you with that.
Reply

Guilherme Leite December 3, 2016 at 2:14 PM


This comment has been removed by the author.
Reply

Guilherme Leite December 3, 2016 at 2:15 PM


Hi, how does the audio interface works?

I connected directly XMIT+GRN to microphone and RCV+GRD to a


headphone, and all i can hear is noise from both side of the line (dialer and
dialed)

From datasheet there is no special handling for audio interface from


XMIT/RCV
Reply

BroHogan December 3, 2016 at 2:22 PM


What I described here worked. But this project is so old that I'm not
supporting it anymore. Sorry. You are on your own.
Reply

Add comment

Links to this post


Create a Link

‹ Home ›
View web version

Powered by Blogger.

Вам также может понравиться