The idea of this project is simple. I am turning a useless classical rotary phone into a fully functional device. These phones originate from an era where devices were built to last a lifetime. However, the necessary infrastructure has disappeared over the years, rendering these phones useless.
By adding bluetooth to the rotary phone, any smartphone can connect to it and use it in the same way as a carkit. You can have a fashionable functional rotary phone on your desk and use it to make and answer calls, while your smartphone stays in your pocket. Who doesn’t love that classic ringing sound?
The bluetooth module
I considered several bluetooth modules, but mainly the Chinese XS3868 and the RN-52 from microchip. The XS3868 is cheap but the documentation is terrible. When I ran into problems I wanted to switch to the RN-52, but I couldn’t find a supplier that had them in stock, so I decided to stick with the XS3868.
I had used the XS3868 before in the Heineken speakerkratje where it functioned perfectly as a bluetooth speaker. However for the rotary phone, I also needed the UART interface in order to send commands (pick up phone, dial number, etc). The UART interface worked fine just after startup of the module and I could play music and initiate calls, but every time after 10-30 seconds, the UART interface would stop responding.
Initially I thought it could have something to do with the stability of the power supply, so I tried adding caps and different voltage sources. I also tried a voltage level shifter on the UART lines. I tried a pull-up resistor on the reset pin. I even tried a new XS3868 module, suspecting that the other one was broken. But every time I ran into the same problem, the UART interface would stop responding.
The first clue I found was the current consumption going down after losing the UART interface. Thanks to this instructable I found that the device had a deep-sleep mode and that it could be disabled. This is done by changing register ‘lowpow_clk’ from 0x1e to 0x12. For details about this register, check out the datasheet.
Speaker and microphone
Next up was to connect the microphone and speaker to the bluetooth module. The speaker turned out to be really easy. I just had to connect the two speaker wires from the phone to the Agnd and Aleft pins (could also have used Aright).
The microphone was not so simple. I first hooked it up according this vague diagram found on the internet:
However I didn’t have a 2.2uF capacitor in stock, so I used 2 1uF caps in parallel. It did not work well. The sound quality was terrible. I tried the same circuit with a small electret microphone which I had in stock and the sound quality was much better. I also figured out that if I would whisper in the original microphone, the sound quality was better. I suspected that with the original microphone, I was hitting the saturation continuously.
As a quick-fix to lower the microphone output, I tried to reduce the resistor value (2.2K) by adding more resistors in parallel. By doing so, I did not have to remove the resistors. Eventually I ended up with three resistors, of which the equivalent value is somewhere below 100 ohm. Also I added a 0.1uF capacitor but that didn’t seem to have any effect. The sound quality is now pretty good, but you still need to keep a calm voice while speaking, to avoid the saturation limit.
What is a rotary phone without the possibility to dial a number? Luckily there is quiet a bit of information on the internet how this works. Basically when the dial rotates back into position, it generates a number of pulses according to the dialed number. This is simply read out with a micro-controller, in this case an ESP8266.
ESP8266 as microcontroller
The phone needs a microcontroller for a couple of functions:
- Pickup/Hangup switch
- Read input from the rotary dial
- Generate pulses for ringing the bell
- Communicate over UART with the bluetooth module
There are dozens of options for a microcontroller that can perform this task. An Arduino would definitely have been up to the task. I also considered an STM32F103 ‘blue pill’ board. But eventually I went for an ESP8266 module, because it would allow me to add WiFi to the phone.
At the moment, WiFi is only used for over-the-air (OTA) firmware updates, but it could also be used for example to define hotkeys. The OTA update works as follows: If the phone is powered up with the horn down, it boots in normal mode. If the horn is picked up while powering up, the ESP goes into another mode where it connects to a local WiFi network. Thereby it is possible to update the firmware in the phone without opening it up. I know, I could also have wired the USB data pins, but I didn’t.
The phone is powered from a 5V micro-USB port at the back. The ESP8266 and the bluetooth module require a 3.3V supply, so I added a small buck converter.
For the ringing circuit, the electromagnet needs a higher voltage. I added a XL6009 boost convert to take 5V up to 30V. I wasn’t sure of the voltage drops when the ringing circuit is active, so I added the biggest capacitor I could find to smooth it out.
To ring the bells, a voltage of at least 20VAC needs to be applied at a frequency of around 25Hz. The voltage is supplied by the boost converter, but this is DC. To alternate the current, an H-bridge is required.
I couldn’t find many small H-bridge modules, but there is an overload of small stepper motor control modules available. A stepper motor controller has two H-bridges internally. I used the A4988 StepStick module. The bell is simply hooked up to one of the stepper motor phases. The DIR pin is fixed to GND. Every second rising edge on the STEP pin results in a bell being ringed. By simply applying a pulse train on the STEP pin, the ringing signal is created.
Because the ESP8266 is super easy to program with Arduino IDE, I used this. The code is not pretty, but functional. Code is available on github. It also contains some (succesful) experiments with state machines.