Intro: Using an ESP8266 As a WiFi Enabled Universal Remote
In this instructable I'm going to show you how to make a WiFi enabled universal remote that you can control with your phone or computer.
I think it's a cool project that can be easily adapted or extended to whatever suits your needs.
Check out the video for a demo and quick run through what's involved in the project.
The code, hardware and circuit diagram are available on github.
Step 1: Hardware for the Project
The hardware for the project is pretty straight forward, you will need the following parts:
- Wemos D1 Mini
- IR LED
- 2N3904 (Although a 2N2222 might be a better choice)
- 330 Ohm resistor
- IR Receiver (TL1838) - Needed for reading codes.
- A breadboard (everything fits on a mini breadboard)
Rather than connecting the IR LED directly to the pins of the ESP8266, we need to use a transistor as a switch. This is so the IR LED can get enough current.
The rest of the circuitry is pretty straight forward.
Step 2: Software
The library I'm using for handling the IR sending and receiving is IRremoteESP8266 by MarksZazbo
First thing we need to do is flash the IrRecvDumpV2 example from the library to read the codes, just make sure to update the receive pin to the pin you are using for the IR receiver.
Open the serial console and press the button on the remote that you want to emulate. I recommend pressing the button a few times to ensure you have the right code. Take down the encoding and data for each button press.
Once you have all the codes for the buttons you want to emulate, download the sketch from ESP8266 IR Remote Example github.
The sketch hosts a web server, where the main webpage has various buttons representing the commands for the different remotes. Each button when clicked makes an Ajax call to unique end point that contains the actions behind each button.
Most of the buttons just send single commands, but commands can also be combined together to perform macros. In the example sketch the Chromecast button changes the channel on the TV and changes the sound input my receiver.
Hopefully this project proves useful if you are interested in making a similar project. It still needs some more work, as although my TV and Receiver work very well, commands to my Satellite box only work from short range. I will come back to this project again as I think there is a lot of cool things you could do with something like this.
If you have any questions please let me know.
Thanks a lot,