IR transmitters

Thank you. Now this part is fixed but I think there is still some issue with long numbers as the codes that fit in a signed long works but no the bigger numbers that need unsigned long.

When I send the code -> Hex: 7E817E81 (decimal 2122415745) it works fine.

When I send the code -> Hex: 807F817E (decimal 2155839870) it doesn’t work. And according to AnalysIR this is what is sent:

1;0;1000;0|2;1000;7445;1|3;8445;235;0|4;8680;1237;1|5;9917;4544;0|6;14461;555;1|7;15016;1707;0|8;16723;533;1|9;17256;597;0|10;17853;555;1|11;18408;576;0|12;18984;533;1|13;19517;576;0|14;20093;512;1|15;20605;597;0|16;21202;533;1|17;21735;597;0|18;22332;533;1|19;22865;597;0|20;23462;533;1|21;23995;597;0|22;24592;533;1|23;25125;597;0|24;25722;533;1|25;26255;1707;0|26;27962;555;1|27;28517;1685;0|28;30202;576;1|29;30778;1685;0|30;32463;533;1|31;32996;1707;0|32;34703;555;1|33;35258;1707;0|34;36965;555;1|35;37520;1707;0|36;39227;533;1|37;39760;1728;0|38;41488;555;1|39;42043;1707;0|40;43750;555;1|41;44305;576;0|42;44881;533;1|43;45414;576;0|44;45990;533;1|45;46523;597;0|46;47120;533;1|47;47653;576;0|48;48229;533;1|49;48762;597;0|50;49359;533;1|51;49892;597;0|52;50489;533;1|53;51022;1707;0|54;52729;555;1|55;53284;576;0|56;53860;533;1|57;54393;1707;0|58;56100;555;1|59;56655;1707;0|60;58362;555;1|61;58917;1707;0|62;60624;555;1|63;61179;1707;0|64;62886;555;1|65;63441;1707;0|66;65148;555;1|67;65703;1707;0|68;67410;555;1|69;67965;576;0|70;68541;533;1|71;69074;597;0|72;69671;533;1|73;70204;597;0|74;70801;533;1|75;71334;597;0|76;71931;555;1|77;72486;576;0|78;73062;533;1

Here you can see the correct code send by the remote (in yellow) and the code sent by the sketch (in green):

I have no clue what the problem is (other than the size of the number).

When you receive this code via mqtt transceiver - how mqtt message and topic looks like ?
May your device have different bit-lenght? I forget about it - see new code. Note that I didn’t check it yet.

I’m sorry I do not have an IR detector connected to my ESP8266.

I think the issue may be within the IRremoteESP8266 library as I just tested and same problem happens with the original IRSendDemo sketch included with the library. I just opened an issue here: https://github.com/markszabo/IRremoteESP8266/issues/27

According to AnalysIR the bit-lenght is always 32bits. You can see here some random keys of the remote pressed captured and analysed by AnalysIR:

I changed the irsend.sendNEC(msgInt, irBitsInt); line in the code and it looks better (I closed the issue as I had a similar mistake in my testing with the IRSendDemo sketch.

I’m still receiving a wrong code (when I send 807F817E I receive 7E81FE01). It looks similar and partially reversed, don’t know why (is swaped as: ABCD => DCxx.

807F817E: 10000000 01111111 10000001 01111110
7E81FE01: 01111110 10000001 11111110 00000001

As a sidenote, after changing the code I have to use irtrans01/sender/NEC/32 as irtrans01/sender/NEC send nothing.

Let me do some more testing to clear whats going on, right now I’m not sure. I will report later…

I’m really tired. After most of the day testing different things I still don’t know what’s going on.

I added a IR receiver to the ESP8266 and it gives me the same code AnalysIR does but looks like some times it works and some times dons’t. Also some codes works fine 100% of times and some others almost never.

Many times the start bit (should be around 9us) has a gap, always at the same position (like 5us high, 2us low and 2us high.

I tried different sketches, different hardware and also visualized the IR signal with an oscilloscope.

I’m going to rest and will continue tomorrow or the weekend.

Try test with simple code on Arduino hardware and just transmit your codes. I’m afraid that ESP implementation of IR library is not so good as for Arduino. Unfortunatelly I can’t test because I don’t have device with problems.

I managed to make it work.

Looks like the problem I had is only with certain IR codes, so I just avoided them. Fortunately all the codes I need for what I want to do with my Yamaha receiver are working now.

Thank you very much for your code. It’s fantastic!

Mario.