Introduction: Interface a Rotary Phone Dial to an Arduino

An old rotary phone can be used for a number of purposes in your Arduino projects - use it as a novel input device, or use the Arduino to interface a rotary phone to your computer.

This is a very basic guide describing how to interface the dial to an Arduino, and get the number dialed passed into a computer over the Arduino's serial link.

Step 1: Remove the Dial From the Phone

First step is to remove the dial unit from the phone. I'm using a GPO phone of some sort from the 1970s.

On this phone, the dial popped straight out - I just needed to give it a tug. If it doesn't, you may have to open up the phone and work out how to get it off.

There were five cables connected to the back of the dial unit. On my phone, these were regular spade connections, so I loosened the screws and pulled them out. If you want to re-assemble your phone, remember to record which color wire goes to which connection.

Step 2: Identify the Switch

Once the dial is out, it should be relatively easy to see how the dial converts rotary movement into pulses. Try spinning the dial by hand and watching the movement on the back. You should see a switch making and breaking a circuit rapidly - so if you dial '9', the switch should engage nine times.

For those of you who may never have used a rotary dial before - remember that the dialing only happens when you let go the number and let it spool back .

I've documented how it works for my phone in the Notes of the photo below.

There's also a blurry video of the mechanism working.

Step 3: Make the Circuit

Once you have found the switch that is being made and broken, you should be able to identify the connections by following the wires back to the connection terminals. In my case, the two sides of the switch are connected to the two leftmost terminals.

Hook up these terminals to some jumper wires, and get prototyping! The switch in my dial is always-on, and is broken for each pulse when dialling, so I used the very simple circuit below. Pin 2 will go HIGH for each pulse as the dial rotates.

When the phone isn't being dialed, the switch in the dial unit is closed (a so-called NORMALLY CLOSED switch, for obvious reasons) so the circuit connects pin 2 to ground (which to the Arduino is LOW). This is because there is much less resistance through the 470 ohm resistor than the 10K resistor.

When the phone is being dialed, the switch opens and closes rapidly (for a 9, it will open and close again nine times, remember). When the switch is open, pin 2 is not connected to ground - instead it is connected to the 5V supply through a resistance of 10470 ohms. This is interpreted by the Arduino as a HIGH.

If your dial has a NORMALLY OPEN switch, then swapping the positions of the 10K resistor and the dial should do the trick.

Step 4: Develop the Code

Now we need some code for the Arduino to count the pulses and send the total number per number dialed back through the serial port.

My code's below. As we're dealing with mechanicals here, yours may differ. Try playing about with the debounce constant and the 'how long do we wait before assuming dial has finished rotating' constant.

I've tried to comment it as neatly as I can. Hopefully it's pretty simple.

int needToPrint = 0;
int count;
int in = 2;
int lastState = LOW;
int trueState = LOW;
long lastStateChangeTime = 0;
int cleared = 0;

// constants

int dialHasFinishedRotatingAfterMs = 100;
int debounceDelay = 10;

void setup()
{
Serial.begin(9600);
pinMode(in, INPUT);
}

void loop()
{
int reading = digitalRead(in);

if ((millis() - lastStateChangeTime) > dialHasFinishedRotatingAfterMs) {
// the dial isn't being dialed, or has just finished being dialed.
if (needToPrint) {
// if it's only just finished being dialed, we need to send the number down the serial
// line and reset the count. We mod the count by 10 because '0' will send 10 pulses.
Serial.print(count % 10, DEC);
needToPrint = 0;
count = 0;
cleared = 0;
}
}

if (reading != lastState) {
lastStateChangeTime = millis();
}
if ((millis() - lastStateChangeTime) > debounceDelay) {
// debounce - this happens once it's stablized
if (reading != trueState) {
// this means that the switch has either just gone from closed->open or vice versa.
trueState = reading;
if (trueState == HIGH) {
// increment the count of pulses if it's gone high.
count++;
needToPrint = 1; // we'll need to print this number (once the dial has finished rotating)
}
}
}
lastState = reading;
}

Step 5: Check It Works!

Check it works by opening up a serial window (I use screen on a unix machine, you may want to use Hyperterm or similar on Windows), and try dialing some numbers.

Make sure that the serial program is set to read from the USB->serial adaptor in your Arduino (check the Tools->Serial Port menu in the Arduino software if you forget what that is), and a baud rate of 9600 bps.

