Skip to content

Issues Sending IR Signals with Protocol 1 (LG) Using IRremoteESP8266 #2162

Open
@mrxehmad

Description

I'm encountering issues when trying to send IR signals using the LG protocol with the IRremoteESP8266 library on an Arduino ESP8266 board. The default irsend.sendLG() function is not functioning as expected for my specific device, and I need assistance in setting up a custom bit pattern or finding an alternative solution.

Steps Taken:

  1. I set up the IR receiver and sender as follows:

    #include <IRremoteESP8266.h>
    #include <IRrecv.h>
    #include <IRutils.h>
    #include <IRsend.h>
    
    const uint16_t kRecvPin = D6;  // HX1838 OUT pin connected here
    const uint16_t kIrLedPin = D0;  // Pin connected to IR LED
    const uint16_t kButtonPin = D1; // Button connected here
    
    IRrecv irrecv(kRecvPin);
    IRsend irsend(kIrLedPin);
    decode_results results;
    
    void setup() {
      Serial.begin(115200);
      Serial.println("\nStarting IR system");
    
      irrecv.enableIRIn();  // Start the receiver
      Serial.println("Ready to receive IR signals");
    
      irsend.begin();
      Serial.println("Ready to send IR signals");
    
      pinMode(kButtonPin, INPUT_PULLUP);  // Button is active LOW
    }
    
    void loop() {
      if (irrecv.decode(&results)) {
        Serial.println("\nIR Signal received:");
        Serial.print("Hex Code: ");
        Serial.println(resultToHexidecimal(&results));  // Display HEX code
        Serial.print("Protocol: ");
        Serial.println(results.decode_type);  // Display Protocol (e.g., NEC, SONY)
    
        sendCustomLGSignal(0x805);  // Send IR signal using protocol 1
        Serial.println("Sent IR signal: 0x805 using LG protocol");
        delay(2000);  // Wait 2 seconds before sending again
    
        irrecv.resume();  // Ready to receive the next signal
      }
    
      if (digitalRead(kButtonPin) == LOW) {
        Serial.println("Button pressed! Sending IR signal: 0x805 using LG protocol");
        sendCustomLGSignal(0x805);  // Send IR signal using protocol 1
        delay(500);  // Debounce delay
      }
    }
    
    void sendCustomLGSignal(uint32_t code) {
      const int bitCount = 32;
      const uint16_t timings[] = {
        9000, 4500, 560, 1690, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 1690, 560, 560
      };
    
      irsend.sendRaw(timings, bitCount, 38);  // Send timings in microseconds and bitCount = 38
    }
  2. Issue: Despite sending signals with protocol 1, my target LG device does not respond correctly. It appears that the IR timings might not be accurately configured for this device.
    Button pressed! Sending IR signal: 0x805 using protocol 1 IR Signal received: Hex Code: 0x39ABC918 Protocol: -1
    I always receive random value.

  3. Expected Behavior: I expect the irsend.sendRaw() function to successfully send the IR signal using the custom timings specified for the LG protocol.

  4. What I've Tried:

    • Adjusting Timings: I've tried modifying the timings array to better match the device specifications, but it hasn’t yielded the desired response.
    • Alternative Libraries: I've explored using other libraries like IRremote and IRLib, but they do not seem to provide a straightforward method for custom protocols like protocol 1 in IRremoteESP8266.
  5. Questions:

    • Is there a specific method or additional function in IRremoteESP8266 that can be used to send IR signals using a custom bit pattern for the LG protocol?
    • Could there be a specific set of timings required for protocol 1 (LG) that I am unaware of?
    • Has anyone successfully used protocol 1 with LG signals on the IRremoteESP8266 library and could share their setup or adjustments?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions