In one of my previous blog posts I explained how to emulate Marantz remote control with Arduino using "remote in" socket. Now I decided to do something useful about it. My final goal is:
- Allow managing a device from any mobile or tablet
- Automatically power off the device if needed (e.g. at 4 AM)
- Could also be used for alarm functionality
- Better integrate with other devices, e.g. to turn on the radio if "Tuner" input is selected
Implementation
To support WIFI and be able to run a web server I decided to use the ESP32 platform, which is widely available and supported by Arduino IDE. Initially, I tried to connect GPIO12 output directly to the "Remote In" socket. This was working fine but completely blocked IR. So I had to add a diode, to avoid current from the amplifier to the ESP32. This solved the problem. As a power supply, I am using an old mobile charger with micro-USB output.
To implement HTTP i am using ESPAsyncWebServer project. Web UI is done using simple HTML/CSS/JS.
One of the early problems I found was that connection latency was very unstable, from 10 to 100ms. It was solved when I disabled power saving on the wireless interface, now it is within 1-5ms.
Source code
Source code is published in my github repo. To compile it – add spressif/arduino-esp32 and ESPAsyncWebServer manually.
Screenshot
To do
Something I may add in the future:
- Web interface for the sleep timer
- Maybe also wire device status to the ESP32. This would require some modification of the amplifier, so not sure if I want to do it.
- MQTT for the better IoT integration
- May be OTA, just to learn how it should work
Comments are welcome