Interface a rotary phone dial to an Arduino

Summary of Interface a rotary phone dial to an Arduino


An old rotary phone dial can be removed and wired to an Arduino to read dialed digits by detecting the pulse-making switch as the dial returns. Identify the normally-closed or normally-open switch contacts, wire them to an Arduino input with a pull-up/down resistor arrangement (470 ohm and 10K in the example), and run code that debounces pulses, counts them, interprets 10 pulses as zero, and sends digits over serial when dialing finishes.

Parts used in the Rotary phone dial to Arduino project:

  • Old rotary phone dial unit
  • Arduino (any compatible board)
  • Jumper wires
  • 470 ohm resistor
  • 10K ohm resistor
  • USB cable (for Arduino serial link to computer)
  • Protoboard or breadboard (optional for prototyping)

rotary phoneAn 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

Identify the switchOnce 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;
}
For more Detail: Interface a rotary phone dial to an Arduino

Quick Solutions to Questions related to Rotary phone dial to Arduino project:

  • How do you remove the dial from the phone?
    Pull the dial unit out if it pops out; otherwise open the phone and unfasten connections, noting wire colors for reassembly.
  • How do you identify the switch that produces pulses?
    Spin the dial by hand and observe the back: you should see a switch making and breaking a circuit corresponding to the number dialed.
  • What wiring arrangement is used in the example circuit?
    The example connects the two switch terminals to jumper wires, with a 470 ohm resistor and a 10K resistor creating a pull arrangement so pin 2 goes HIGH on pulses.
  • How does the circuit interpret dial pulses as HIGH or LOW?
    The dial switch is normally closed, tying the Arduino input to ground (LOW) via the 470 ohm resistor; when the switch opens during pulses, the input is pulled to 5V through the 10K resistor and reads HIGH.
  • What if the dial switch is normally open?
    Swap the positions of the 10K resistor and the dial in the circuit so the logic corresponds correctly.
  • How does the Arduino code determine when a digit has finished dialing?
    The code waits a set timeout (dialHasFinishedRotatingAfterMs) after the last state change; if needToPrint is set, it prints the count mod 10 and resets the count.
  • How are 0 and 10 pulses handled in the code?
    The code sends count % 10, so 10 pulses are interpreted and sent as 0.
  • What code strategies are used for mechanical noise?
    The code uses a debounceDelay to ensure state stabilization before counting pulses.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top