Cooking Hacks Forum
https://www.cooking-hacks.com/forum/

IR REMOTE shield with Samsung aircon
https://www.cooking-hacks.com/forum/viewtopic.php?f=43&t=21064
Page 1 of 1

Author:  Stefano Martino [ Thu Dec 05, 2019 6:10 pm ]
Post subject:  IR REMOTE shield with Samsung aircon

Hello,

Some weeks ago I buy an Ir-Remote shield from the shop.
For my project i need to read and send the code of a Samsung remote like the one in the video on the explanation page.

I find 4 error or problem:

1. The duty cycle of the frequency is wrong, the sketch have a 50% but the remote have 19%;
2. The period is approx 30microseconds and the resultant frequency is 33khz, but the sketch say about 38khz like my remote;
3. The reading sketch don't read well the code and remove the first part of it;
4. The voltage on the irled pin is too low compared to the original Samsung remote IR led and the light emitted too.

The duty cycle and the frequency now work well with 1 microsecond up and 15 microsecond down (instead 10 and 10), and the frequency too.

The voltage is too low i think and i can't adjust it (approx 1.3 volt at the peak!).

About the raw code, i try to read and write it manually from a Fluke oscilloscope the first part but the result is the same.

Please can you tell me a list of sketch and library used for do the work that i see in the video on the shop or explain a solution for my problem?

Thank you.

Author:  Stefano Martino [ Wed Dec 11, 2019 3:43 pm ]
Post subject:  Re: IR REMOTE shield with Samsung aircon

Problem: SOLVED!

For RAW lenght < 255 bit:
Open IRremoteInt.h in the last IRRemote library version
Edit the #define RAWBUF value from 101 to 255
Edit the #define _GAP value from 5000 to 20000

If your RAW is longhest than 255, you need to edit the unit from 8 bit to 16 bit.
BUT in this case i find a good sketch for extract the RAW (see the link below):

http://www.analysir.com/blog/2014/03/19 ... s-arduino/

With a mod version of it i read my code of 349 bits and it work fine.


Code:
/*
  Author: Stefano Martino
  Versione: 1.1 - 11 dec 2019

  With this AnalysIR mod you can read long raw IR Remote codes used tipically on Airconds and hvac systems.
  The extracted RAW can pasted directly on the Coocking Hacks SEND Sketch, without any other mods.

  NOTE: for some aircon isn't necessary to repeate the code!

  Credit: Copyright AnalysIR 2014-2019
  http://www.analysir.com/blog/2014/03/19/air-conditioners-problems-recording-long-infrared-remote-control-signals-arduino/

  PINOUT (only tested on Arduino UNO):

  Receiver IR         Arduino
  V+             ->   +5v
  GND            ->   GND
  Signal         ->   Digital Pin 2
*/

#define maxLen 800
#define rxPinIR 2

volatile unsigned int irBuffer[maxLen];
volatile unsigned int x = 0;

void setup() {
  Serial.begin(115200);
  attachInterrupt(digitalPinToInterrupt(rxPinIR), rxIR_Interrupt_Handler, CHANGE);
  delay(500);
  Serial.print("Press a key (once) and wait...");
  Serial.println();
}

void loop() {

  delay(3000);

  if (x) {
    Serial.println();
    Serial.print(F("OK!"));
    Serial.println();
    Serial.println();
    delay(500);
    Serial.print(F("Below are coded "));
    Serial.print((x - 1));
    Serial.print(F(" [RAW] pulses: "));
    Serial.println();
    Serial.println();
    delay(2000);

    detachInterrupt(digitalPinToInterrupt(rxPinIR));

    for (int i = 1; i < x; i++) {

      if (!(i & 0x1)) {
        Serial.print(F("delayMicroseconds("));
      } else {
        Serial.print(F("pulseIR("));
      }
      Serial.print(irBuffer[i] - irBuffer[i - 1]);
      Serial.print(F(");"));
      Serial.println("");
    }
    x = 0;
    Serial.println("");
    Serial.println("Ready for another key...");

    attachInterrupt(digitalPinToInterrupt(rxPinIR), rxIR_Interrupt_Handler, CHANGE);
  }
}

void rxIR_Interrupt_Handler() {
  if (x > maxLen) return;
  irBuffer[x++] = micros();

}


Stefano

Author:  libelium-dev [ Wed Dec 11, 2019 4:26 pm ]
Post subject:  Re: IR REMOTE shield with Samsung aircon

Hi Stefano,

Apologies for our late response, glad to hear you solve the problem by yourself.

If you have any other question, please feel free to ask.

Regards

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/