If you have a hungry toddler like I do, you might also be missing some of the buttons on your TV remote control. Those buttons are not worth the expense of a new remote, but certainly justify an afternoon project.
You remember you have some ESP8266s that are sitting in your box, and the great simplicity and utility of such an endeavor. The ESPs sell for under $2 on Ebay after shipping, so throwing one permanently under you TV is not only for the rich and famous. So here's how to do it:
Get started with your ESP
Order one, two or ten of them. ESP8266-01S is perfectly capable of this project, although I recommend ESP-12E ($2.98 after shipping) unless you are willing to do what I did just to make your project smaller. There are plenty of tutorials online on getting started with the ESP, so I will only give you a rough idea of the involvement:
You will need the Arduino IDE with whatever OS. Alternatively Linux and some C skills for the official Espressif stuff, but that's unnecessarily challenging for this application.
If you buy the older ESP8266-01S, you will also need to put together a programming circuit. Mine looks like this, but you could easily plug some wires into a breadboard.
Some sort of USB to Serial is required. I highjacked my Arduino Uno's by connecting the Uno's TX/RX pins to the ESP's (http://randomnerdtutorials.com/getting-started-with-esp8266-wifi-transceiver-review/ ). I did not use a voltage divider, but one is "recommended," if that means anything to you. But you can Ignore this part since you bought the better version of ESP, right?
Programming the ESPs with Arduino IDE is basic. How to set up and tons of examples here: https://github.com/esp8266/Arduino. I would look at Arduino/libraries/ESP8266WebServer/examples/ to get prepared for what is coming next.
Capture your TV's codes.
Google some tutorials about this. I connected an IR Receiver to my Arduino UNO and used Ken Shirriff's https://github.com/z3t0/Arduino-IRremote thanks Ken. The IRrecord demo does great with this. Note, this does require the working TV remote control, and some Arduino skills, like plugging it in, and pressing ctrl+shift+M. Remote controls use a number of formats, but the code is clever so you don't have to be, just write down what comes out on the Serial monitor in the Arduino IDE.
Design your web interface.
I had never, nor since, used HTML, but made some buttons in HTML. For a speedy and smooth interface, make each button send an XML request to your server (see index.html below). The format of the commands I used is "IRFormat-Code-LengthInBits."
Solder the simplest circuit possible (schematic below). The output from the ESP is inverted, but the code takes care of it.
Create file system
The server code that runs the ESP uses a file system. This makes updating and otherwise modifying your HTML a breeze. You will need to download a tool for the Arduino IDE (http://esp8266.github.io/Arduino/versions/2.0.0/doc/filesystem.html ). Create a "Data" folder within your Arduino project and paste HTML files there. Then, in the Arduino IDE go to "Tools-ESP8266 Sketch Data Upload" and it will do its thing to load the ESP with the files. Those will not be touched by your main program so long as either does not exceed its size limit. Lots of info on this in the above link.
Copy and paste server code.
Modify the code to fit your needs. The attached main code seems a little dumb, but it works. It has yet to crash in over a year of working (yes, one year). This thing has been on in my house 24/7 for 1 year so far.
Test it
You can access the ESP server through its IP on your home wifi. Mine sits in a little transparent-capped cup below the IR sensor on my TV, permanently plugged into the wall. The beauty is that it works with any browser on any device from anywhere in the house.
Clear as mud? Did it work?
If you need more explanation, I can add more, but these articles easily get very long.
Comments