Rotary Pi Phone | Bringing an Analog Device into the Digital Era

David Jordan
6 min readMar 13, 2021

I live in a beautiful century home in Northern Kentucky that I purchased a few years back. Over time I’ve been slowly decorating the home in a modern industrial style.

My century home that is over 120 years old. Also, Go Pack!

Unfortunately, this old phone nook has been empty since I bought the house because I couldn’t decide what to put in it.

When I stumbled upon an article by Alasdair Allan detailing his creation of a raspberry pi powered rotary phone, I knew I wanted to attempt a build of my own and put the finished product in this nook.

Gathering the Supplies

Supplies

I started off by purchasing an old 1949 Western Electric Model 500 from my local antique mall as well as a version 1 Google AIY Voice Kit. I already had a raspberry pi on hand from previous projects. In addition to the phone, pi, and AIY Voice Kit, I also had to purchase some jumper wires, Sugru moldable glue, heat shrink tubing, and a micro SD card.

Teardown

With the supplies in order it was time to begin the teardown.

Inside of the phone after the cover was removed.

I was not anticipating the phone to be fully analog and had never taken on this huge of a wiring problem before. Even the mechanism that detected the hook being up or down was based on copper circuitry.

Old school circuitry and wiring.

Rewiring the Phone to Convert it from Analog to Digital

Looking at the wiring diagram for the various versions of 500 series helped me begin to understand which wire was responsible for which action. I was quickly able to assess that the braided wire in the middle of the previous picture was responsible for the audio (white) and microphone (black/red) of the headset. I disconnected those wires from the terminal and attached the white wires to the audio ports of the AIY Voice hat as shown below. It wasn’t necessary to connect the black and red wires because the AIY Voice hat has its own microphone chip.

AIY Voice Hat and wired headset

The next challenge was figuring out which wires’ detected the lifting and falling of the receiver. I took off the green cover holding all the wires to the hook and slowly began disconnecting them from their terminals one by one.

Circuitry of the 500 Series’ Hook

Through a lot of trial and error, and a mild electric shock, I was able to identify the wiring that completed the circuitry of the hook. I stripped those wires and connected them to a set of jumper cables with heat shrink tubing. I also connected the microphone chip to the AIY Voice hat.

Writing the Code

Alasdair’s previous Medium article had a code file that he modified based on the original AIY Voice code file. As to not fully reinvent the wheel, I used this code as a launching point for my own coding endeavor. With Alasdair’s code as a base, I was quickly able to figure out how to detect the rising and falling, or opening and closing, of the circuitry when the headset was lifted or put back.

AIY Voice Hat Open Ports Diagram

Using the AIY Voice Hat diagram above I connected the jumper cables for the hook to GPIO04 and GPIO17. With this completed, I booted up the PI to test it out and was surprised when it booted successfully.

AIY Voice Kit Raspberry Pi Splash Screen

A Brief Intermission

With the phone working I took a break resting on my laurels and to psychologically recover from that mild electric shock.

Connecting the Rotary Dialer

I came back refreshed from my break and ready to advance the Rotary Pi Phone even further.

The next project I wanted to tackle was connecting the rotary dialer to the Pi board so that the Assistant was activated after the dial was moved. Through a little bit more trial and error, I identified the proper cable, stripped the wiring and connected it to a jumper cable and the pi board. This step really helped the Rotary Pi Phone feel like a working rotary phone.

Wrapping up the Code

With the rotary dial connected the the pi, it was finally time to wrap up the code and make it feel more personable and custom.

I used Natural Readers text to voice software to create two audio files that sounded similar to my Google Home Mini voice assistant’s British tone. The new audio file is triggered when the rotary dial is moved and says “Hi, I’m Laurel the voice assistant for Laurel St. What can I assist you with today?” A snippet of that sound is included below. This change really gave the assistant a personality and was customized to fit my home.

Wrapping up the Build

