IntroductionIn 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. The rotary dial phone with custom electronics to add mDNS, MQTT & MP3 functionallity. 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. This short video shows how the phone can control the lights of my livingroom, and here is a somewhat longer video showing how the HAC controlling the phone.
FunctionsThe 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.
Wired vs WirelessEven 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. The W5100S-EVB-Pico board provides the network connectivity for this project.
ArduinoThe 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 library is avaible in the GitHub repository that I created for this project.The RP2040 boards package for Arduino was created by Earle F. Philhower III, I used version 1.13.1.
MQTTThe 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.This short video shows how the phone controls the lights of my livingroom.
mDNSBecause 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.
DialingThe 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. The rotary dialing mechanism. 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 complete schematic of the interface added to the rotary dial phone. 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. High-voltage inverter and 12-to-5 V DC-DC converter (left top), MP3 file player with power input and the WIZnet W5100S-EVB-Pico. 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.The complete schematics are available as a KiCad6 project in the GitHub repository.
TextingWhen 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. Alphanumerical character to digit mapping on S63-type phone. 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). The card on Home Assistant's dashboard showing data received from the rotary dial phone. 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.Here is a video showing messaging with the rotary dial.
High-Voltage Bell InverterThe 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. The phone's bell requires a voltage of more than 30 V to ring. The high-voltage inverter allows the MCU to ring the phone's bell.This video shows how the HAC can ring the phone's bell.
MP3 PlayerAn 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 (Serial1). 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. The MP3 file player module is mounted at the rear of the phone. I used the open-source Arduino library DFRobotDFPlayerMini v1.0.5.Watch this video to hear how MP3 files sound.
VOIPCurrently 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 SupplyThe 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. Power to the phone is transported over the two free wire paires available in a standard Ethernet connection.
ConclusionIn 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 re-assembled S63 phone with Ethernet cable and power adapter. The complete application program consists of an Arduino sketch and an easy to install library based on the official WIZnet repository.I would like to thank WIZnet for providing me with a W5100S-EVB-Pico sample board and for making available the support libraries. Also a big Thank You! goes out to Earle F. Philhower III for his excellent RP2040 Arduino Boards Package.