Introduction: Retro Style Rotary Dial Mobile Phone
This project was driven by both practical need and wish to do something fun.
As most modern families, we stopped having real "home" phone (corded) many years ago. Instead, we have extra SIM card associated with our "old" home number, which I carried in my dual-sim cell phone. This was fine as a setup for most of the time, but it did not work best in some cases, like when we had our parents visiting (they are old generation - without cell phones, and I could not call them at our home when away since our "home" phone was with me). This was also amplified when I switched my phone (new phone having single sim slot). So, it seemed like a good idea to find a way to have "home" style phone which would be able to use our extra SIM card.
As far as fun part, most of the kids nowadays don't have much idea how old rotary dial phones worked, or that they even existed as such. In part of the world where my wife and I are from, we use expression "turn around the number" for dialing, which is confusing for younger population, since "why would anybody be turning the phone around to dial". Therefore, I thought that it would be cool to have my son (who was actively participating on this project) be able to get experience with rotary phone.
Of course, I was also sure that this "new" phone would be a nice conversation topic when we have friends and relatives over. Or even better, taking phone with us when visiting friends, surprising people with fully functional retro looking cell phone.
During project, we changed some of the original design goals. For example, I was thinking about embedding rechargeable external battery inside the phone so that it can be easily taken around, but eventually realized that this is not necessary (as this type of phone is naturally staying in one place all the time, so it can be always plugged into outlet). There were some other "shortcuts" that we were able to take, which made project relatively straight-forward and not too complex.
For material, I was originally hoping that we will be able to get old rotary phone from my parents and use most of it's parts (phone shell, rotary dial, headset, etc.), which would decrease cost of the overall project. That ultimately did not happen due to COVID-19, which prevented our planned trip to Europe (visiting family), and instead we just found and bought the new rotary dial phone on Amazon (I was not happy with options and prices on eBay). This was OK, as it provided some interesting additional functionalities, since we found rotary dial phone with extra dial options (* and #), not normally available on old phones.
Main part of the project was GSM/GPRS HAT that is readily available (we did not need 4G version), and which can be directly controlled with any Raspberry Pi or similar boards. In our case, we had small Raspberry Pi Zero board that we were not actively using (from my son's older project).
It is interesting that most of the thinking and design changes were done around relatively simple and small part of the project - creating ringing action. As those who are familiar with old phones know, distinctive old style ringing was produced by "bells" driven by 40-60 VAC, which was tricky to do as part of this project. I finally decided to simplify that part of the project, and ended up with relatively simple solution by using recordable sound module which is usually part of the greeting cards. There were some other options, but this actually worked great and was relatively inexpensive solution.
Step 1: Preparing the Phone
Old style corded phones are relatively simple devices. As it can be seen from the picture with original phone taken apart, reusable parts are main phone shell including rotary dial and base, headset and its switch, while the rest was taken out - ring bell and control board.
What was very nice with this particular model of phone is that we were able to not only re-use rotary dial but also its connector, which could be plugged directly into header on Raspberry Pi. Should be noted that this connector has 3 wires, one for reference, and 2 going to discrete inputs on Raspberry Pi. With appropriate logic (captured in attached code), this allows detection for when dial is turned, and which number was selected.
Same was true for headset switch, which has connector that can be directly plugged into header. It is simple logic, since it requires only reference and one discrete input.
As expected, headset cable have 4 wires, with 2 each for low-power-level speaker and microphone. Since HAT which we were using had 3.5 mm audio jack for headphone, I just end up connecting those 4 wires to one of old headphones 3.5 mm male audio plug.
One more interesting thing that was useful from this particular model of phone were mounting posts from phone base. While we needed to cut some of them to make space for boards, we were still able to reuse others, and secure our boards. This was nice break, and save us some time.
Step 2: Putting Things Together
For simple proof of concept, it is sufficient to connect Raspberry Pi and GSM HAT directly, and plug regular headphones into GSM HAT. I was able to use that setup together with MiniCom application (driving Raspberry Pi serial port, which is directly connected to GSM HAT) to quickly check that my SIM card is working and that I can call and send/receive SMS messages with that setup.
Since others might be interested to do that (it is fun to quickly test new setup), here are the pointers how to do that (obviously, based on assumption of the same/similar boards):
- Plug GSM HAT (with SIM card installed) into Raspberry Pi (make sure that GSM HAT has appropriate UART switch selection based on connection type, see below link for HAT manual). For this step you may need Raspberry Pi version which has header connector already installed, in our case I needed to solder it on (since I was using Pi zero, which by default comes without header). Alternatively, better option is to use micro USB cable to connect both cards (both Raspberry Pi and GSM HAT have micro USB)
- Enable use of Raspberry Pi serial port if connecting GSM HAT through serial port (by default, Raspberry Pi port it is used for console). To do that, you will need to follow instructions for raspi-config (see above "configure" link), interfacing options - enabling SSH and serial options. If using Lite OS version, you may also need to "connect to wireless network" and enable SSH (see instructions from above "configure" link).
- Connect Raspberry Pi to monitor and keyboard (or access it through remote ssh)
- Use MiniCom or similar serial app to manually control HAT through appropriate port (for my setup port was "/dev/ttyS0", it will be different if using micro USB). Install MiniCom with "sudo apt-get install minicom", and once installed start it with "minicom -D /devtyS0" (or whichever port is used).
- Use GSM HAT manual or AT Command manual to drive various HAT functions (send SMS, place call, etc.). Once properly connected, GSM HAT will answer with "OK" when queried by "AT" command. To check if SIM card was properly registered, use command "AT+CREG?", which should also return "OK". You can also verify network provider with "AT+COPS?", or check own phone number with "AT+CNUM"
To integrate the rest of needed parts, we created custom 16 pin cable for Raspberry Pi to GSM HAT, since we needed some of other general purpose IO pins to read rotary dial, state of headset switch and to drive bell ring (also to automatically start GSM HAT during power-up / initialization). I tried to use some of off-the-shelf breakout wires for Raspberry Pi for that purpose, and while that worked fine for quickly connecting and testing, I was not very happy with quality, and end up making my own 16 pin connector.
Other way to do the connection between Raspberry Pi and GSM HAT is through both boards micro USB ports (and again, you will need to set appropriately UART switch on GSM HAT), and that may be a faster and much simpler solution. You can easily do that if you get appropriate cable (that would save you time and effort to make cable) - just don't forget to change the port used by software/application.
After connecting boards (with micro USB), the rest is easy. Just follow above diagram, where pins presented there are associated with code attached at the end of this instructable. Specifically:
- Pins 35, 37 and 39 (associated with Raspberry Pi GPIO 19, 26 and ground) are used for connecting to dial (input pins). Phone which we chose had already built 3 wires connector, with red and black wire being associated with NO and NC pins, and yellow wire being common.
- Pins 23 and 25 (Raspberry Pi GPIO 11 and ground) are used for connecting headset switch (input - detecting when headset is lifted or placed down)
- Pins 22 and 20 (Raspberry Pi GPIO 25 and ground) are used for connecting to sound module switch (output - ring action)
- Additionally, pin 19 (GPIO 10) may need to be soldered to GSM HAT power switch, since some versions of HAT can't be started just by power-up, but need somebody manually pressing "power" switch on HAT.
- On phone side, we stripped out internal headset 4 wires cable, and connected to 3.5 mm audio jack from old headphones. Red/Green wires are for headset microphone, and Yellow/Black are for headset speaker. Depending on used 3.5 mm jack side, you may need to figure out appropriate wire (per above extract for GSM HAT headphone input), but in our case microphone was connected to shield and red, while speaker wires were green and blue. In the end, plug 3.5 mm jack into GSM HAT headphones input.
Step 3: Final Packaging and Adding Simulated "ringing Effect"
While final internal packaging as seen on above picture looks relatively neat, it did require a lot of tinkering and trying different options. Main constraints were space under rotary dial and rigid connectors, and whole process was like putting puzzle together.
It was very fortunate that we were able to use several posts that already existed inside the phone (we removed other posts with Dremel tool), and to secure boards and speaker. But that also restricted the rest of the available space, which ultimately led us to abandon original idea to add internal rechargeable power source.
As for "ring", we ended up buying battery powered recordable sound module. As an option (when connecting boards through micro USB), there is a non-battery version which can be directly powered from Raspberry Pi header 5V.
In both cases, external controlling switch from sound module would need to be removed and wires connected to one of GPIO pin + ground. And programming ring tone into module is very simple, just connect it to PC and download whichever mp3 file you want to use for ringing action. Here is the link to a nice site with a lots of old ring sounds.
Step 4: Software and Final Integration
Above block diagram present all main components and their relationships. In essence, implementation needs 3 discrete inputs, and at least 1 discrete output (we used 2 DO's since version of GSM HAT that we got can't start automatically without pressing button on HAT, so we needed to solder wire to that button to force starting the HAT when phone is powered).
As far as the code, it was written in Python 2.7, so if you install/use version 3.x and higher, there may be some things that would need to be changed (obvious one being "print" statement). For code to work properly, there are couple of Python libraries that need to be added first, like:
- gpiozero (needed for Raspberry Pi GPIO interface)
- re (regular expression library - for parsing incoming SMS messages, install if not part of default Python installation)
- serial (for connecting to GSM HAT - needed even if connecting through micro USB, install if not part of default Python installation)
Also, there are 2 places in attached code that have to be modified/adapted depending on final implementation (or 3 places, if different GPIO pins are used). First one is related to number which you would want to use for forwarding messages:
FORWARDING_NUMBER = "5551234567" # put here phone where you want your messages to be forwarded
And second one is for serial port setting:
# SIM868 initialization and rutines
sim868 = serial.Serial("/dev/ttyS0",115200)
# make sure that /dev/ttyS0 is right for your setup
Code was built as state machine, described in above diagram. Most of the time phone is in IDLE state, waiting for events:
1. Incoming call (which will drive phone into RING state)
2. Incoming SMS message - which is/can be automatically forwarded to another phone
3. Lifting headset up, in preparation for dialing-out (drives phone into DIAL state)
4. Dialing special character without lifting headset (as per current code, dialing "#" shut-down phone) ...
There are lot of comments embedded in the code, which should help reading and understanding it. We left some things unfinished, like adding speed dial option, or sending status message, or ...
As far as how to have code run automatically when power is applied, we chose to implement it as service, which can be done as described here. Simply do following:
- download below attached files "rotaryPhoneStateMachine.txt" and "myphone.txt" and rename them into "rotaryPhoneStateMachine.py" and "myphone.service" (for some strange reason, Instructables server does not allows upload of certain file types)
- place "rotaryPhoneStateMachine.py" into /home/pi folder
- place "myphone.service" into /etc/systemd/system
- enable service with command "sudo systemctl enable myphone.service" (after testing everything)