Introduction: Easiest ESP8266 Learning IR Remote Control Via WIFI
The ESP8266 is a wonderful microcontroller. They can be purchased cheaply and have built in wifi.
In this guide I will not go over how to flash the ESP8266 module with the basic firmware as this is covered on the http://ESP8266basic.com web site in detail.
All the parts to build this project can be found on ebay for less than $10 shipped to the US.
Step 1: Gather Your Materials.
You will need the following:
- ESP8266 Module. Suggest the NODEMCU or similar board.
- Infrared LED
- IR Receiver such as the VS1838B
- Some female du-pont connectors.
- Optional USB wall wart power supply. Some TVs have a built in USB jack that can be used.
Step 2: Assemble the Circuit Using the DU-PONT Wires.
I hooked up my entire circuit using only female du-pont wires. You could get a bit more phansy but this worked well for me.
Use the circuit diagram as reference.
Step 3: Program the Module
Goto the esp8266 Basic program editor in your browser and past the following code in.
Then save your program and click run.
dim irButtons(6) as string
dim irCodes(6) as string x = 0
ir.recv.setup(5) ir.send.setup(4) IRBRANCH [received]
for x = 1 to 6 irButtons(x) = read("irbut" & str(x)) irCodes(x) = read("ircode" & str(x)) if irButtons(x) = "" then irButtons(x) = "UNUSED" next x
[top] cls cssclass "button", "background-color: powderblue;height: 20%;width: 30%;" Print "ESP8266 Basic Learning IR remote" print "Last IR recvd" textbox ircode print "Text for button" textbox newtxt print "Button number" dropdown x, "1,2,3,4,5,6" Button "Program Code to button", [program] print
button irButtons(1), [bu1] button irButtons(2), [bu2] button irButtons(3), [bu3] print button irButtons(4), [bu4] button irButtons(5), [bu5] button irButtons(6), [bu6]
IRBRANCH [received] wait
[received] ircode = ir.recv.full() return
[bu1] ir.send(irCodes(1)) x = 1 wait
[bu2] ir.send(irCodes(2)) x = 2 wait
[bu3] ir.send(irCodes(3)) x = 3 wait
[bu4] ir.send(irCodes(4)) x = 4 wait
[bu5] ir.send(irCodes(5)) x = 5 wait
[bu6] ir.send(irCodes(6)) x = 6 wait
[program] irButtons(x) = newtxt irCodes(x) = ircode write("irbut" & str(x),irButtons(x) ) write("ircode" & str(x),irCodes(x)) goto [top]
Step 4: Start Teaching Your Remote.
Click the button you wish to program. There will be 6 available for you to use.
Next on your TV remote hit the button you wish for the module to learn.
In the "Last IR Recvd" text box you should see a remote code pop up. If it says unknown press the button on your remote again.
Currently this will only work with codes that say sony or nec.
Once a good code is showing in the textbox type the text you would like for your button in to the "Text for button" textbox and click the "Program code to button" button.
The button has now been set up and can be used to control the TV. Press the button in your browser and test to make sure it works.
Repeat for each of the 6 programmable buttons.
Don't worry. If you reset the module it will remember your button text and codes as they are stored in the flash memory.
Now you are done. You have an awesome tv remote that can be controlled via wifi from your computer or smart phone.
mmiscool made it!