As I started to box up the pi inside of the phone’s base, I wanted to make it as easy as possible to power it on and off. As such, I purchased an on/off USB toggle switch from Amazon and connected it to the pi via a small hole in the side of the phone’s casing. Once that was complete, I plugged it in and ensured everything was working as designed.

Working Pi Phone in Action

Asking the Rotary Pi Phone Assistant to Turn on the Lights. My Dog Zoey also says “hi.”

Final code file

#!/usr/bin/env python3
#
# Base code from Alasdair Allan. His full write up can be found at https://medium.com/@aallan/a-retro-rotary-phone-powered-by-aiy-projects-and-the-raspberry-pi-e516b3ff1528.
# Modifications made by David Jordan March 13 2021. His write up can be found at https://medium.com/@imdavidjordan
import logging
import sys
import threading
import RPi.GPIO as GPIO
import pygame
import aiy.assistant.auth_helpers
import aiy.voicehat
from google.assistant.library import Assistant
from google.assistant.library.event import EventType
import time
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s"
)
class MyAssistant(object):
def __init__(self):
self._task = threading.Thread(target=self._run_task)
self._can_start_conversation = False
self._assistant = None

self._hook_is_down = 1;
self._hook_up = aiy._drivers._button.Button(channel=4,polarity=GPIO.FALLING)
self._hook_up.on_press(self._handset_lifted)
self._hook_down = aiy._drivers._button.Button(channel=17,polarity=GPIO.RISING)
self._hook_down.on_press(self._handset_replaced)
pygame.mixer.init()
pygame.mixer.music.load("/home/pi/dial-tone.wav")
def start(self):
self._task.start()
def _run_task(self):
credentials = aiy.assistant.auth_helpers.get_assistant_credentials(credentials_file="/home/pi/assistant.json")
with Assistant(credentials) as assistant:
self._assistant = assistant
for event in assistant.start():
self._process_event(event)
def _process_event(self, event):
status_ui = aiy.voicehat.get_status_ui()
if event.type == EventType.ON_START_FINISHED:
status_ui.status('ready')
self._can_start_conversation = True

aiy.voicehat.get_button().on_press(self._on_button_pressed)
if sys.stdout.isatty():
print('Press the button, then speak. Press Ctrl+C to quit...')
elif event.type == EventType.ON_CONVERSATION_TURN_STARTED:
self._can_start_conversation = False
status_ui.status('listening')
elif event.type == EventType.ON_END_OF_UTTERANCE:
status_ui.status('thinking')
elif event.type == EventType.ON_CONVERSATION_TURN_FINISHED:
status_ui.status('ready')
self._can_start_conversation = True
aiy.audio.play_wave("/home/pi/Hang_Up.wav")
if self._hook_is_down == 0:
pygame.mixer.music.play(loops=-1)

elif event.type == EventType.ON_ASSISTANT_ERROR and event.args and event.args['is_fatal']:
sys.exit(1)
def _handset_replaced(self):
print('Hook down')
self._hook_is_down = 1
self._assistant.stop_conversation()
pygame.mixer.music.stop()
pygame.mixer.music.rewind()
def _handset_lifted(self):
print('Hook up')
self._hook_is_down = 0
pygame.mixer.music.play(loops=-1)
def _on_button_pressed(self):
if self._hook_is_down == 0:
if self._can_start_conversation:
pygame.mixer.music.stop()
pygame.mixer.music.rewind()
time.sleep(.5)
aiy.audio.play_wave("/home/pi/Hi I'm Laurel.wav")
aiy.audio.play_wave("/home/pi/What can I assist with today.wav")
self._assistant.start_conversation()
def main():
MyAssistant().start()
if __name__ == '__main__':
main()

Closing Remarks

Overall, this was a very fun project completed during the harsh winter months in Northern Kentucky. It also gave me a functional décor item that really tied my home together. I’m looking forward to having friends over in a post COVID world and letting them interact with my custom voice assistant in a rotary phone’s body.

--

--

David Jordan
0 Followers

I’m a Spatial Data Science Manager during the day but when I’m not working I like to spend my time creating and working hobby projects. Views expressed are mine