Rotary Phone Home Control

In our house old rotary phones are used as a remote for Sonos, Philips Hue and to ring the door bell. Turning the dial on one of the phones starts playing an MP3 on the phone. Turning the dial of the phone in another room dims the light, or turns it on or off.

We use an old Ericofoon, a red and green Dutch T65:

I connected the 2 pins of the phones to an ESP8226 (nodemcu). You can buy them for cheap on Chinese webshops.

The C code below is counting pulses. I used platformio to compile the ESP8226 code and upload it. The ESP8226 requests a Raspberry Pi to evaluate an URL. The Python code for the Raspberry Pi will be subject of another post.