Hello !

I was reading a lot of Hack a Day and this site inspired me for nice projects, so I decided to give back to the community with a little project that is easy to make :

Nowadays there are many methods to power on / off multiple devices at same time, like HDMI CEC, HDMI ARC, Viera Link, simpLink .... 

Some of these methods are not compatible with all hardware, like in my case.

I own a LG DVD player ( HT462DZ1-D0 ) with amplifier that I use with my Toshiba TV.

The integrated solution provided by LG (simpLink) works with LG TV and this DVD isn't HDMI Cec compatible, and even it was, I use optical in since I use this device only to listen the TV with better sound.

This project consists in reading the Power button of the TV, then use the command to power on the DVD at the same time with TV.

For this, one can use Arduino or Esp8266.

I chose esp 8266 since beside of this project, I want to use the esp remaining GPIO to control some relays (for a LED band behind the TV - The USB port of my TV don't cut power when TV is off, and also use 2 other relays to power 2 lamps in the room) and the other reason of this choice was the ability of the esp8266 to connect to wifi. Once connected to wifi, the courtyard of possibilities grow ( MQTT commands, web control...).

Back to this project, first of all one should read his TV power on code. I used the ESP8266 IR Remote to achieve this.

The library must be installed on Arduino IDE with Library Manager (best choice) or manually : https://github.com/crankyoldgit/IRremoteESP8266

Once installed, restart Arduino IDE and connect your esp device.

I use a Wemos D1 Mini, for his simplicity and reset button on the side of the board. Also 4MB of memory are enough for some later EasyEsp or NodeMCU firmware.

Go to examples and on ESP8266 IR Remote open DumpV2.

Read the comments on the code and do necessary modifications if your Gpio receiver is on other pin that the one that's in the code.

I use a cheap KS-022 ( VS1883B ) receiver. Pay attention that unlike data sheet, the voltage input on this module (the module has 3 pins and one red led which light when signal received) is in the middle. The S mean output signal to Arduino/Esp and the remaining pin is GND.

The 100 uF capacitor is between VCC and GND of the IR receiver, as indicated on the data sheet.

You can use only the receiver if you don't need the module Led as showing reception, as in my photos, but this time the VCC is on the right, ground on middle and on the left is the Signal. Not connecting properly may result in receiver burn.

On the DVD, the things are pretty straight forward. Open it, find the button on the board, use a multi-meter or visual inspection to detect the button GND (important since the octocupler GND must be on this GND). Then solder and fix with tape or hot glue the wires to the RCA female mounted on the back, trough a hole in the metal plate (again, respect the "polarity" of the button, solder GND wire on the external RCA jack, the middle is the V+ of the button)

Back to Esp, once soldering / connecting is done, connect your esp to arduino and flash the code DumpV2 from examples.

Open serial monitor and it should say that is listening.

Push the button that you want to read and serial monitor should give you the code of that button instantly.

Write that code down, the hex one.

Now, in the same dumpv2 code, declare another GPIO pin to use with an octocupler as OUTPUT. I was using the GPIO 13, the 14 is the IR receiver.

Now it's just a matter of doing a conditional IF in the void part of the code. Many if can be made, so some unused button of your remote can become a relay switch of a lamp or a Led strip band on the back of your TV, even a fan control or window blinds (with a RF transmitter or a RF Bridge). Possibilities are only limited by your imagination ! 

If decode result is 0xF636283 (A code example) the do something (put gpio HIGH for 1 second or less then Gpio goes LOW.

If (result.value == 0XF636283) {

  .......

}

To protect the LED from inside the PC817 octocupler a resistor of 220 Ohms is mandatory.  This resistor goes from Arduino 5V to octocupler VCC. Also protect the GPIO pin.

The Anode (pin 1) of the PC817 goes to pin 13, the pin 2 goes to GND.

Then the 3 and 4 go to button that you want to hack, make sur the GND of octocupler is the same as the GND of the button.

In my case the button had a 4.8V tension and when physical button was pushed, the tension was cut, and the DVD powers on.

Using a octocupler it's a safe way to protect 2 distinct circuits, since there isn't any "contact" between those 2 circuits.

When led inside octocupler is lit (Gpio HIGH) a resistance is made between the other 2 pins of the octocupler.

Please be careful to connect octocupler ground to device ground and voltage to voltage otherwise it will not work.

For powering the esp I use the USB port of my cable modem that isn't cut when in standby, you can use any phone charger or 5v power source.

For the sake of further implementations and modifications, I used a RCA audio Jack to connect the button to the DVD.

Also used those tiny project boxes that on can buy from Chinese sites in packs of 5 or 10.

Holes have been made on the box for Reset, RCA Jack and USB powering / programming (future version will have OTA).

Some hot glue ( in reasonable quantities) was involved in fixing all in place the IR receiver and the esp.

The same project can easily be evolved to IR sender also, making possible the creation of scenarios :

Look at this simple project of whitnessmennow (thanks for sharing) :

https://github.com/witnessmenow/ESP8266-IR-Remote-Example

Now when I power on the TV, the DVD powers also. The standard functionality of the DVD and his remote is still the same, nothing changed. In the future, I will upgrade the project with PubSub libraries to publish and subscribe to mqtt topics, so controlling from web (websockets) can be possible. Even voice commands and other cool things

Hope this helps someone, have a great hacking day!