I started work on this project quite some time ago and have been working on it on and off. It was meant to be a puzzle / game sort of thing, but i have recently discovered that is is perfect for practical jokes too!
I had been thinking about doing a project involving sound files, so when I came across an old rotary phone at a garage sale the pieces started to come together. The concept of freakyphone came together after much thought, and took on many different forms before I ended up with the final concept. First I thought about making a Mass effect like conversation system based around a murder investigation. You would then play the role of a detective tasked with solving the case. You would have to talk to witnesses and interrogate suspects. If you found the killer you would win the game.
However this would require me to come up with a big and compelling story tree involving several characters and a lot of sound recordings (not to mention compelling voice acting).
In the end I ended up with something somewhat simpler yet funny and interesting.
Freakyphone is an old rotary phone that plays all sorts of funny movie quotes, internet memes, music etc. when the phone rings, and you pick it up, it will play a random file from an SD card.
The very first time you answer a “call” the phone will present itself, and explain the rules of the game. Among all the funny soundfiles on the SD card are 6 clues leading to the name of a historic person. If you enter this persons last name using the letters on the phones rotary dial, the phone will play a special WIN sound for you. So all you really have to do, is to be patient and pay attention to whatever the phone says.
The brains of the phone is an ardino duemilanove and a sound shield from adafruit. I wanted to preserve the old school look and feel of the rotary phone so I planned to replace the huge AC solenoid bell with a DC one. However this proved to be unbelievably troublesome.
Above is a picture of the old AC driven solenoid bell. It is built (like the rest of the phone) to survive a nuclear war if necessary. Back in those days it seems everything was build to last for generations.
In the end I used a electronic buzzer instead of a bell. I used a lot of time trying to mod an old DC doorbell to fit, but it was just not very practical. I also tried to make my own smaller bell system using the solenoid hammer system from the DC bell with a custom machined bell plate. However it proved to be a huge waste of time, as there was simply not room enough for a proper bell solution, while still leaving enough room for the electronics.
Interfacing the dial system with the microcontroller proved to be easier than I had thought. The dial has 3 wires, one of them is common GND or Vcc, the second one is for signaling when the dial is in its home position, and the last one is pulsing on and off when the dial is on its way to its home position. If you dial 8 and let go, the pulse line will pulse 8 times. So all that is needed, is to count the pulses when the “dial in home position” signal is not true. Almost like it was made for interfacing with a microcontroller... ;-)
This picture is taken early on in the build during the initial testing. You can see the 3 wires coming from the dial connected to the microcontroller.
Initially I intended to replace the old style speaker in the earpiece with a more modern speaker to achieve better sound quality. I looked around for a new speaker of the right size and found that a leftover one from [one of my previous projects] was a perfect fit.
However replacing the speaker caused some annoying problems. because the new speaker was smaller and thinner than the original, it was creating echos inside the speaker compartment of the earpiece causing terrible sound quality. The volume was also a bit low since the backside of the speaker was not sealed off from the front side. This causes the sound waves produced by the backside of the speaker membrane to cancel out the sound waves from the front side, resulting in lower volume. And finally I was not happy with how the reduced weight of the new speaker caused the earpiece to feel out of balance in your hand. In the end I decided to try the original speaker with the adafruit sound board even though the speaker was terribly out of spec. The adafruit board is designed for a 8 ohm speaker (the output from the board is only 100mW I think), the original speaker from the earpiece is 32 ohms! To my big surprise it worked brilliantly! The volume was much higher, and the sound quality was not bad at all. It is clear however that this kind of speaker was designed primarily for speech. When playing complex music, the sound isn’t as rich as it could have been, but it is fair enough. And then when the sound being played actually is speech, it sounds sweet as hell!
For power I used an old power supply from a broken external USB disk drive. It outputs both +5VDC and +12VDC (both regulated). 5 volts for the arduino and 12 volts to beef up the buzzer.
Since I originally intended to install a real solenoid bell, I had installed a N-channel mosfet to drive it. Now the mosfet is really just used for level shifting for the buzzer. Huge overkill, but what the heck. Also take a look at the picture below, these old phones comes complete with mounts for mosfets ;-).
even though I am not the most experienced microcontroller programmer in the world, the program for the arduino came together without much hassle. The most troublesome part was figuring out how to use the library for the sound shield, but after peeking in some example code I was able to work the quirks.
Sourcing the sound files
The adafruit sound shield that I am using has some limitations. It is important that the files on the SD card are placed in one unbroken data block. If you delete a file and add another, the files may no longer be placed like that, so if you want to be sure everything is placed right you have to format the SD card and add all the files again. It only supports FAT 16, and it is very picky about the kind of sound files on the SD card. It will only play totally uncompressed WAV files as it has no mp3 decoder chip. For best sound adafruit recormends to use 22KHz, 12bit uncompressed audio.
These limitations meant that i had to convert all my files to 22KHz 12 bit mono audio. However i could not find any decent program that would allow me to convert to 12 bits so my files are actually 16 bits. Is seems to work okay though.
I got most of the audio for the project by stripping it of various youtube videos using this site: http://www.listentoyoutube.com/. Is returns the soundtrack of the video in mp3 format. I have not made much use of any batch conversion software, as many of the original files needed editing as well. For editing i used a nice program called Free Audio Editor 2010. Editing all the files has by far been the most time consuming part of this project, but all things considered it was really not that bad. In total, including the clues, the phone holds 152 different sound files.
Since Freakyphone is to be given to a friend of mine for him to solve, it was very important to test it thoroughly, as I would not always be around to fix any problems that might arise. I once made a box that recuired a 6 digit code to be entered before the box would unlock and spill its secrets. Unfortunately the box opened prematurely due to a defective microswitch. (luckily my friend had the decency to report the problem). Determent that something like this should not happen to freakyphone, I tested it intensely before handing it over to my friend. I left the phone on for several days in a row, (even through the night) exposing the system to everything I could think of.
I have learned that if you ever notice something about a system that acts odd or unreliable, it will most likely not only cause confusion, but eventually one day bring the entire system to its knees.
I wanted to get a rough idea about how many calls on average it would require to hear all 6 clues. Not quite sure how to calculate a statistically reliable answer, I decided to write a small program that would create a random number using the same pseudo-random function used in the freakyphone program. The program would then count how many program cycles (random numbers) it would take to eventually having hit the numbers 1 though 6. (the 6 clues). After running the program several times and averaging the outputs the result came out to be about 310, which I was very happy with.
When I was almost done with the project I found [this] mp3 sound shield on sparkfun. They must have announced it just after I started the build (*typical*). If I ever decide to build another of these phones, I will most probably use one of those instead of the adafruit one.
Take a look at freakyphone in action: http://www.youtube.com/watch?v=GdDxavA3RRY