ESP8266 / NodeMCU / Arduino based TV Remote

These 2 items should do it then?

Exactly. Just keep in mind that the IR receiver in that pack is AWESOME. Receives from super-far away. However, the IR blaster/sender is good for like 3-4 feet max. It’s a POS IMO but it will suffice to get you further in your project while waiting for a decent TSAL6400 or TSAL6100 that you should order from China today as it will take a while to get them — or overpay with some US seller. I did the former, perfected my project & goal and suffered for another few days until the real IR LED’s with serious power came.

I ordered what I listed. Considering this is just for the soundbar which is on top of the refrigerator, I should be ok.

Thanks again!

Updated the code to respect increments of 10 when speaking with Alexa or doing automation with Samsung’s minimal automation ability in ST called Smart Lighting (my biggest reason for switching). This allows 10 things that you can theoretically do with Alexa & Zwave remotes, etc.

In my case, 0% mutes & unmutes, 10% changes inputs, 20% sets my HDMI switched to first input and 30% to the second. It works really well and I’m using fully supported automation SmartApp from SmartThings.

Grab the latest from GitHub.

Hi Guys,

I am working on project to control AC through the IR remote the AC brand is Eomjoi power and I couldn’t get the hex code from ESP8266 IR remote library

the output like this:

` Timestamp : 000626.759
  Encoding  : UNKNOWN
  Code      : F3457ED1 (114 bits)
  Library   : v2.6.0

  Raw Timing[227]:
     +  2966, -  1768,    +   418, -  1126,    +   418, -  1124,    +   418, -   408, 
     +   416, -   408,    +   416, -   408,    +   416, -  1126,    +   418, -   408, 
     +   414, -   424,    +   414, -  1126,    +   418, -  1126,    +   418, -   408, 
     +   414, -  1126,    +   416, -   410,    +   414, -   410,    +   414, -  1126, 
     +   416, -  1142,    +   416, -   408,    +   416, -  1126,    +   416, -  1126, 
     +   416, -   410,    +   414, -   408,    +   414, -  1126,    +   416, -   410, 
     +   414, -   424,    +   414, -  1128,    +   416, -   408,    +   414, -   410, 
     +   414, -   410,    +   414, -   410,    +   414, -   408,    +   414, -   410, 
     +   412, -   424,    +   414, -   410,    +   414, -   410,    +   414, -   410, 
     +   414, -   410,    +   414, -   408,    +   414, -   410,    +   414, -   410, 
     +   414, -   424,    +   414, -   410,    +   414, -   410,    +   414, -  1128, 
     +   416, -   410,    +   414, -   410,    +   414, -  1126,    +   416, -   410, 
     +   412, -   424,    +   414, -  1126,    +   416, -  1130,    +   414, -   410, 
     +   414, -   408,    +   414, -   410,    +   414, -   410,    +   414, -   410, 
     +   414, -   424,    +   414, -   410,    +   414, -   408,    +   414, -   410, 
     +   412, -   412,    +   412, -   410,    +   412, -   410,    +   414, -   410, 
     +   414, -   426,    +   412, -   412,    +   412, -   410,    +   414, -   410, 
     +   412, -   410,    +   414, -   410,    +   414, -   410,    +   412, -   410, 
     +   412, -   426,    +   412, -   410,    +   412, -   410,    +   412, -   410, 
     +   414, -   410,    +   414, -   410,    +   412, -   410,    +   412, -   410, 
     +   414, -   426,    +   410, -   410,    +   414, -   410,    +   412, -   410, 
     +   412, -   412,    +   412, -   410,    +   414, -   410,    +   412, -   410, 
     +   414, -   424,    +   412, -   410,    +   412, -   412,    +   412, -   410, 
     +   412, -   410,    +   412, -   412,    +   412, -   412,    +   412, -   410, 
     +   412, -   426,    +   412, -   410,    +   412, -   410,    +   412, -   410, 
     +   414, -   410,    +   414, -   412,    +   412, -   410,    +   412, -   412, 
     +   412, -   426,    +   412, -   410,    +   414, -   410,    +   412, -  1128, 
     +   414, -  1128,    +   416, -  1128,    +   416, -  1128,    +   414, -   412, 
     +   412, -   428,    +   412

  uint16_t rawData[227] = {2966, 1768,  418, 1126,  418, 1124,  418, 408,  416, 408,  416, 408,  416, 1126,  418, 408,  414, 424,  414, 1126,  418, 1126,  418, 408,  414, 1126,  416, 410,  414, 410,  414, 1126,  416, 1142,  416, 408,  416, 1126,  416, 1126,  416, 410,  414, 408,  414, 1126,  416, 410,  414, 424,  414, 1128,  416, 408,  414, 410,  414, 410,  414, 410,  414, 408,  414, 410,  412, 424,  414, 410,  414, 410,  414, 410,  414, 410,  414, 408,  414, 410,  414, 410,  414, 424,  414, 410,  414, 410,  414, 1128,  416, 410,  414, 410,  414, 1126,  416, 410,  412, 424,  414, 1126,  416, 1130,  414, 410,  414, 408,  414, 410,  414, 410,  414, 410,  414, 424,  414, 410,  414, 408,  414, 410,  412, 412,  412, 410,  412, 410,  414, 410,  414, 426,  412, 412,  412, 410,  414, 410,  412, 410,  414, 410,  414, 410,  412, 410,  412, 426,  412, 410,  412, 410,  412, 410,  414, 410,  414, 410,  412, 410,  412, 410,  414, 426,  410, 410,  414, 410,  412, 410,  412, 412,  412, 410,  414, 410,  412, 410,  414, 424,  412, 410,  412, 412,  412, 410,  412, 410,  412, 412,  412, 412,  412, 410,  412, 426,  412, 410,  412, 410,  412, 410,  414, 410,  414, 412,  412, 410,  412, 412,  412, 426,  412, 410,  414, 410,  412, 1128,  414, 1128,  416, 1128,  416, 1128,  414, 412,  412, 428,  412};  // UNKNOWN F3457ED1` 

