My Projects

Homepage My sites My photos My projects Mackinak Island from my family's vacation there in 2017

Rotary dial encoding

July 20, 2020

This project started because I have a rotary dial phone that is broken and I would like to eventually fix it and play around with additional features by implementing the Raspberry Pi into the phone. I started by taking the dial out of the phone and hooking each set of switch wires (the rotary dial works by opening and closing two switches) up to the raspberry Pi, and an LED to monitor how the movement of the dial opens and closes the switches. The switches were monitored on GPIO 18 and 23, and the LED’s were controlled by GPIO 24 and 25.

Circuit diagram of how I hooked up the two switches in the dial to the Raspberry Pi, when the GPIO reads as negative the switch is closed.

One switch on the rotary dial stays open until you start to move the dial, the other switch stays closed until you let go of the dial and then pulses open as many times as the number you rotated the dial to. I made some code that checks if the first switch is open and counts the number of pulses on the second switch, then prints the number dialed. At first I was getting some inconsistent numbers until I realised the switch does not always open and close perfectly, so I added a condition that it can only count a pulse that is at least .01 seconds long and that was sufficient to fix the error.

About Me

Mountain View

Eagle Scout currently pursuing a computer science and engineering degree from the University of Iowa.