Features:
- Automatic switching between 2 optical audio inputs → 1 optical output
- Works with TOSLINK / SPDIF signals
- Signal presence detection based on frequency measurement
- Configurable per channel:
- Frequency threshold
- Minimum active time before switching
- Anti-flicker logic to prevent rapid toggling
- ESPHome-based firmware with OTA updates
- Live configuration via:
- Home Assistant
- Integrated web interface
- No SPDIF decoding or audio processing required
- Supports S/PDIF clock rate up to 16 MHz
- Power Supply via USB-C
- Compact enclosure made from 3D-printed parts
Web Interface:

How It Works:
Each optical input is converted into a digital pulse signal using a standard TOSLINK receiver module.
The ESP32 continuously monitors both inputs and evaluates their activity:
1. Incoming SPDIF signals are frequency-divided (division by 4096) to a measurable range
2. The ESP32 counts pulses to determine signal activity
3. If an input stays above a configurable frequency threshold for a defined time:
- Channel A → Switch OFF
- Channel B → Switch ON
4. Once switched, the system waits until the signal drops below the threshold before re-arming