You should see the correct number pop up as it's dialed.

Step 6: Hook It Into Something Useful!

I came up with a Quartz Composer file on my Mac to take the input and render it nicely to the screen. Once it's in the machine as serial data, you can do anything with it.

Waiting to hear your ideas!

I'll come up with a video of it 'in action' and printing the numbers to the screen as soon as I can get someone to hold the camera for me - wish I had three hands.

Comments

author
Foxtrot70 made it!(author)2013-10-29

Do you have a sketch where this converts rotary pulses to DTMF tones? I want to use an old rotary phone generating DTMF for dialing.

author
mannahusum made it!(author)2017-01-20

If you want to do it yourself using arduino hardware, I found a german website of someone who did it, including circuit descriptions and source code: https://www-user.tu-chemnitz.de/~heha/basteln/Haus...
Be aware, that you should replace the arduino bootloader and program the chip directly to be able to dial right away. The microprocessor, being powered by the telephone line, will start running only after you pick up the phone. If you keep the original arduino bootloader in, it will wait to be programmed before starting to run your own code, and this takes some time.

author
jayne15 made it!(author)2015-12-16

Just as a side note, I picked up an old old rotary phone at a yard sale and it works great on FIOS! But this would help since no one believes you when you push 0 and need help because you can't touch tone their menus.

author
Foxtrot70 made it!(author)2015-12-16

jayne15 - With a rotary to DTMF or Touch Tone converter if you need Operator / Attendant, you would dial 0 (zero) the circuit would convert the pulses to the appropriate tones and the system would then dial thru. The same goes for "press 1 for... or Press 2 for... " the converter circuit counts the pulses and the generates the tone desired. Here is a link to a device that does just that, this is it costs about $45. You install it under the base cover of the phone Hope this helps.

http://www.oldphoneworks.com/rotatone-pulse-to-tone-converter.html

author
simplybex made it!(author)2016-05-03

Hey @JMorton3 any chance you managed to do this? I'm looking to do something fairly similar for presenting a number of tracks in an exhibition.

I actually wanted the phone to ring and then play a track when the receiver is lifted. but that might be too complex...

author
simplybex made it!(author)2016-05-03

Hey @JMorton3 any chance you managed to do this? I'm looking to do something fairly similar for presenting a number of tracks in an exhibition.

I actually wanted the phone to ring and then play a track when the receiver is lifted. but that might be too complex...

author
EyalSch made it!(author)2016-04-28

worked for me. thank you.

just change the pinMode to INPUT_PULLUP

IMG_20160428_200302.jpg
author
PiotrK15 made it!(author)2016-03-03

How to store that data as 9 digit string and compare it with a specific one?

author
JMorton3 made it!(author)2016-01-04

Love the write-up! I have a question though - rather than sending the single numbers down the serial line to the computer, can they be stored in separate variables? Such as 1st number dialed is stored in numOne, second number dialed to be stored in numTwo, and so one, so that the Sketch can make use of them? I am planning on a rotary phone which, when dialed any two-digit number, will play a corresponding MP3 file back through the earpiece. Thanks in advance for any help on this!

author
Spyke12324 made it!(author)2015-04-18

Hey thanks for the help!! set up my rotary phone to transmit a signal to turn on and off outlets around the room.

Rotary Phone Switch.MOV
author
solohust made it!(author)2015-05-24

Could you please share your arduino code?

author
robot797 made it!(author)2013-12-21

i have a question
and i do need an awsner soon
how do you add the numbers to a giant string

i mean you dail 1 then 9 then 8
and get a variable of 198

author
solohust made it!(author)2015-05-24

Serial.println(count % 10, DEC);

if using println, the output will jump to a new line after printing.

Try to use print without line changing.

author
fejodor made it!(author)2015-03-22

Made it and it works like a charm, even without any adjusting.

Thanks for the pointers!

author
Marucotchan made it!(author)2014-10-13

Good Afternoon, please, you could tell as it did for the numbers appearing on your monitor ?? because I'm trying to do this and I can not.
I await return
py5kyw@yahoo.com.br

author
gal-x-e made it!(author)2014-07-08

i did it :) and it works :)

author
ezeisel made it!(author)2013-12-29

