Introduction: Alexa Compatible IR Bridge Using an ESP8266
I wanted a way to control my smart TV via Alexa. Unfortunately my Hi-Sense 65" Smart TV does not have the ability to be controlled via WiFi. It would have been nice if it had some sort of API that I could use to interface with it.
So I created an IR bridge that will allow you to control it by means of a stationary IR bridge that is compatible with Alexa.
3d printed enclosure - If you do not have access to a 3d printer you can always build this using something home made. Downloadable from here https://github.com/mailmartinviljoen/LittleNodes_IR_Bridge
NodeMCU ESP8266 micro controller.
2 IR Transmitter LEDs. These LEDs only have 2 legs and they are connected the same way you would connect an ordinary LED (Flat side is the negative)
1 IR receiver for learning remote commands from an existing TV remote. You have to use an IR receiver that has 3 legs, VCC,GND and data out.
1 RGB Led, this is optional, you don't need it and it will function without any modifications needed.
ESPFlasher Tool https://github.com/nodemcu/nodemcu-flasher
Step 1: Connecting Everything Together
Both of the IR transmitters LEDs are connected in Parallel. Flat sides to any GND pin on the NodeMCU and the other 2 legs joined together connected to GPIO Pin D2 on the NodeMCU. I'm not sure if they need to be connected via a resistor but I figured the ESP8266 output is only 3.3V so they should be safe. Also they are not used all the time. They only come on when it's sending a signal.
The IR Receiver As shown in the picture it has 3 legs. The data out pin has to be connected to GPIO D5 the GND to GND and offcoarse the VCC to a 3.3V pin on the Node MCU
RGB LED Has 4 legs, GND and then positive for Red Blue and Green. The RGB legs go to GPIO pins D6 D7 and D8. The order does not matter. It will just show different colors.
Once assembled you can simply flash it using the Binary that I created. see the next step.
Flashing the binary to the ESP8266 instead of directly from the Arduino sketch means you don't have to have all the libraries installed. You can use the Esp Flasher tool downloadable from here.
And both the sketch and binary can be downloaded from my GitHub page.
Unfortunately this is not all you have to do. Once you flashed the image you need to also upload the HTML web interface that is making use of bootstrap to configure the NodeMCU. The tool used to upload these files is an external plugin that you need to install in the Arduino IDE. Instead of re-creating the tutorial, here's a great article that shows you how to do it.
Place the contents of the data.zip file in a folder called data in the same folder where the .INO files are in.
You have to open the .INO file in the Arduino IDE. If you installed the plugin correctly you will see under tools an option called ESP8266 Sketch Data upload. After uploading it the device will finally be programmed.
Note: If you don't upload the files, once you connect to the access point in setup mode the page will be blank because it cannot find any pages to load.
Step 3: Learn IR Codes and Save Them Onto the NodeMCU
Instead of explaining in text form how to set up your new IR device I created a video that demonstrates how it work and also explains how to program the device with IR codes.
Watch the video!
Some extra information.
Libraries uses (Not created by me)https://github.com/esp8266/Basic/tree/master/libraries/IRremoteESP8266
My TV is making use of the NEC IR protocol, so there is a posibility that your TV will not work if it does not make use of the same type of IR codes. I.E My fan has a remote. The device will learn the codes but it doesn't work not sure why , you will have to fiddle with the IRsend and Receive libraries in order to figure out why.
The 3d printable STL is also on my github page.