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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.

Circuits Contest 2016

Participated in the
Circuits Contest 2016

LED Contest

Participated in the
LED Contest

1 Person Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

17 Discussions


Question 10 months ago on Step 4

There seems to be a problem with the code. It learns the IR code and programs the buttons, but when pressing the programmed button, the IR code LED doesnt send anything. Upon checking the voltage on the pin, the voltage on GPIO4 doesn't change when the button is pushed.
Can you help please.

1 answer

Answer 10 months ago

Are you sure you have the right pin? The pins might be labled with the d numbers rather than the native pin numbers,


Question 12 months ago on Step 4

which ir led should i buy on aliexpress?

why dont you need a current limiting resistor?


1 year ago

Could you elaborate on this line?

"Currently this will only work with codes that say sony or nec."

Does that mean this will only work with sony or nec electronics? I am unclear as to the purpose of that statement.


2 years ago


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

1 reply
Bruce JohnSPedroF114

Reply 1 year ago

Could you please be a little bit more explicit ? I cannot understand your question.


2 years ago


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



2 years ago

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


2 years ago

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?


1 reply

Reply 2 years ago

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

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


2 years ago

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


2 years ago

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.

3 replies
De GalthieDJman230

Reply 2 years ago

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


Reply 2 years ago

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

De Galthie

2 years ago

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 ?


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