cyborg5 / IRLib2

Library for receiving, decoding, and sending infrared signals using Arduino
GNU General Public License v3.0
384 stars 138 forks source link

[SOLVED] Samsung soundbar reported as unknown #85

Closed xbipin closed 4 years ago

xbipin commented 4 years ago

i have tried irremote as well as this library and i get the same hash value for volume up, down and mute for my samsung soundbar but the protocol appears unknown for both libraries, raw values are listed below, any idea what protocol its using because in irremote i tried sending as samsung but doesnt work

unsigned int SOUNDBARVolPlus[] = {4400,4450, 450,500, 500,500, 500,450, 500,500, 500,1500, 450,1500, 500,500, 450,500, 500,1500, 500,1450, 500,1500, 450,1500, 500,500, 450,500, 500,500, 500,500, 500,4400, 500,500, 500,450, 500,500, 500,500, 500,1450, 500,1500, 450,1400, 600,500, 500,1450, 500,1400, 550,1500, 500,500, 450,500, 500,500, 500,500, 500,1450, 500,500, 500,450, 500,500, 500,1500, 450};

unsigned int SOUNDBARVolMinus[] = {4450,4400, 500,450, 500,500, 500,500, 500,500, 450,1500, 500,1450, 500,500, 500,500, 500,1500, 450,1500, 450,1500, 500,1400, 550,500, 500,500, 500,450, 500,500, 500,4450, 450,500, 500,500, 500,450, 500,500, 500,500, 500,500, 450,500, 500,1500, 500,1450, 500,1450, 500,1500, 500,500, 450,1500, 500,1500, 450,1500, 500,500, 450,500, 500,500, 500,500, 450,1450, 550};

unsigned int SOUNDBARVolMute[] = {4450,4400, 500,500, 450,500, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1500, 500,1450, 500,1450, 500,500, 500,500, 500,500, 450,500, 500,4400, 500,500, 500,500, 500,500, 450,500, 500,1400, 600,450, 500,500, 500,500, 500,1500, 450,1500, 500,1450, 500,500, 500,450, 500,1500, 500,1450, 500,1450, 550,450, 500,500, 500,500, 500,1400, 550};
xbipin commented 4 years ago

its a samsung hw-j250. hash values for volume up, down and mute as below

Unknown protocol. Hash value is: 0xCF2F9DAB
Unknown protocol. Hash value is: 0xB2BBAC69
Unknown protocol. Hash value is: 0x123CD34B
xbipin commented 4 years ago

frequency is 38khz, sending raw values is a bit finicky and i have no idea how many times to send the code so i loop it 4-5 times but the soundbar reacts differently on single press and long press compared to the original remote on which long press makes it register once and ignore the rest even if the hash value transmitted is the same for both.

xbipin commented 4 years ago

my bad, i didnt enable samsung36 detection and in fact the soundbar uses samsung36 encoding so that got sorted out but my LG TV uses the NEC protocol which gets detected by irremote as well as irlib2 but im able to send NEC codes only using irremote which the TV works on, using irlib2 sending NEC doesnt work, below is my sketch, any help would be appreciated

#include <IRLibDecodeBase.h>
#include <IRLibSendBase.h>
#include <IRLib_P01_NEC.h>
#include <IRLib_P03_RC5.h>
#include <IRLib_P08_Samsung36.h>
#include <IRLibCombo.h>

IRdecode myDecoder;
IRsend irsend;
#include <IRLibRecv.h> 
IRrecv irrecv(11);

unsigned int TVon = 0x20DF10EF;
unsigned int RECEIVERon1 = 0x28B5;
unsigned int RECEIVERon2 = 0x38B5;
unsigned int RECEIVERVolPlus1 = 0x28C2;
unsigned int RECEIVERVolPlus2 = 0x38C2;
unsigned int RECEIVERVolMinus1 = 0x2894;
unsigned int RECEIVERVolMinus2 = 0x3894;
/*unsigned int RECEIVERVolMute1 = 0x28B9;
unsigned int RECEIVERVolMute2 = 0x38B9;*/
unsigned int SOUNDBARVolPlus = 0xEE11;
unsigned int SOUNDBARVolMinus = 0x1EE1;
/*unsigned int SOUNDBARVolMute = 0x8E71;*/
unsigned int SOUNDBARAddr = 0xCF0;
int BURST = 4;

void setup() {
  irrecv.enableIRIn();
}
void loop() {
  if (irrecv.getResults()) {
    myDecoder.decode();
    if(myDecoder.protocolNum == 3) {
      if ((myDecoder.value == RECEIVERVolPlus1) || (myDecoder.value == RECEIVERVolPlus2)) {
        int i = BURST;
        while (i > 1) {
          irsend.send(SAMSUNG36, SOUNDBARVolPlus, SOUNDBARAddr);
          i--;
        }
      } else if ((myDecoder.value == RECEIVERVolMinus1) || (myDecoder.value == RECEIVERVolMinus2)) {
        int i = BURST;
        while (i > 1) {
          irsend.send(SAMSUNG36, SOUNDBARVolMinus, SOUNDBARAddr);
          i--;
        }
      /*} else if ((myDecoder.value == RECEIVERVolMute1) || (myDecoder.value == RECEIVERVolMute2)) {
        int i = BURST;
        while (i > 1) {
          irsend.send(SAMSUNG36, SOUNDBARVolMute, SOUNDBARAddr);
          i--;
        }*/
      } else if ((myDecoder.value == RECEIVERon1) || (myDecoder.value == RECEIVERon2)) {
        int i = BURST;
        while (i > 1) {
          irsend.send(NEC, TVon, 0);
          /*irsend.send(NEC, REPEAT_CODE, 0);*/
          i--;
        }
      }
    }
    irrecv.enableIRIn();
  }
}
xbipin commented 4 years ago

solved, had to change unsigned int to unsigned long