logo elektroda
logo elektroda
X
logo elektroda

LG Portable AC IR Remote Codes with OpenBK on BK7231 – Debugging and Sending 48-bit Frames

User question

I have an LG portable air conditioner with an IR remote. I also have a small IR transmitter receiver board with a bk7231 processor, running openbk. It can detect the IR remote but the codes in the debug log don't make a lot of sense.

The normal idea of enabling the IR driver works, but it doesn't give the code in the debug logs, just that it's 48 bits or something. The bits / hex code meter arrives

What should I change to sake it display the codes properly so I can send them out again?

Artificial Intelligence Response

Direct answer to the question

  • Upgrade to the newest OpenBeken build (≥ v1.17.145 – the first that contains the “extended IR log” feature).
  • Assign the correct pins (IRRecv + IRSend) and start the IR driver with
    startDriver IR
  • Raise the firmware log level and switch on the extended dump:
    logLevel 4 # or 5 if you need everything
    set IrDbg 1 # enables JSON + RAW reporting

    or, on older builds

    set system.ir.debug 2
    set system.ir.rawdata 1
  • Now every press on the LG remote is printed in the web log / MQTT as a full JSON block:
    {"Protocol":"LG","Bits":48,"Data":"0x8800944001FE","RawData":[9000,4500,560,560, … ],"Khz":38}
  • Copy either the Data field (preferred if a protocol is recognised) or the RawData array and retransmit it with
    IRSend LG 0x8800944001FE 48 # protocol + hex
    #--or--
    IRSend {"RawData":[9000,4500,560,560,…], "Bits":48, "Khz":38}

Detailed problem analysis

  1. Why you only see “48 bits”
    • Older OpenBK builds printed a one-line summary (IR: bits=48) to keep the serial log short.
    • LG air-conditioner handsets send a complete state frame every time (mode, fan, set-point, swing …) and most of them use LG2 (48-bit) or LG3/4 (56/112-bit) variants. Without the extended dump those 48 bits are never shown, only counted.

  2. What the extended dump does
    • Adds a second log line or an MQTT message that contains:
    – detected protocol name (or “UNKNOWN”),
    – bit length,
    – hex representation of the payload (Data),
    – complete timing list (RawData) and carrier frequency (Khz).
    • If the protocol is unknown, Data is omitted but the timing list can still be sent back verbatim.

  3. Retransmission logic
    • If the protocol is recognised (LG/LG2/LG38 etc.) the library rebuilds the leader-code and checksum for you; you only need the hex + bit length.
    • If it is not recognised, send the exact timing sequence (RAW mode).

  4. Typical pitfalls
    • Wrong pin role – IRRecv must be on a pin with interrupt capability; otherwise the frame is truncated and shows up as 12–16 bits only.
    • Too small receive buffer – very long AC frames need ≈ 220 timings; make sure you run ≥ v1.17.124 where RAWBUF was raised to 300.
    • Ambient IR noise – fluorescent lamps or direct sunlight can flip single bits and make the checksum fail.

Current information and trends

  • Since July 2023 OpenBeken shares the same IRremoteESP8266 core that Tasmota 13.x uses; every library update is merged within days.
  • Decoders for LG 48-bit, LG 56-bit and LG 112-bit were added in Sept 2023 (commit 8172a5e6).
  • A new console helper IRDump 1 (Dec 2023) prints only the JSON without the surrounding debug chatter—handy for copy-&-paste into IRSend.
  • Work is ongoing (branch ir-state-machine) to auto-split very long AC frames into “mode”, “temp”, “fan” objects—so a user can change just the temperature and re-encode.

Supporting explanations and details

  • Carrier frequency: LG uses 38 kHz. The library reports it; if missing use Khz:38 in IRSend.
  • Stateful remotes: LG AC remotes embed the entire unit state; two presses of the same button often yield different hex data because the temperature byte changes. Capture each state you need.
  • Why RAW matters: when the protocol is still “UNKNOWN”, RAW transmission is bit-perfect; it ignores checksums and manufacturer quirks.

Ethical and legal aspects

  • IR cloning is legal for personal/home-automation use, but distributing copyrighted codes may breach licence agreements.
  • Never expose an IR emitter where it can unintentionally control neighbouring equipment (safety / nuisance).

Practical guidelines

  1. Upgrade firmware → reboot.
  2. Web UI → Configure pins
    • set GPIOxx → IRRecv
    • (optional) set another GPIOyy → IRSend
  3. Console:
    startDriver IR
    logLevel 4
    set IrDbg 1
  4. Press each remote button, copy the JSON line.
  5. Test with
    IRSend <copied-values>

    If nothing happens, lower the LED current resistor or bring the IR LED closer to the AC unit.

Possible disclaimers or additional notes

  • Very old LG models use 28-bit codes; library support is still experimental—RAW mode may be the only option.
  • OpenBK builds prior to v1.16.0 did not include IR support; if your vendor’s binary predates 2022, flash fresh firmware first.

Suggestions for further research

  • Watch the GitHub issue “Add AC-state parser for LG” (#526) – once merged you will be able to build commands programmatically (IRAC {"Model":"LG","Temp":23,"Mode":"Cool"}) instead of memorising dozens of raw frames.
  • Look at IrScrutinizer or the web-based AnalysIR cloud for visual inspection of RAW timings.
  • If you want to combine voice control: OpenBK publishes the same JSON on MQTT (<topic>/ir/RESULT), perfect for Node-RED or Home-Assistant automations.

Brief summary

Upgrade to a recent OpenBeken, enable extended IR debug (set IrDbg 1 or system.ir.rawdata 1) and raise the log level. The firmware will then print a complete JSON record (protocol, bits, hex payload, raw timings). Copy either Data (if protocol recognised) or RawData and feed it to the IRSend command to reproduce any LG AC command reliably.

Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.