The NAD D3020 is a hybrid digital audio amplifier with a combination of analog and digital inputs. I have been using it for quite some years now to play the sound of my Samsung smart TV over the living room speakers and for digital radio, iTunes and Spotify from my Mac Mini. The Samsung is connected with an optical Toslink cable, the Mac Mini is connected with a USB cable.
In the way the D3020 is placed in our media cabinet, its on/off button is not so easy to access. The D3020 remote control is really crappy and I find it anyway annoying to have to use multiple remotes to switch the power of all devices. Also, the status LEDs of the D3020 are dim and got considerably worse over time, especially for the OPT1 and the USB inputs which are for the TV and the Mac Mini. I guess that it uses OLEDs, which have degraded over time. Consequently, it happened quite often that we forgot to switch the amplifier off for the night.
However, the D3020 features a 12V trigger input port which allows the amplifier to be switched automatically on/off along with other gear. Of course, neither TV nor the Mac Mini has a 12V output port, but both are connected to my home network; hence it is possible to detect over the network whether these are powered on.
I built an ESP8266-based trigger which allows switching D3020 using the 12V trigger. This is combined with a small Node.js application running on a Raspberry Pi which pings my TV and my Mac Mini over the network every 5 seconds. If either one returns the ping – and hence is powered on – an HTTP request is made to the ESP8266 to switch the trigger on. If neither TV nor Mac Mini returns the ping, an HTTP request switches the trigger off.
The hardware is implemented using a Wemos D1-mini ESP8266 board. The ESP8266 uses 3.3V logic which is not enough. However, 5V turns out to be sufficient to trigger the amplifier. I tried using a logic level converter, but it did not produce enough output current on the 5V side, causing the voltage to sag and remain below the trigger threshold. Therefore I designed a circuit in which one of the 3.3V GPIO pins is used to switch an opamp. The output side of the opamp is connected to the 5V USB input voltage of the Wemos board. Although the output voltage does not fully reach 5V, it turns out to be enough for the trigger input of the D3020.
The design follows that of a MIDI input, see here on Sparkfun and here on the Teensy forum. The difference is that the optocoupler input comes from the microcontroller GPOI pin at 3.3V, and the output is pulled up to 5V from the Vin pin. I also added a diode to protect the electronics from reverse voltage spikes that might come from the amplifier.
The list of components is:
- Wemos D1-mini
- PC900v opamp
- 270 Ohm resistor (2x)
- 0.1 uF capacitor
- BAT42 Schottky diode
- Hammond 1551 miniature enclosure
- audio cable with 3.5 mm TRS male jack connector
The PC900v datasheet specifies a maximum forward current of 50 mA, which would require a 66 Ohm resistor at 3.3V. However, the maximum current that can be drawn from a single GPIO pin is 12mA, hence I decided to use a 270 Ohm resistor.
Here you can see the design on a breadboard for testing:
And the final implementation just prior to fixing it with hot glue:
I am using the ESP8266-based 12V trigger (which is actually a 4.8V trigger) in combination with a small Node.js script running on a Raspberry Pi that constantly monitors whether either TV or computer are powered on. The code for this is found in on here on Github.