Rotary Dial Phone as Remote Control
![4901](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_200/https%3A%2F%2Fwww.elektormagazine.de%2Fassets%2Fupload%2Fimg%2Fpublic%2Foriginal%2Frotary-dial-remote-header.jpg)
Turn an old analog rotary-dial phone into a remote control and alarm for a home automation system.
Introduction
In this project the WIZnet W5100S-EVB-Pico board is used to turn an old analog rotary-dial phone into a remote control and alarm for a home automation system.
Even when lights and appliances are controlled by a home automation controller (HAC), it is often desirable to have an override option to switch on or off a lamp, a ventilator or some other device. The modified rotary-dial phone presented here allows this by dialing the number of the appliance. At the same time it forms a now sought-after decorative object.
Besides a remote control for a home automation system, the modified phone can also be used as a prop in for instance an escape game. I am sure many other applications can be imagined too.
The HAC in question is Home Assistant.
Functions
The modified rotary-dial phone has the following functions:
– When the handset is on the phone and a number is dialed, the corresponding appliance is switched on or off, depending on its current state.
– When the handset is lifted, the dial can be used to compose a text message in a way similar to mobile phones from some twenty years ago. Replacing the handset on the phone will send the message.
– The bell of the phone is available to the HAC as an alarm and can e.g. be routed to the doorbell or function as a kitchen timer or (unpleasant) wake-up alarm.
– The loudspeaker of the phone will be connected to an MP3 player to play prerecorded messages or music. This allows for implementing for instance a talking clock as was common in the previous century.
Communication between the phone and the HAC will use MQTT, while mDNS is used to establish a connection between the two.
Wired vs Wireless
Even though today wireless networking appears to be the standard, there are still many applications for cabled or tethered Ethernet. One advantage of wired Ethernet is that it is possible to provide power to the connected nodes. This feature is used in this project (see below). Furthermore, as rotary-dial phones always have had a cable running to a wall outlet somewhere, it would even be strange to have one without. Therefore, the WIZnet W5100S-EVB-Pico board is a perfect choice for this application.
Arduino
The WIZnet W5100S-EVB-Pico board is supported by libraries intended for use with the official Raspberry Pi RP2040 MCU development environment. I do not like this environment too much as I find it complex and cluttered with all the Cmake stuff. Luckily there exists also an Arduino boards package for the RP2040, and so I ported the WIZnet libraries to this IDE. This makes things much simpler and, I think, more accessible and easier to share. The complete application program consists now of an Arduino sketch and an easy to install library.
The RP2040 boards package for Arduino was created by Earle F. Philhower III, I used version 1.13.1.
MQTT
The MQTT example provided by WIZnet was used to build my program on. This helped me to get up and running quickly. The only problem I encountered was a missing and undocumented call to MilliTimer_Handler (see mqtt_interface.h). Once I added it to my millisecond timer callback MQTT worked fine.
mDNS
Because my HAC relies on DHCP to connect to the network, it may be attributed a new IP address at any moment. To find its peripherals and to communicate with them, the HAC uses multicast DNS or mDNS. As I did not want to hard-code a temporary HAC's IP address in my program and recompile it every time the HAC's address changes, I added mDNS support to it. For this I adapted the WIZnet DNS library as mDNS is quite similar to plain DNS. Now the program issues an mDNS request to obtain the HAC's IP address before trying to connect to it. This makes the system much more flexible and reliable.
Dialing
The vintage phone's dialing mechanism can be viewed as two switches: one indicates that dialing is in progress (busy/idle) while the other closes a certain number of times depending on the chosen digit. A '1' produces one pulse, a '9' nine pulses and '0' is ten pulses.
Connecting this mechanism to the W5100S-EVB-Pico board is easy; connecting it without modifying the phone requires a bit more reflection. I wanted to keep the phone in a state as close to its original as possible. By choosing the right connection points in the phone and adapting the required pull-up resistors this can be achieved.
The phone I used, a classic French model (S63), produces pulses at a rate of 10 Hz. Reading the switches requires debouncing, which I implemented in software. Once properly debounced, counting the pulses becomes a trivial task.
The handset rests on a normally-open switch, so lifting the handset closes it. This changes the electrical circuit of the phone and with it the impedance of some of the connection points of the dial mechanism. Fortunately, this can be handled by choosing relatively low values for some of the pull-up resistors.
Dialing with the handset on the phone generates single-digit messages; dialing with the handset lifted produces a multi-digit number which is sent after putting down the handset. The digit or number is sent as the payload of an MQTT packet. Note that digits are send 'minus one' to make the ten values fit in one character. So 1 is sent as 0, 9 as 8, and 0 is sent as 9.
Texting
When the handset is lifted, dialing produces besides a multi-digit number also letters to compose text messages with. The 26 letters of the alphabet are distributed over the digits 2 to 9, three characters per digit, except 6, which only has two ('m' and 'n'). Digit 0 also has two ('o' and 'q'), digit 1 has none. This is the distribution printed on the French S63 phone. For some reason there is no 'z' and so I added the option to add it to digit 0.
To select a letter, the corresponding digit must be dialed up to three times. As an example: 'a' is 2, 'b' is 22 and 'c' is 222. To write 'aaa' the dial sequence is 2-2-2, for 'abc' it is 2-22-222. Here, the dash represents a pause of at least one second. A delay of less than one second between two identical digits selects the next letter attributed to the digit. This method is very similar to that used on mobile phones from 2000 to compose text messages except that there is no display so you have to keep track of your message in your mind (good exercise!).
“wiznet” is dialed as 9 444 000 66 33 8 (the character 'z' must be enabled).
When the handset is placed back on the phone, the composed message is sent to the HAC as payload of an MQTT packet. The HAC can then forward it to e.g. an texting service or display it on its dashboard.
High-Voltage Bell Inverter
The bell of the phone requires a relatively high AC voltage to ring, at least 35 VAC as I found. I therefore built a simple low-power voltage inverter controlled by the MCU. The MCU generates two 50 Hz square waves with a 180° phase difference that drive the secondaries of a small 230 VAC mains transformer. The bell is connected to the primary side of the transformer. A small 2x 9 V 1 VA transformer suffices to get a decent bell volume.
MP3 Player
An MP3 player module was added for playing audio files through the speaker of the phone's handset. The MP3 module communicates with the MCU over a 9,600-baud serial port. The HAC can send MQTT message to the phone to select the MP3 file to play, or the MCU can control it all by itself. This arrangement allows for e.g. playing waiting music, reproduce analog phone line sounds, play prerecorded messages or create a talking clock. Sound and music files are stored on a microSD card.
I used the Arduino library DFRobotDFPlayerMini v1.0.5.
VOIP
Currently the microphone of the phone is not used but one could imagine using it for a voice-over-internet or VOIP service. The RP2040 can support I²S, so standard microphone interface ICs can be used for this.
Power Supply
The W5100S-EVB-Pico board requires a 5 VDC power supply, the high-voltage bell inverter needs at least 10 VDC. To supply power to the phone the two free wire pairs of a normal Ethernet cable are used. The five meter long cable I used introduces a noticeable voltage drop, even with two conductors in parallel for each power supply connection. A 12-V AC/DC wall wart therefore powers the phone. Inside the phone a small DC/DC converter was added to create the 5 VDC for the MCU board.
Conclusion
In this article I showed how to turn an old analog rotary-dial phone into a remote control and alarm for a home automation system by adding the WIZnet W5100S-EVB-Pico board to it and some additional circuitry. The modified phone becomes an MQTT client that can both send and receive messages from the home automation controller (HAC). Multicast DNS (mDNS) support was added to allow easy discovery of and connection to the HAC.
Dialing the phone allows controlling other appliances of the home automation system and sending text messages. The phone's bell serves as an alarm for e.g. a doorbell extender. The phone's speaker together with the built-in MP3 player can play music and prerecorded messages, and make e.g. phone line sounds.
The complete application program consists of an Arduino sketch and an easy to install library based on the official WIZnet repository.
Diskussion (0 Kommentare)