I just bought an old antique phone. Would love to have three options: (1) mod internals with modern phone to make calls through landline connection, (2) have mod to connect to iPhone/Android/Blackberry phone to make calls but through phone, and (3) set it up as a Skype or Google hangout steampunk styled device attached to a display/monitor with Webcam. I figure That I can come up with a 3-option switch that could allow me to select between the 3 options. Any thoughts on how to do parts (2) and (3) successfully?

author
robot797 made it!(author)2013-11-24

add it to a gsm shield and make a phone out of it

author
matsk made it!(author)2013-04-24

Changes to the code to cover different rotary dials.

Serial.print(count - 1);         // Rotary dials that begins with zero and ends with 9
Serial.print("  ")
Serial.println(count % 10, DEC); // Rotary dials that begins with 1 and ends with zero

author
englishfire made it!(author)2012-07-22

Hello, I just tried the code and it works. :)
My problem is this:
I'd like to enter a code via the telephone dial to open a door. If the code is correct then the door should open.
Can you help me??

Greetings from Germany Maik

author
FirebladeNL made it!(author)2012-07-03

This setup and program works perfectly on the old Dutch PPT T65 rotary telephone, just hooked it up. Now to figure out how to play sound so when the right number is dialled, one will get a certain message (that's for a different hobby of mine, geocaching)

Thanks a bunch for these instructions, a great help!

author
philip42 made it!(author)2011-12-06

Why is it necessary to disassemble the dial? Couldn't you read the pulses directly from the phone line (red and green wires). All it is is a sequence of open-close pulses from the mechanical dial.

author
TechDante made it!(author)2011-10-08

had a problem with getting teh wrong output to the numbers (1 became 2 and so on) solved it by changeing the debounce to 20mille seconds and this did the trick

author
alexhb made it!(author)2011-05-19

same setup here... makes for much easier programming ;)

author
Montrose made it!(author)2010-12-27

I like the Skype idea. One could install the necessary computer inside of an ornate base with a flat screen monitor mounted behind the phone and what ever other antique details. It could be a very Steampunk video phone or perhaps use aluminum and go with a Machine Age phone. Oh for the time to explore all the options.

author
jtmcdole made it!(author)2010-12-14

Idea:
-use as a dieselpunk safe/door lock.
-Interface dialer, handset, and google voice to receive and make calls from a physical phone.

author
TechDante made it!(author)2010-07-10

hello i am interested in electronics for my end of year project, but i am just starting out properly into electronics and programing and saw the arduino as a good starting point. could you recomend any reading material i could look into (already have the Arduino Notebook from their website and the make Magazine getting started with Arduino)

author
Irregular+Shed made it!(author)2009-12-30

 On the dial I've pulled out to use there's another switch that opens when the dial is turned to a number and closes when it has finished pulsing. I'm planning on using that instead of waiting longer because I'm also going to be having a keypad matrix to scan and an LCD to power!

author
kissiltur made it!(author)2009-10-20

splendid, splendid. Haven't thought about pulse dialling since I stopped working for a telecomms equipment company, lo, these many moos ago.

I had fun explaining to my four year old about how this phone works a bit differently from all the phones he sees in the house.

author
Father+Christmas made it!(author)2009-10-20

lol @ "many moos ago."

I too measure my time scale by bovine vocalization! haha

author
Aerospaced made it!(author)2009-10-20

Hang on a bit, you said that if you dial 9 that it will tap out nine times on the switch. As I recall, when hand keying a phone, you add 1 to every number.

author
guidomax made it!(author)2009-10-20

Hi,

Thanks for the comment - an interesting topic. It appears that the pulse dialing regime varies by geographic area, however in the UK (where this telephone is from) and North America, the number of pulses corresponds directly to the number dialed. This is certainly what happens for my telephone - obviously people in other countries may have to alter the source code to account for their particular phone.

Cheers :)

From en.wikipedia.org/wiki/Pulse_dialing :
In most countries one click is used for the digit 1, two clicks for 2, and so on, with ten clicks for the digit 0; this makes the code unary, excepting the digit 0. Two exceptions to this are New Zealand, with ten clicks for 0, nine clicks for 1, and so on, and Sweden, with one click for 0, two clicks for 1, and so on.

author
PS118 made it!(author)2009-07-20

One word: Skype! ;)

author
guidomax made it!(author)2009-07-20

It's a plan - that'd be pretty cool!

About This Instructable

80,738views

176favorites

License:

More by guidomax:Interface a rotary phone dial to an Arduino
Add instructable to: