Introduction: Easiest ESP8266 Learning IR Remote Control Via WIFI

Picture of 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 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.

Picture of 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.

Picture of 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.


danymx24 (author)2017-09-29


I found this board that has everything, I think that is a expensive but is easy, everything is already there, I just flash it.

PedroF114 (author)2017-07-25


Just a newbie question... Once you you finished teaching your device the IR receiver is not needed, right? I should be able to remove it and use it for other projects I guess...

desyanDD (author)2017-07-18

What language do u use above? Can it be use aand upload from ardunio IDE?

davru (author)2017-02-25

Nice work - thanks for the writeup!

I have the Lua version of the esp8266. Is the Basic interpreter accessible on that board or would I need to reflash it? Or do you have a Lua version of your code?

mmiscool (author)davru2017-02-26

You will have to flash the basic firmware on to your board.

Goto and get the llatest version. Follow the flashing instruction there for installing it.

dentalan (author)2016-12-17

Thanks for this.Nice and simple. I am going to try it. I have made an LIRC device that works on my PC (winlirc) for about 15 years. There were no ESPs then

A very practical idea would be to be able to "play" the ir_commands over network to other similar stations and so to make a network IR extender. Think of it

DJman230 (author)2016-10-14

Hello, I was looking long time for a project like this

How do I know that my samsung tv uses sony or nec codes?

Also, can I add more buttons, maybe the whole remote?

Thank you.

De Galthie (author)DJman2302016-10-15

I think samsung is using their own coding system
Well I also have a sammy tv and it says afde3g something SAMSUNG:32
And it will not transmit :/
I also have a sony camera transmitter
Unfortunately it also does not want transmit although it recognizes the code
I would like to have a system that works with ANY given code possible even RF

mmiscool (author)DJman2302016-10-15

You can see what the code is by reading the textbox at the top of the screen.

mmiscool (author)DJman2302016-10-15

YEs. you can ad more buttons.

De Galthie (author)2016-10-15

Hi !

Thanx for this project

Would it be possible to use this with those 433MHz RF modules ?

What will I need to change if I want to use it with RF ?

DIY Hacks and How Tos (author)2016-10-03

Nice design. I made a code learning Arduino system a few years back but I like your system a lot better.

mmiscool made it! (author)2016-10-02

Poject is incredibly simple.

About This Instructable



Add instructable to: