Universal Remote Using ESP8266(Wifi Controlled)

92,171

115

70

Introduction: Universal Remote Using ESP8266(Wifi Controlled)

About: Nothing just a tech enthusiast and by degree an Electrical Engineer

This project is to replace the conventional remote control for all the home appliances like AC, TV, DVD players, music system, SMART appliances !!! Making a whole junk of remote littering around, making us puzzle!!!

This project will save us from the junk to remotes by replacing all by ONE REMOTE!

2 part of this project:

  • DECODING ANY REMOTE
  • ENCODING ESP8266 NODEMCU 1.0(ESP-12E module) or any esp8266 version with a ttl connection

IMPORTANT : PLEASE READ THE WHOLE PROJECT THOROUGHLY IT WILL TAKE 3MINS BUT DON'T HALF-READ AND DAMAGE YOUR PARTS.... I WILL NOT BE RESPONSIBLE!!

Step 1: Configuring Nodemcu With Arduino IDE

  • First of all connect the Nodemcu (my one is lolin v3, amica and other clones will work too) with computer or laptop.
  • Now install the driver of nodemcu(google search will help).
  • After this open the Arduino IDE (Ofcourse you need to download it and install it)
  • Click on "Tools" on Arduino toolbar
  • Click on "Board"
  • Select "Board Manager" and search for esp8266 install it (will take some time to finish)
  • Now, select "Sketch" from arduino toolbar
  • Select "Include Library" from there select "Manage libraries"
  • Search for "IRremoteESP8266" and install it

Now the configuration is done only from "Tools" we need to go to "Boards" Select "NodeMcu 1.0(ESP 12-E)" or something else version of ESP8266.

Step 2: DECODING a Remote |CIRCUIT | Code

So, to make a universal remote we need to decode the other remotes i.e. to get IR hexadecimal codes emitted by each button of remotes. Just like to speak universally we need to know every language!!! OR learn English! Though I love my mother tongue Bengali the sweetest language!! REALLY it is, search it...

So components needed to decode a remote:

  • Nodemcu board
  • TSOP1738 IR reciever or some other IR recievers
  • jumpers

Now, follow the above circuit but after uploading the sketch to the nodemcu through Arduino.

  • Open Arduino and connect the nodemcu to laptop or computer
  • From "Files" select example go down and from IRremoteESP8266 select the IRrecvDump
  • Upload to nodemcu

Connect the TSOP1738 to Nodemcu as the circuit and open the "serial monitor" from Arduino to see the decoded hex-code of any remote as pictures given above. Still uploading the code for reference update it as it has been long Im not wotrking on this anymore... feel free to change in github

CODE: https://github.com/abhrodeep/Arduino_projs/blob/master/IRrecvDump.ino

Step 3: Encoding Nodemcu | CIRCUIT

After decoding the remotes now it's turn to upload the hex-codes to Nodemcu so that it can give IR led commands to emit those hex-code signals.

  • NOTE: can't connect IR led directly to Nodemcu cause it can't deliver enough current.
  • So need transistor moderated IR LED i.e. signal from Nodemcu goes to transistor then IR LED.
  • Transistor like 2N222, 2N3904,BC547 works but

Transistor 2N222,2N3904 collector current : 600mA

Transistor BC547 collector current : 100mA

both works...

CAUTION SEE THE COLLECTOR, EMITTER, BASE TERMINALS as BC547 and 2N222 have different convention. I have used BC547 as it is easily available and works fine.

Code is taken from "IRremoteESP8266" examples "IRserver" modified accordingly as shown in picture.

circuit as shown. Please NOTE I have used BC547 transistor and NO resistance between base and D2 pin.

THE COLLECTOR, EMITTER, BASE ARE INDICATED IN PICTURE. DON'T DO THE SAME FOR OTHER TRANSISTORS.

EDITS: Credits "3615JMD"

IMPROVENTS:

May I suggest 2 improvements:
1) if one replaces : uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10); by this uint32_t code = strtoul(server.arg(i).c_str(), NULL, 16); The web page accepts HEX codes directly. No need to convert manually to decimal !

2) I have improved the handler to be able to work with multiple IR formats. Nice when we want to control several devices from different brands: (more formats can be added with a switch/case)

void handleIr()

{ for (uint8_t i = 0; i < server.args(); i++) { if (server.argName(i) == "rcmm") { // format pour la freebox uint32_t code = strtoul(server.arg(i).c_str(), NULL, 16); irsend.sendRCMM(code, 32); Serial.println(code); } else if (server.argName(i) == "rc6") { // format pour la TV phillips uint32_t code = strtoul(server.arg(i).c_str(), NULL, 16); irsend.sendRC6(code, 20); Serial.println(code); } } handleRoot(); } The HTTP links must be modified accordingly of course : .... href=\"ir?rcmm=2400260C....... .... href=\"ir?rc6=0000C ....

Step 4: Encoding Code

I have taken the code from examples of "IRremoteESP8266", "IRserver".

But there are some changes to be done your wifi credentials - Wifi ssid, Wifi password

The Web server based codes(yellow highlighted) - This codes are the decimal form of the hexadecimal IR codes. This decimal values are passed to ESP8266 as arguments converted to hex-code and transmitted to IR LED.

IMPORTANT : AFTER DECODING A REMOTE BUTTON CONVERT THE HEXADECIMAL CODE TO DECIMAL AND REPLACE IT IN THE Arduino program. Its not very hard to convert hex to decimal, search google for online hexadecimal to decimal converter.

images are self-explanatory!!! Much older code(2017), feel free to edit ..

CODE: https://github.com/abhrodeep/Arduino_projs/blob/master/IRremoteESP.ino

Step 5: CONTROLLING

We can control it through the web server links... the IP of ESP8266 module on our router can be known by opening the serial monitor just after uploading the code. As in picture mine is 192.168.0.1

On opening this IP in any browser of mobile or laptop we can see the page as shown in picture.

OR ELSE FOR CONVENIENCE and simplicity we can use a android app...

"HTTP REQUEST SHORTCUT" app and do write the address to easily execute the code. As in picture, we can add widget on home screen to easily access the virtual buttons and get the necessary remote buttons.

Pictures are self explanatory.

SO WITHOUT WRITING IN THE PROGRAM WE CAN PASS THE ARGUMENT "CODE" WITH DECIMAL OF THE HEXADECIMAL CODE EXTRACTED FROM DECODING REMOTES DIRECTLY IN THE WIDGET.

IMPORTANT : PLEASE READ THE WHOLE PROJECT THOROUGHLY IT WILL TAKE 3MINS BUT DON'T HALF-READ AND DAMAGE YOUR PARTS.... I WILL NOT BE RESPONSIBLE!!

Step 6: Project Packed GIF!!!

If you like this make this project your favorite and encourage to do next project like internet controlled home automation... or something better!!!

Thanks a lot enjoy a remote-free life!!!

Lazy Life Challenge

Participated in the
Lazy Life Challenge

GIFs Challenge 2017

Participated in the
GIFs Challenge 2017

3 People Made This Project!

Recommendations

  • Tiny Things Speed Challenge

    Tiny Things Speed Challenge
  • Made with Math Contest

    Made with Math Contest
  • Reclaimed Materials Contest

    Reclaimed Materials Contest

70 Comments

0
paclevkov
paclevkov

3 months ago

Thanks,
It works perfectly with my AC. Thank you!

0
DanielB857
DanielB857

5 months ago

Hello…

I wonder if you can make a new guide,

I looking to ir sensor and when it’s broken, a dc motor will start.

0
loverboyritesh
loverboyritesh

6 months ago

I am a learner .. and your project was awesome and learnt new things ..

0
sujataapatil
sujataapatil

Question 7 months ago on Step 1

I am using NodeMCU, TSOP1738 and receiver circuit same as shown here. But nothing gets printed in serial monitor.
To check if the TSOP1738 is working, I connected it to 5V on arduino uno and checked with IRemote library examples. That works find and I can see codes in serial monitor.

However it does not work with NodeMCU on 3V pin. I also tried changing pin D4 to D5 and D7, but it did not work.
Any suggestions?

0
bitcoinsharjah
bitcoinsharjah

Question 2 years ago

My Air condition remote is transmitting long data and different codes every time I press OnnOff button.Any Clue how to solve this.

0
queserasera701
queserasera701

Answer 2 years ago

hi do u resolve this issue?? im working with the project now, can u help me out please?

0
freefox
freefox

Reply 10 months ago

How did you resolve this? If you did it at all.

"Press the button rapidly and don't keep it pressed more than a few milliseconds." -> this is just a completely dumb solution and you will waste your time on it it will never work

However your project highlighted that using the ESP8266 to decode, transmit IR data can be significantly different from using an Arduino with the exact same TSOP/IR led.

For example here is the difference between the 2:

//Arduino decoded
unsigned int ROBO_HOME[]={4850,3950,900,150,950,100,1000,100,950,1200,950,150,950,100,950,1200,950,100,4900,3900,900,200,950,100,600,150,200,150,900,1250,900,150,900,200,900,1250,900,100,4850,4000,900,150,950,100,1000,100,950,1200,950,150,900,200,850,1250,950,100,4800,4000,900,200,850,200,950,100,950,1250,900,150,950,150,850,1300,900,150,4800,4000,900,150,950,150,900,150,900,1250,900,200,900,150,900,1250,900};

//ESP8266 decoded
unsigned int ROBO_HOME[]={4604,128,788,3366,694,388,666,106,976,122,960,106,476,928,666,418,666,92,1782,712,664,402,4604,130,496,84,112,3456,690,392,664,90,994,94,988,118,638,752,682,400,666,70,1012,118,562,824,690,376,5528,3358,694,388,666,110,974,124,960,108,474,926,692,390,1766,98,538,852,684,382,4604,104,770,3406,666,416,666,248,836,96,986,94,542,872,666,418,666,112,970,110,554,840,694,374,5384,3500,664,418,1750,96,1700};

As you can see the 2 are nothing alike. Regardless I also have changing code for the same button pushed the value stays around the same number range, nevertheless I could never control this device with either the Arduino or the ESP8266 so some help would be appreciated.


Yeah your instructables like 90% of the IR instructables out there will work with the off the shelf devices and libraries like NEC, Panasonic, Samsung but when you try to automate something like an air conditioner or in my case this is my ilife robot's remote you will face difficulties.

I think that the code itself what it transmits doesn't constantly changes but for some reason both the ESP and the Arduino are FAIL to decode it properly. For example I can just get my LG phone fire up the "Quick Remote" app and it learns the signals right away and just works.

0
konpanou
konpanou

Answer 2 years ago

Press the button rapidly and don't keep it pressed more than a few milliseconds.
Press it a few times and take the most common number that appears

0
corincorvus
corincorvus

Question 1 year ago

Hi,
i did your how to and i got all codes of my remote. The how to runs fine. Now i struggle with the remote itself.

i putted in the codes and tried to send the codes in me Decoder.
If i click every time the same code, i get random "UNKNOWN" codes every time. What i did wrong?

F:\Cloud\C-Lab\Medien\Bilder\Uploads\Screenshots\2020-08-31 22_45_51-Window.jpg

Code: https://pastebin.com/VFbSvqQ5

2020-08-31 22_45_51-Window.jpgIMG_20200831_224943.jpg
0
corincorvus
corincorvus

Answer 1 year ago

Anyone there? :O

0
veeradinesh3
veeradinesh3

Reply 1 year ago

well done and grt job. I need some help can any one help in this can contact me !

0
ROUGEXIII
ROUGEXIII

3 years ago

Hi,
Can you explain why you don't need resistor for your emitter led?
How do you set the current limit to not damage the led?

0
Abhrodeep Chanda
Abhrodeep Chanda

Reply 3 years ago

I have used a transistor i.e. BC547 that has a collector current of 100mA for which ai don't need a ressistor to limit the current. If I would have used 2N222 transistor definitely there will be a resistor to limit the collector current of 600mA. Thanks for asking but I mentioned it in the article about the collector current of the different transistor. For BC547 the range also gets short as the led is not emitting at its peak.

0
ROUGEXIII
ROUGEXIII

Reply 3 years ago

Hi,
Thanks for your answer, sorry I didn't understood the transistor was the current limiter. I never see a such usage, very interesting. Isn't there any risk for the transistor? I thought the data-sheet current was a limit rather than a characteristic.

0
Abhrodeep Chanda
Abhrodeep Chanda

Reply 3 years ago

Did I say the transistor is acting as current limiter? If I did I'm totally wrong. current limit for transistor is 100mA. The circuit is running on 3V, the normal resistance of the IR led is 22-25ohm and transistors are made of semi-conducting materials as well as depletion zone also provides a bit resistance even if forward biased. So in my circuit when I used resistance of 33ohm the IR led's intensity was so less I literally had to take it to the TV and make it cuddle with it. So mathematically 3V/32ohm (around) in my case 93mA that is not at all above the limit. But when I measured in the circuit it was 80mA or less. So I concluded that having a current limiter resistance theoretically is good but in practical nothing is perfect so need to innovate and make it like "what you need". This is an 1year old project but my IR Led and transistor both are working fine. Thanks for pointing me though.

0
maddavo
maddavo

Reply 1 year ago

The voltage drop is due to the transistor junction. Don't forget that when the transistor is on it is essentially a diode and the voltage drop also counts. Your 3.3V from the Nodemcu gets reduced quickly hence why the IR LED output is weak. You would be better off connecting the IR LED anode to the 5V MicroUSB supply at Vin - better output and also less load on the 3.3V regulator.

0
Abhrodeep Chanda
Abhrodeep Chanda

Reply 1 year ago

yes that will be a good solution. there is a amplifying factor of the transistor so even 3.3V will work(with the drops) if we use transistor of right amplification factor. i did it afterwards didnt get any problem, no issues with the 3.3v regulator it can handle this much. otherwise can use Vin pin with 5V shorted to transistor as you said.

0
MadLabz217
MadLabz217

1 year ago

In the IRremoteESP.ino I highlighted potentially faulty code for the password, everything seems to be working great without sucking my own A**......lol

lol.JPG
0
Abhrodeep Chanda
Abhrodeep Chanda

Reply 1 year ago

i changed the fault in git!! sorry for the password :D

0
bimalachira
bimalachira

1 year ago

How can I assign decoded (received data) to a string variable? I mean "serialPrintUint64(results.value, 16)". Please help me,