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












































Visit Our Store »
Go Pro Today »




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
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
Thanks a bunch for these instructions, a great help!
-use as a dieselpunk safe/door lock.
-Interface dialer, handset, and google voice to receive and make calls from a physical phone.
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.
I too measure my time scale by bovine vocalization! haha
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.