I found an old Western Electric rotary phone in my attic. It's really an amazing piece of hardware. It seems to work fine several decades after its construction despite whatever abuse it took before ending up in my attic. However, I don't currently need a rotary phone.
So I decided to put a Raspberry Pi inside it. I decided to make it an MP3 player that's simple and robust for my daughter, but I guess it can actually be a general-purpose (if inconvenient) computer.
The pictures show the finished product. My goal was to leave the phone as intact as possible (ars est celare artem), so the main sign anything has changed is that the port on the back is now micro USB rather than a modular phone jack. I also added a switch to power down the Pi in the handle below the hook, but I wish I hadn't -- the handle was really comfortable for carrying the phone and the switch gets in the way. So these instructions don't show that part. Since I wanted to add as little as possible, I put the speakers in the headset.
Here are the things I used.
Raspberry Pi I used a model B but it should be possible to modify the instructions for another model instead
First you have to open the phone and remove the stuff that takes up all the space
Next, I cut a polycarbonate sheet to mount the Pi away from the metal base. I cut with a box cutter, scoring halfway through then cracking at the cut. Then I drilled holes by hand -- I broke some pieces using an electric drill, but maybe I lack technique.
The first picture is the template I cut from. The second picture is the actual sheet I used. Obviously I made some mistakes getting the sheet to look like the template. In particular, I accidentally broke the tab in the upper right, which I still think would be better to have but oh well. Also I put several holes in the wrong places. The measurements on the template are close but I actually drilled by putting the sheet in place and marking.
The third picture shows the sheet with screws attached. These will eventually attach the Pi to the sheet.
The fourth picture shows the sheet mounted to the base of the phone, and the fifth shows the Pi positioned on the sheet.
To figure out how to use the phone devices as input to the Pi, I used this schematic.
Basically, the hook, the rotary, and the dial can be viewed as independent switches. The hook switch is open when the receiver is on the hook then closes when the receiver is lifted. The dial switch is open when the rotary is in its default position and closes when the rotary is moved away from the default (opening again when it gets back). The rotary switch rests in the closed position, then opens and closes as many times as the number that was dialed.
I wired each of these switches to a GPIO pin using a jumper cable. For each switch, I included a 10k ohm resistor as shown in the wiring diagram. In the diagram, the top color labels describe the colors of the wires in the phone. The bottom color labels are just colors I used but do match what's pictured in the second picture.
To make it easy to connect and disconnect the wiring, I made my own "rainbow cable" by gluing together the jumper terminators. I chose a row of GPIO pins that were all in a line. Specifically I connected to pins 9,11,13,15 and 17 which include a ground (pin 9) and a 3.3V (pin 17) and between them three GPIO pins. I wired the rotary to pin 11, the dial to pin 13 and the hook to pin 15, as shown in the diagram.
I removed the speaker and microphone from the receiver and replaced both with new speakers. I wired them for stereo through the twirly cord. So that's seven soldering points, shown here.
In hindsight it might have been more fun to keep the microphone and just have mono audio.
After replacing the heavy speaker and microphones with newer lighter speakers, the receiver was no longer heavy enough to keep the hook down on its cradle. The spring would push it back up. So I added some ballast to the receiver, in the tube connecting the mouth and ear pieces.
The power cable was the hardest soldering of the project. The female plug has small tabs, but fortunately we only need two of them to carry power. I caulked it to the rear of the case. The male plug is even smaller but finally I got it to work. To figure out which tabs to used I followed some guides for the male and the female.
You can download the Arch OS for the Pi from archlinuxarm.org
I do all of these steps on a linux box I use. If you want to use something else, look here
Here are the commands on linux:
wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.zip wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-latest.zip.md5 cat ArchLinuxARM-rpi-latest.zip.md5
The 32 character blobs spit out by the last two commands should match. If they don't something weird may be happening.
To write the image to the sdcard, I use
dd bs=1M if=./ArchLinuxARM*.img of=/dev/sdX # replace X with location of SD card
This takes some time.
The image we wrote to the SD card was only 2G. To make use of additional space on the card (if any) we need to resize the partition.
I used gparted on my linux box, and it worked fine.
At this point you can put the sdcard in the Pi, connect a network cable, and boot. You should see some blinking lights on the Pi.
Since there is no monitor/keyboard attached to the Pi, I connected remotely via ssh
The default password is "root" and should probably be changed. I do change it, but since the Pi has no external connections I'm not sure how important that is.
To update the operating system software and install required software:
pacman -Syu nodejs rsync parallel mpc mpd espeak alsa-utils git
This will prompt you to continue by pressing 'Y' or enter. Then it will download and install several packages, which will take some time.
Now there is some software supporting the phone devices, which can be installed with
npm install -g git://github.com/steven-gardiner/piphone.git
When that command completes, to configure the software you can now use
bash /usr/lib/node_modules/piphone/config_mpd.sh bash /usr/lib/node_modules/piphone/install_crontab.sh
(Optional) If you do use a USB audio adapter then you'll need to configure alsa to use the adapter, using the command
Don't close the ssh session yet because we will use it in the next step.
The point of this project was to make an anachronistic MP3 player, so we'll want to load some MP3 on the Pi. This step assumes you still have an ssh session to the Pi which we established in a previous step.
(Optional) If you don't have a set of MP3s in mind, these commands will download some Creative Commons samples to get you started
mkdir -p /var/lib/mpd/music/samples (cd /var/lib/mpd/music/samples; bash ~/node_modules/piphone/samples.sh)
Provided you have some MP3s available on your linux box, you can put them on the Pi with the following commands
On the Pi:
mkdir -p /var/lib/mpd/music
On the linux box:
rsync -av /path/to/music/* email@example.com:/var/lib/mpd/music/
When this command has completed (and anytime you alter the contents of the /var/lib/mpd/music/ directory) you should run the following command
When that command completes you can tell the Pi to shut down:
You should see the blinking lights dwindle down to a single light which indicates the power is attached. You should now disconnect the power and the network cable.
At the end of the last step, you powered off and disconnected the Pi from power and network.
Next you can hook up the GPIO pins, plug the headphone jack from the headset into the audio jack, and connect the power cable from the case to the Pi.
Then you can close the case, making sure to massage any wires out of the way of the hook mechanism. Make sure for instance that the plastic tabs that protrude from the hook cradle pop up when the case is closed.
When the case is closed, you're done. You should be able to plug a micro usb cable into the back of the phone and after a few moments the phone will be ready to do your bidding.
With the default software, to power down, you dial "1178." Because of some bugs in the software, you may need to dial it a few times for it to take.
The other commands (you can edit the software to change them) are
1: play the current song softly
2: play the current song loud
3: play the next song softly
4: play the next song loud
5: play the previous song softly
6: play the previous song loud
7,8,9,0: search for a song by title and play it
After playing a song the phone will stop and wait for further input.