Irremoteesp8266: LG code port problem

Created on 14 Sep 2015  路  6Comments  路  Source: crankyoldgit/IRremoteESP8266

Hi

Library is great, but I have strange problem. I ported LG code send function from here: https://github.com/z3t0/Arduino-IRremote/blob/master/ir_LG.cpp
but it is not working. I am sending ir codes to my LG airconditioner from ESP8266. I also have second device based on arduino as ir-receiver for troubleshooting. Both codes, sent from ESP8266 and from oryginal ir remote looks identically in arduino code grabber, but remote is working fine and codes from ESP are being ignored. What am I doing wrong? Maybe I ported code in a wrong way? I just copied function code and declarations...

Most helpful comment

One more thing - when I am sending NEC codes to my TV from ESP it works fine, so it looks like code need some tweaks after porting, or aircon is very sensitive for every disruption (length of signal for zeros and ones).

---edit---
I will try one more thing today - as I/O pins on ESP8266 can deliver only 12mA of current, I'll try to power IR LED directly from 3V3 by using transistor. Maybe 12mA is not enough and some devices cannot capture signal from LED...

---edit---
Problem fixed - driving led thru transistor helped. It looks like 12mA directly from IO pin is not enough for my IR LED to be recognized by AC.

It also shows that other protocols can be ported directly by copying corresponding functions :)

All 6 comments

Well can you send the code from the Arduino? I think, maybe your LED has a slightly different frequency then the receiver of the airconditioner

The same LED and the same code on oryginal arduino board and oryginal IR library works fine. I have no idea what is wrong.

One more thing - when I am sending NEC codes to my TV from ESP it works fine, so it looks like code need some tweaks after porting, or aircon is very sensitive for every disruption (length of signal for zeros and ones).

---edit---
I will try one more thing today - as I/O pins on ESP8266 can deliver only 12mA of current, I'll try to power IR LED directly from 3V3 by using transistor. Maybe 12mA is not enough and some devices cannot capture signal from LED...

---edit---
Problem fixed - driving led thru transistor helped. It looks like 12mA directly from IO pin is not enough for my IR LED to be recognized by AC.

It also shows that other protocols can be ported directly by copying corresponding functions :)

@direk Thank you for your tip.

Hi!
this code work for me:
in IRremoteESP8266.cpp
...
void IRsend::sendNEC(unsigned long data, int nbits)
{
enableIROut(38);
mark(NEC_HDR_MARK);
space(NEC_HDR_SPACE);
for (int i = 0; i < nbits; i++) {
if (data & TOPBIT) {
mark(NEC_BIT_MARK);
space(NEC_ONE_SPACE);
}.
else {
mark(NEC_BIT_MARK);
space(NEC_ZERO_SPACE);
}
data <<= 1;
}
mark(NEC_BIT_MARK);
space(0);
}

void IRsend::sendLG (unsigned long data, int nbits)
{
enableIROut(38);
mark(LG_HDR_MARK);
space(LG_HDR_SPACE);
mark(LG_BIT_MARK);
for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
if (data & mask) {
space(LG_ONE_SPACE);
mark(LG_BIT_MARK);
} else {
space(LG_ZERO_SPACE);
mark(LG_BIT_MARK);
}
}
space(0);
}

void IRsend::sendWhynter(unsigned long data, int nbits) {
...

and off course in IRremoteESP8266.h

void sendNEC(unsigned long data, int nbits);
void sendLG(unsigned long data, int nbits);
void sendSony(unsigned long data, int nbits);

Ok, thanks, I added your function. Next time you may issue a pull request, which would make my work easier and give you proper credits (but I still wrote your name in the commit message).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leobel96 picture leobel96  路  6Comments

ilyasrois picture ilyasrois  路  3Comments

bilkosem picture bilkosem  路  5Comments

Shalabyer picture Shalabyer  路  7Comments

the-mentor picture the-mentor  路  5Comments