How can I solve it please!

You copy the very last line that starts with uint16_t and replace any one of mine with yours. Then go to the device via web browser and click whatever link you threw your uint16_t into…

1 Like

@JZst thanks for your nice reply :slight_smile:

you mean I use this http://www.zmote.io/irtool ?

sorry because I am new with IR remote tech :slight_smile:

@Cisco_Saeed no you simply go to this file: https://github.com/JZ-SmartThings/SmartThings/blob/master/Devices/TVDevice/IRSender.ino

Replace line 166 with your last line from the pasted content above. Then you also change line 167 to be 227 instead of 20… then you flash the chip via IDE, open the ESP8266 page and press the channel up link because that’s what we replaced.

1 Like

Yes thanks it works fine…now I want to map all codes for buttons :star_struck:

Sounds like you got some work to do then :slight_smile:

1 Like

Yes many thanks for your guidelines :smile: but could you explain to me this part of code why you include NEC and two raw data in turn on and off?

if (server.arg(i) == "on") {
    uint16_t rawData[20] = {6000,1200, 1200,1200, 600,600, 1200,600, 600,600, 600,600, 600,600, 1200,1200, 1200,600, 600,30000};  // UNKNOWN A80E7E5E
    irsend.sendRaw(rawData, 20, 32);
    delay(1000);
    irsend.sendNEC(0x20DF23DC, 32);
    uint16_t tvon[67] = {9050,4450, 650,550, 650,550, 650,1650, 650,550, 650,550, 650,550, 650,550, 650,550, 650,1650, 650,1650, 650,550, 650,1650, 650,1650, 650,1650, 650,1650, 650,1650, 650,550, 650,550, 650,1650, 650,550, 650,550, 650,550, 650,1650, 650,1650, 650,1650, 650,1650, 650,550, 650,1650, 650,1650, 650,1650, 650,550, 650,550, 650};  // NEC 20DF23DC
    irsend.sendRaw(tvon, 67, 32);

why not use only the raw data?

I do things twice because I’m turning multiple devices on/off…

You can use the sendRaw but to be honest, if your specific IR code complies with some standard (like NEC) then you should use that. The reason is because the ā€œreadingā€ of IR on Arduino is not 100% accurate when it comes to clock duration. However, sending with a known standard mandates better timings than the raw signature that your reader saw.

1 Like

Yes you are right that is I noticed when I am reading the codes of my Emjoi AC control for example every temperature points in remote control has different codes even if I change the mode from auto to mid or low the temperature points will change the codes as well! so it’s better to use more raw data if the codes are differents at the same points. I mean the temperature up and down is different in each temp points and in each fan speed or mode…even on and off is different when I change the mode or the fan speed!

even when I am using broadLink IR device for my AC remote I got it not accurate sometimes! but some AC remote has clear raw data and codes like Gree AC remote

Unfortunately it’s trial and error plus what I told you — timing is not perfect when reading. Look at some raw examples on the web and notice a few of mine at the top of the INO doc. While Arduino reads in some value like 624 or 614 or 644 — you really want to either send 600 or 650, etc. Meaning you gotta do some manual rounding for your 200+ codes. I used global replace when I figured out that the reading is not 100% accurate.

1 Like

I came back here to know if you have any idea about what I am trying to do is like this:

I have around 15 rawdata for temperature in my AC I added in my code then I made if statement to choose every one upon what my set point temperature i choose…for example I have 15 temperature rawdat then normally I will have 15 if statements or 15 switch cases.

the rawdata like this:

    uint16_t temp31[227] = {2976, 1780,,  390, 440, };  // UNKNOWN F3457ED1
   uint16_t temp30[227] = {2948, 1804,  390, 384, 1166,  386, 442,  386};  // UNKNOWN 7FB0FE69
   uint16_t temp29[227] = {2976, 1778,  418, 1134, 458,  386};  // UNKNOWN 3FC09953
    and so on continue for all 

if you noticed the name of rawdata start with temp then followed by the number of set point, then what I want is to make one variable which combine between temp and the number of setpoint then in this case I can use only one irsend.sendRaw(z,224,38) which z is combination of Temp and the number which will be change.

I tried something like this but didn’t work:

String temp = "temp";
 uint16_t x = strtoul(&(temp.c_str()[3]), NULL, 0);
 uint16_t y;
 uint16_t z;
 y = setpoint2;
 z = x+y;

irsend.sendRaw(z, 227, 38);

but gave me this error: invalid conversion from 'uint16_t {aka short unsigned int}' to 'uint16_t* {aka short unsigned int*}' [-fpermissive]

if have any Idea for this case I will be grateful :blush:

Your questions are generic pertaining to the IR library and its commands. They’re not really about the SmartThings aspect of the integration.

The few mistakes I see here:

  1. 227 is in the square brackets but you’re only passing like 4-6 parameters to it… you are required to pass all 227 of them.
  2. Not sure how you’re obtaining the temperature variable but some of this logic does not make sense. You almost have to either read that setting dynamically or store it from the last time — but then you’re out of sync if somebody manually changes the temperature on the unit.
  3. Use sendRaw for stuff that’s NOT reporting an ā€œEncodingā€ of UNKNOWN as your post above shows.

Ultimately, make small stuff work before taking on bigger tasks.