QRD: Quantum Rotary Dial, Part 3

Arduino Nano programming

Guidomax wrote this sketch for the Arduino in his instructables: https://www.instructables.com/Interface-a-rotary-phone-dial-to-an-Arduino/

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;
}

It worked perfectly for me. I ran this command from the terminal to confirm the Arduino was sending signals.

screen /dev/cu.usbserial-AM00GQIK 9600

You will probably have to change the serial port (/dev/cu.usb…) but the baud rate (9600) should be good.

Once everything was wired up and the Arduino was programmed, I was ready to move onto the python script! This script would listen to the serial port and react to the dialed in numbers.

Python programming

This was the bulk of work I needed to do. I didn’t want a rotary dial which only set the volume. I wanted it to be a working number pad. I wanted to be able to type with it. I wanted it to trigger Alfred workflows. I wanted it to type common phrases I use a lot (not passwords!)

Since the script would interpret the rotary dial’s input differently depending on the mode it was in, I also wanted this script to provide some basic UI to let the user know the active mode. The rotary phone didn’t have any lights (and I didn’t want to add any) so I opted to create a little statusbar app.

The code is available here: https://github.com/Nathancooke7/quantum_rotary_dial

The README covers how to use the dial and the various features I’ve implemented.

Conclusions

This was a really fun project! I got to work on my soldering skills a bit. I learned about programming Arduinos. I learned the basics of GUI.

I’m using the rotary phone to trigger Alfred workflows which message a Slack channel to let people know I’ve signed in/out of work or gone on my lunch break. I literally dial in every morning.

I hope I’ve inspired you to pursue a side project, especially this specific one. I’d love to hear how people are using QRD to improve their lives.

QRD: Quantum Rotary Dial, part 2

With my research phase complete, I had a clear understanding of components to buy and how they’d go together. Huge thanks to CameronCoward for his instructables post: https://www.instructables.com/Vintage-Rotary-Phone-Dial-PC-Volume-Control/

It’s a rather simple system:

  1. As the rotary dial spins, it will open and close a circuit.
  2. This opening and closing changes the voltage of a circuit.
  3. The Arduino Nano interprets the change in voltage (high/low) to count the “clicks” of the rotary dial and send a number over to the serial port.
  4. A python script on the computer will listen to this serial port, accepting the numbers and doing something with them.

The hardest part for me was removing the dial. A number of screws had rusted. A little WD-40 helped. In one case, the screw head was stripped and I had to use a hacksaw to cut a new slot for the screw driver.

Once everything was apart, I also removed components I didn’t need. There was a plastic box that everything wired into. Removing that created plenty of room for the breadboard circuit.

If you are interested in building this for yourself, I highly suggest you read through Cameron’s post as well as Guidomax’s instructables: https://www.instructables.com/Interface-a-rotary-phone-dial-to-an-Arduino/

Below is the circuit diagram from Guidomax:

Next: Programming

QRD: Quantum Rotary Dial, Part 1 – A Quarantine Project

As with many other people around the world, I’ve been self-isolating for the past decade. Or at least, it feels that long. I decided to put this extra time to good use by pursuing projects and passions I would have otherwise only dreamt about.

I wanted a project which would involve hardware and software; would push me to learn new skills and technologies; and would be fun. After all, this is meant to be an enjoyable experience.

I got the idea it’d be pretty cool to repurpose a rotary dial telephone to be an input device for my computer. So, I came up with a game plan:

  1. Research
  2. Build
  3. Program

Research Phase

In this phase I wanted to answer the following questions:

  1. How much are rotary dial phones?
  2. Has this been done before? If so, how did they do it?
  3. What are the components I’d need?

Finding the phone

The first question took priority because I didn’t want to spend an astronomical amount on what’s essentially a toy. I didn’t have a clear use-case for the end product. This was more about the journey, or the learning experience, than anything else.

A quick glance at ebay revealed a wide range of prices for rotary phones. I could find something reasonable for me.

I settled on a vintage 1970s ITT Model 500 Series in chocolate brown, as seen in the picture above.

On the shoulders of Giants

I’m a firm believer that we should build on the knowledge of others. Often times, we’re not the first person to encounter the problem and, with any luck, a solution might already exist.

A few evenings of internet searching revealed a number of interesting projects on rotary dial telephones.

rotaryX: A Question and Answer Machine

Link: https://www.instructables.com/RotaryX-How-to-Hack-a-Rotary-Phone/

This project is awesome. It gives you full control over every aspect of the phone: dial, hook, ringer, and receiver.

It’s also much bigger in scope than I’d originally planned. I really only wanted to use the rotary dial part.

Rotary Contoller Dials in PC Volume

Link: https://hackaday.com/2020/06/04/rotary-controller-dials-in-pc-volume/

Sometimes, the stars align. I’d started researching on June 5, 2020. This article was published on June 4, 2020. This project was extremely close to what I’d envisioned. I wasn’t going to remove the dial from the phone and print new case, but I was confident that the components would fit inside the original housing.

Within the article is a link to the Instructables by Cameron Coward: https://www.instructables.com/Vintage-Rotary-Phone-Dial-PC-Volume-Control/

It was everything I needed to get started. I was ready to start building

Purchasing Parts

Thanks to Cameron’s instructables post, I knew I needed the following:

  1. A rotary phone
  2. Arduino Nano
  3. Resistors (470 ohm and 10k ohm)
  4. Solderable bread board

The resistors and bread board were nominal cost. The phone was $20 (plus shipping and tax) and the Arduino cost me $17. So in total, this project cost about $50.

Next: Build Phase