Trouble sending IR command to rc curtains

Hey guys,

So this has had me stumped for the past few days.

Cliffs:

  • want to control remote control curtains via arduino
  • have this identical setup IR Communication - SparkFun Learn
  • using shirriff's library to read from the provided remote control

And... that's where things go wrong. Every time I press a particular button from the remote control, I get different values. I understand some protocols allow for a few different codes for the same button press, but I'm literally getting a different value 90% of the time. Occasionally a few values will show up again.

Fortunately the manufacturer has listed some codes so one can program them into home automation devices... so I thought maybe I can bypass the whole receiving/decode and just go to outright sending.

Is an infrared blaster compatible with erod™ motorized drapery hardware in order to integrate with my home automation system?
Yes, erod™ can be integrated. Use these wavelengths to program the blaster.
Close- 110100100000, Open- 110100010000, Stop- 110100001000
Hex code: Open- D10, Close- D20, Stop- D08

I tried using the following but with no luck:

#include <IRremote.h>

IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  
    for (int i = 0; i < 3; i++) {
      irsend.sendNEC(0xd10, 12); // Sony TV power code
      delay(40);
    }
  
}

Also tried sendRC5/RC6, and for the hell of it send sony. Not even sure what protocol it is. Could the remote be using some unsupported protocol? Or am I making some total newbie mistake?

Some other notes

  1. The circuit is hooked up correctly, because when I rant he sendPanasonicJVC script I was able to toggle my tv on/off just fine.
  2. The IR led is flashing when shining phone camera at it
  3. curtain rod manufacturer site : http://myerod.com/faqs/#eighteen
  4. I coudln't ever get the raw dump feature to work even for supported remotes such as the panasonic. Like raw dump -> sendRaw. I really don't care about decoding it; my end project has no reads just sends. So if raw can work that'd be swell.

Your curtain controller might be like some air conditioners and use a MUCH longer code than the typical IR remote. This causes problems with the IRremote library because it has a relatively small buffer. Go into /Arduino/libraries/IRremote/IRremote.h and change:

#define RAWBUF 76 // Length of raw duration buffer

to a higher number like 300. Then you have to go into IRremoteInt.h and change:

  uint8_t rawlen;         // counter of entries in rawbuf

to

  uint16_t rawlen;         // counter of entries in rawbuf

I coudln't ever get the raw dump feature to work even for supported remotes such as the panasonic

Well you really need to be able to get the raw dump working with standard TV remote & if you can't then you just have a basic issue with your setup or understanding. I presume you were trying the IRrecvDump example sketch!

I suggest you first try working through all of the examples provided with the IRremote library. You will then be able to understand things better.

(Judging from the signals you provided, you are 'unlikely' to be exceeding the default value for RAWBUF as each code appears to be only 12 bits long)

If you posted the sketch you were using to record the signal and the output you get, it might help.

irsend.sendNEC(0xd10, 12); // Sony TV power code

Unlikely this will work, because NEC is almost always 32 bits not 12. Plus you dont know what format is used to send the signal.
(Could be worth a shot just changing the 12 to 32) = long shot!

johnwasser:
Your curtain controller might be like some air conditioners and use a MUCH longer code than the typical IR remote. This causes problems with the IRremote library because it has a relatively small buffer. Go into /Arduino/libraries/IRremote/IRremote.h and change:

#define RAWBUF 76 // Length of raw duration buffer

to a higher number like 300. Then you have to go into IRremoteInt.h and change:

  uint8_t rawlen;         // counter of entries in rawbuf

to

  uint16_t rawlen;         // counter of entries in rawbuf

I don't think for this particular remote the buffer is an issue, but for the sake of leaving no stone unturned I attempted this anyways. Nothing much has changed.

Although to note, I tried with my panasonic remote and it seems like the raw output still caps at 100 (the value it was before). I made those 2 changes that you recommended and then restarted the arduino program but it still seems to stop at 100.

Decoded PANASONIC - Address: 4004 Value: 100BCBD (48 bits)
Raw (100): 27500 3450 -1650 500 -400 500 -1200 500 -350 500 -400 500 -350 500 -350 500 -350 500 -400 500 -350 500 -350 500 -350 500 -350 500 -400 500 -1200 500 -350 500 -400 500 -350 500 -350 500 -350 500 -400 450 -400 500 -350 500 -350 500 -1250 500 -350 500 -350 500 -350 500 -400 500 -350 500 -350 500 -350 500 -400 500 -1200 500 -350 500 -1250 500 -1200 500 -1250 500 -1200 500 -350 500 -400 500 -1200 500 -350 500 -1250 500 -1200 500 -1250 500 -1200 500 -350 500 -1250 500 
F61E2A57
Unknown encoding: F61E2A57 (32 bits)
Raw (100): -5754 3400 -1750 450 -400 450 -1250 450 -450 450 -400 450 -400 450 -400 450 -450 400 -450 450 -400 450 -400 450 -400 450 -450 450 -400 450 -1250 450 -450 400 -450 450 -400 450 -400 450 -450 450 -400 450 -400 450 -400 450 -400 450 -1300 450 -400 450 -400 450 -450 450 -400 450 -400 450 -400 450 -450 400 -450 450 -1250 450 -400 450 -1300 450 -1250 450 -1300 500 -1200 500 -400 450 -400 450 -1250 500 -400 450 -1250 500 -1200 500 -1250 500 -1200 500 -400 450 -1250 500 
100BCBD
Decoded PANASONIC - Address: 4004 Value: 100BCBD (48 bits)
Raw (100): -8414 3500 -1650 500 -350 500 -1250 500 -350 500 -350 500 -350 500 -400 450 -400 500 -350 500 -350 500 -400 450 -400 500 -350 500 -350 500 -1250 500 -350 500 -350 500 -350 500 -400 500 -350 500 -350 500 -350 500 -400 450 -400 500 -1200 500 -350 500 -400 500 -350 500 -350 500 -350 500 -400 450 -400 500 -350 500 -1250 450 -400 500 -1200 500 -1250 500 -1200 500 -1250 500 -350 500 -350 500 -1250 500 -350 500 -1200 500 -1250 500 -1200 500 -1250 500 -350 500 -1200 500

Here's some random codes from my curtain with the raw dump... does this mean it's 32 bit?

Unknown encoding: 3E84FD4 (32 bits)
Raw (14): 6486 250 -3100 250 -2000 350 -3000 350 -900 250 -750 350 -750 350 
285083F4
Unknown encoding: 285083F4 (32 bits)
Raw (12): -24250 250 -3100 250 -2000 350 -3000 350 -750 400 -2000 250 
E9E70E8C
Unknown encoding: E9E70E8C (32 bits)
Raw (8): -28800 250 -3100 300 -1950 350 -3000 350 
7686B868
Unknown encoding: 7686B868 (32 bits)
Raw (12): 3186 400 -3000 300 -1900 250 -900 250 -2000 200 -3150 350 
FABBA044
Unknown encoding: FABBA044 (32 bits)
Raw (18): -23200 300 -3100 250 -1950 250 -1000 800 -200 400 -700 350 -800 350 -750 350 -750 400 
7C8E0E54
Unknown encoding: 7C8E0E54 (32 bits)
Raw (12): 6336 950 -200 950 -150 400 -700 950 -200 400 -700 200 
E6E709D5
Unknown encoding: E6E709D5 (32 bits)
Raw (8): -6450 250 -3100 250 -900 200 -900 250 
46172D8F
Unknown encoding: 46172D8F (32 bits)
Raw (8): 6336 1000 -150 950 -200 350 -700 350 
FECB4123
Unknown encoding: FECB4123 (32 bits)
Raw (8): 6486 950 -200 900 -250 350 -700 250 
801C88CB
Unknown encoding: 801C88CB (32 bits)
Raw (10): -6500 250 -2000 200 -900 250 -900 200 -900 250

I had a look at your 'curtain' signals and you are right, they are random-ish, although some look similar but are not obviously a match for the 'erod' codes provided.

What type of IR receiver are you using (ie model no & modulation frequency)?

How far way from the receiver do you have the remote when capturing?
Make sure you have nothing around your IR receiver (or behind) that could be reflecting the signal & causing interference.

You signals ar not 32 bits....IRremote seems to default to that when it cant figure out the signal. (not sure)

Given that the manufacturer published the codes, maybe you should email them to see if they would give you more info (like modulation frequency & pulse timings and/or IR protocol used - not just the Hex codes).

BTW: Your panasonic signals decode on my system as the 'Japanese Code' protocol which is not so common. It has 48 bits (96 mark/spaces), plus 4 other mark/spaces (lead-in, header & trailer), which coincidently matches the max setting for RAWBUF of 100. what type of device is this Panasonic (TV ?).

It might be time to find someone with a storage oscilloscope so you can check the raw signal for modulation frequency and pulse widths.

AnalysIR:
I had a look at your 'curtain' signals and you are right, they are random-ish, although some look similar but are not obviously a match for the 'erod' codes provided.

What type of IR receiver are you using (ie model no & modulation frequency)?

How far way from the receiver do you have the remote when capturing?
Make sure you have nothing around your IR receiver (or behind) that could be reflecting the signal & causing interference.

You signals ar not 32 bits....IRremote seems to default to that when it cant figure out the signal. (not sure)

Given that the manufacturer published the codes, maybe you should email them to see if they would give you more info (like modulation frequency & pulse timings and/or IR protocol used - not just the Hex codes).

BTW: Your panasonic signals decode on my system as the 'Japanese Code' protocol which is not so common. It has 48 bits (96 mark/spaces), plus 4 other mark/spaces (lead-in, header & trailer), which coincidently matches the max setting for RAWBUF of 100. what type of device is this Panasonic (TV ?).

This is the receiver: TSOP38238 | IR Receiver Module - 38kHz Carrier Freq.
38khz, unsure of model?

Distance from receiver... Less than 5cm. I also tried using bigger distances like a meter or 2 away. Still get different numbers on each press.

The IR receiver seems to work fine when using other remotes, I've tested it with a Toshiba TV and a motorolla cable box and it works swell. Pioneer dvd player.. it reads the same hex code consistently but when using IRrecord to send a signal it doesn't seem to work. I've made sure there were no wires or anything blocking the line of sight from remote --> receiver.

I've sent the manufacturer an email already and still waiting on response. Though I only asked them which protocol they're using, I guess if they respond I'll follow up with the stuff you added.

The panasonic is a vierra TV.

Right now I'm attempting to get sendRaw to work with devices that work with IRrecord so I can understand it better.

johnwasser:
It might be time to find someone with a storage oscilloscope so you can check the raw signal for modulation frequency and pulse widths.

Man I was hoping to avoid this but it might be my last resort eh? is there some cheap pc ghetto version I can get?

So some update. I dissected the IRrecord sketch to use raw outputs all the time, and they work well with most of my home theatre devices... excluding my panasonic TV.

What works: Yamaha receiver, both motorolla cable boxes, toshiba tv.
Doesn't work: Panasonic TV ( but works if I use the sendPanasonic command from the JVCPanasonicSendDemo sketch), pioneer dvd player, bose sound dock, and regrettably the only thing I care about working ... the electric curtains.

AnalysisIR - that's quite coincidental that the marks/spaces line up to 100, I thought my buffer changes had no effect. Anyways I am now attempting to use the advice from your blog and use the IRLib library. I will continue to update. Let me know if there's more I should try.

That IR receiver is classed as legacy in the datasheet. It may be that the modulated bursts are too short for it to lock on reliably or could be that its a 56kHz signal???

If you are confident opening up the receiver in the curtain unit, you could tap into the output signal, provided it is 3->5V, with your arduino and use the following sketch to record the times.
CAUTION: use at your own risk and beware of any mains voltage.

download link at bottom of page

Now that I think about it, your could use this sketch to get better timings than IRrremote, from your existing receiver- so why not try that first before messing with the curtain unit and post the output.

Regarding your Panasonic TV....this signal will work if you resend using sendRAW. You could also update the library to handle the actual codes.

AnalysIR:
That IR receiver is classed as legacy in the datasheet. It may be that the modulated bursts are too short for it to lock on reliably or could be that its a 56kHz signal???

If you are confident opening up the receiver in the curtain unit, you could tap into the output signal, provided it is 3->5V, with your arduino and use the following sketch to record the times.
CAUTION: use at your own risk and beware of any mains voltage.
http://www.analysir.com/blog/2014/03/19/air-conditioners-problems-recording-long-infrared-remote-control-signals-arduino/
download link at bottom of page

Now that I think about it, your could use this sketch to get better timings than IRrremote, from your existing receiver- so why not try that first before messing with the curtain unit and post the output.

Regarding your Panasonic TV....this signal will work if you resend using sendRAW. You could also update the library to handle the actual codes.

I tried your sketch but I keep getting gibberish output. I'm supposed to connect the IR receiver to pin 2 right vs pin 11 for IRremote right?

Example output:

Gþß2¦ï2½"ýq²2¦,ï2¦ïÓ¥Ú?íé6¦÷q²íé7Vþ?oû7Vó?oû2¦,ïò0þaþßÇhÈq²ìéM"XÞ?ÿ?q4â2½"ý

EDIT: I changed the serial begin to 9600 and that seemed to have fixed it. panasonic returned this:

Raw: (586) 3496, -1700, 480, -388, 484, -1256, 476, -396, 476, -392, 480, -392, 480, -392, 480, -388, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 484, -384, 484, -1256, 480, -392, 480, -392, 480, -388, 484, -388, 484, -384, 476, -396, 476, -392, 480, -392, 480, -392, 480, -1260, 484, -384, 476, -396, 476, -392, 480, -392, 480, -392, 480, -388, 484, -388, 476, -392, 480, -1260, 484, -388, 480, -1260, 476, -1264, 480, -1260, 484, -1256, 476, -396, 476, -396, 476, -1264, 480, -388, 484, -1260, 472, -1268, 476, -1264, 472, -1268, 476, -392, 480, -1264, 476, -9108, 3492, -1700, 480, -392, 480, -1260, 472, -396, 476, -396, 476, -392, 480, -392, 480, -392, 468, -400, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 472, -1268, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 472, -396, 476, -396, 476, -396, 476, -392, 480, -1260, 484, -388, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 472, -400, 472, -1268, 476, -396, 476, -1264, 480, -1260, 476, -1264, 480, -1260, 484, -388, 472, -396, 476, -1264, 480, -392, 480, -1260, 472, -1268, 476, -1264, 480, -1260, 484, -388, 472, -1268, 476, -9132, 3496, -1700, 468, -400, 472, -1268, 476, -396, 476, -396, 476, -392, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 472, -396, 476, -1268, 476, -392, 480, -392, 480, -388, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 476, -396, 476, -392, 480, -1260, 480, -392, 484, -1256, 476, -1264, 480, -1260, 484, -1260, 472, -396, 476, -396, 476, -1264, 480, -388, 484, -1256, 476, -1268, 476, -1264, 480, -1260, 476, -392, 480, -1264, 480, -15636, 3500, -1696, 444, -424, 480, -1260, 452, -420, 480, -392, 472, -396, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 484, -388, 472, -396, 476, -396, 476, -1264, 480, -388, 484, -388, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 476, -396, 476, -1264, 480, -392, 480, -388, 484, -388, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 472, -396, 476, -1264, 480, -1260, 484, -1256, 480, -1264, 476, -392, 480, -392, 472, -1268, 476, -392, 480, -1260, 484, -1260, 472, -1268, 476, -1264, 480, -392, 472, -1268, 472, -9112, 3496, -1696, 484, -388, 476, -1264, 476, -392, 480, -392, 480, -392, 480, -388, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 484, -388, 472, -396, 476, -1264, 480, -392, 480, -388, 484, -388, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 480, -388, 476, -1264, 480, -392, 480, -392, 480, -388, 480, -392, 472, -396, 476, -396, 476, -396, 476, -392, 480, -1260, 484, -388, 472, -1268, 476, -1264, 480, -1260, 472, -1268, 476, -396, 476, -396, 476, -1260, 476, -396, 476, -1264, 480, -1260, 472, -1268, 476, -1264, 480, -392, 480, -1260, 472, -9136, 3492, -1704, 476, -392, 480, -1260, 484, -388, 476, -396, 476, -392, 480, -392, 484, -384, 484, -388, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 472, -396, 476, -396, 476, -392, 480, -392, 480, -392, 472, -396, 476, -396, 476, -392, 476, -396, 476, -1264, 484, -388, 472, -396, 476, -396, 476, -392, 480, -392, 480, -388, 472, -400, 472, -400, 472, -1268, 476, -392, 480, -1260, 472, -1268, 476, -1264, 480, -1264, 472, -396, 476, -396, 472, -1268, 476, -392,

But for the curtain remote I got differnet outputs for same key press:

Raw: (33) 220, -3176, 196, -32600, 220, -3172, 200, -2064, 200, -4324, 200, -62000, 240, -6560, 208, -5432, 200, -23548, 292, -3120, 204, -2040, 220, -912, 240, -2020, 244, -904, 384, -732, 368, -760, 372, 

Press the button on the remote now - once only

Raw: (21) 224, -3168, 208, -3188, 204, -2056, 208, -2060, 200, -24680, 220, -11088, 224, -60848, 216, -11092, 224, -24660, 216, -11092, 220, 

Press the button on the remote now - once only

Raw: (79) 952, -180, 948, -184, 380, -752, 948, -160, 400, -752, 380, -752, 940, -172, 224, -2040, 200, -932, 200, -24696, 948, -184, 948, -184, 376, -752, 952, -180, 380, -752, 380, -752, 948, -160, 400, -752, 384, -748, 380, -752, 380, -748, 384, -59556, 948, -164, 968, -184, 376, -736, 968, -184, 376, -732, 400, -732, 968, -164, 400, -732, 396, -732, 224, -912, 200, -24676, 968, -164, 968, -164, 396, -736, 220, -912, 208, -2052, 212, -2052, 196, 

Press the button on the remote now - once only

I'm going to try sending the raw panasonic signal and see what happens

Okay update.

Once I put the raw array I got from AnaylsisIR's script into my sendraw script, the output on the serial monitor goes to gibberish. If I press a button on a remote, or press the button hooked upto my arduino, things output but it's complete gibberish.

Here's the script:

#include <IRremote.h>

int RECV_PIN = 11;
int BUTTON_PIN = 12;
int STATUS_PIN = 13;

IRrecv irrecv(RECV_PIN);
IRsend irsend;

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(BUTTON_PIN, INPUT);
  pinMode(STATUS_PIN, OUTPUT);
}

// Storage for the recorded code
int codeType = -1; // The type of code
unsigned long codeValue; // The code value if not raw
unsigned int rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state

void storeCode(decode_results *results) {
  codeType = results->decode_type;
  int count = results->rawlen;
  
  Serial.print(count);
  Serial.println(" is the count.");
 
    Serial.println("Received unknown code, saving as raw");
    codeLen = results->rawlen - 1;
    for (int i = 1; i <= codeLen; i++) {
      if (i % 2) {
        // Mark
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;
        Serial.print(" m");
      } 
      else {
        // Space
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;
        Serial.print(" s");
      }
      Serial.print(rawCodes[i - 1], DEC);
    }
    Serial.println("");
    
    // print array, just wnated to see if negatives get stored
    for (int i = 1; i <= codeLen; i++) {
      Serial.print(rawCodes[i - 1], DEC);
      Serial.print(" " );
    }
}

// the panasonic array
unsigned int rawCodesb[] = {1692, 480, 388, 480, 1260, 476, 396, 476, 392, 480, 392, 480, 392, 480, 388, 484, 388, 472, 396, 476, 396, 476, 392, 480, 392, 480, 392, 480, 1260, 472, 396, 476, 396, 476, 396, 476, 392, 480, 392, 480, 388, 484, 388, 472, 396, 476, 396, 476, 1264, 480, 388, 484, 388, 484, 388, 472, 396, 476, 396, 476, 392, 480, 392, 480, 392, 480, 1260, 472, 396, 476, 1268, 476, 1260, 484, 1260, 476, 1264, 476, 392, 480, 392, 480, 1260, 476, 396, 476, 1264, 476, 1264, 480, 1260, 476, 1264, 480, 392, 476, 1264, 480, 9104, 3468, 1728, 472, 396, 448, 1292, 480, 392, 448, 420, 488, 384, 484, 388, 452, 416, 448, 424, 448, 420, 452, 420, 452, 420, 452, 416, 452, 420, 444, 1296, 476, 392, 452, 420, 452, 416, 456, 416, 476, 396, 476, 392, 480, 392, 480, 388, 484, 388, 484, 1256, 476, 392, 448, 424, 448, 424, 480, 388, 484, 388, 452, 420, 452, 416, 444, 424, 448, 1296, 480, 388, 484, 1256, 476, 1264, 480, 1264, 480, 1260, 472, 396, 448, 424, 476, 1264, 480, 392, 448, 1292, 476, 1264, 476, 1264, 480, 1260, 476, 396, 484, 1256, 476, 9132, 3472, 1724, 476, 392, 480, 1260, 484, 388, 476, 392, 456, 416, 444, 428, 444, 424, 448, 424, 448, 420, 452, 420, 484, 384, 448, 424, 448, 420, 448, 1296, 480, 388, 484, 388, 472, 396, 476, 396, 476, 396, 476, 392, 480, 392, 480, 388, 484, 388, 476, 1264, 480, 392, 476, 392, 480, 392, 480, 388, 476, 396, 476, 392, 480, 392, 480, 388, 484, 1260, 480, 388, 476, 1264, 480, 1260, 484, 1260, 472, 1268, 476, 392, 480, 392, 480, 1260, 484, 388, 452, 1288, 476, 1264, 480, 1260, 484, 1256, 476, 396, 444, 1296, 480};

void sendCode(int repeat) {
  // Assume 38 KHz
  //irsend.sendRaw(rawCodes, codeLen, 38);
  irsend.sendRaw(rawCodesb, 298, 38);
  Serial.println("Sent raw");
  
}

int lastButtonState;

void loop() {
  // If button pressed, send the code.
  int buttonState = digitalRead(BUTTON_PIN);
  if (lastButtonState == HIGH && buttonState == LOW) {
    Serial.println("Released");
    irrecv.enableIRIn(); // Re-enable receiver
  }

  if (buttonState) {
    Serial.println("Pressed, sending");
    digitalWrite(STATUS_PIN, HIGH);
    sendCode(lastButtonState == buttonState);
    digitalWrite(STATUS_PIN, LOW);
    delay(50); // Wait a bit between retransmissions
  } 
  else if (irrecv.decode(&results)) {
    digitalWrite(STATUS_PIN, HIGH);
    storeCode(&results);
    irrecv.resume(); // resume receiver
    digitalWrite(STATUS_PIN, LOW);
  }
  
  lastButtonState = buttonState;
  
}

After couple key presses on remote:

1?1?1?1010101?141?1010Pr%APr%ÿPrPrP?PrP²PrPr

When I press the button the output is too big to put here but it's complete gibberish. I'm guessing the problem is the unsigned int rawCodesb[] = can't handle that big of an array? Not sure...

See attached screen shot for a visual of your erod signals. The second green burst seems to be the closest to a real signal which matches one of the codes exactly, although the timings may be a bit out.

I have imported the raw signal dumps into AnalysIR & exported the useful codes for sendRAW with IRremote below, one for the panasonic and the best version of the erod captured.
If you look at the erod signals in the screenshot, the top centre one matches one of your codes (Close- 110100100000) and the others seem to be degraded version of the same signal.

So try sending both signals (not in the same sketch)

/*
Automatically Generated by AnalysIR - Batch Export Utility
Registered to: xxxxxxxx
Session History
Type : Key : Value : Bits
0 : JAPANESE : Pana1 : 40040100BCBD : 48
2 : RAW : erod1 :  : 0
*/

// NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
// Automatically Generated by AnalysIR for xxxxxxxx, visit http://www.AnalysIR.com or email info@....... for further details
int khz=38; //NB Change this default value as neccessary to the correct modulation frequency


unsigned int Signal_Pana1_0[] = {3496,1700,480,388,484,1256,476,396,476,392,480,392,480,392,480,388,476,396,476,392,480,392,480,388,484,388,484,384,484,1256,480,392,480,392,480,388,484,388,484,384,476,396,476,392,480,392,480,392,480,1260,484,384,476,396,476,392,480,392,480,392,480,388,484,388,476,392,480,1260,484,388,480,1260,476,1264,480,1260,484,1256,476,396,476,396,476,1264,480,388,484,1260,472,1268,476,1264,472,1268,476,392,480,1264,476}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_Pana1_0, sizeof(Signal_Pana1_0)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: JAPANESE, Key:  Pana1




unsigned int Signal_erod1_2[] = {,948,184,948,184,376,752,952,180,380,752,380,752,948,160,400,752,384,748,380,752,380,748,384}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_erod1_2, sizeof(Signal_erod1_2)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  erod1

Tip: if the erod one doesn't work try changing the khz value to 56, 40, and 36 instead of 38 (My bet is on 56kHz)

If all else fails I can look into re-constructing the timings for the erod, for more accuracy

I may have messed up the pansonic output due to interference. Here is some more consistent output:

Press the button on the remote now - once only

Raw: (299) 3496, -1696, 472, -404, 468, -1268, 476, -396, 476, -392, 480, -392, 468, -400, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 476, -1264, 480, -392, 476, -392, 480, -392, 480, -392, 472, -400, 472, -396, 476, -392, 476, -396, 476, -396, 476, -1264, 472, -396, 476, -396, 476, -392, 480, -392, 476, -392, 480, -392, 480, -392, 472, -396, 476, -1264, 480, -392, 480, -1260, 484, -1256, 476, -1264, 480, -1264, 480, -388, 472, -400, 472, -1268, 476, -392, 480, -1260, 484, -1256, 476, -1268, 476, -1264, 480, -388, 484, -1256, 476, -9112, 3492, -1700, 480, -392, 476, -1264, 480, -392, 472, -396, 476, -396, 476, -392, 480, -392, 480, -388, 472, -400, 472, -400, 472, -396, 476, -396, 476, -396, 476, -1260, 484, -388, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 472, -400, 472, -1268, 476, -392, 480, -392, 480, -392, 480, -388, 472, -400, 472, -396, 476, -396, 476, -392, 480, -1260, 484, -388, 472, -1268, 476, -1264, 480, -1260, 484, -1256, 476, -396, 476, -396, 476, -1264, 480, -388, 472, -1268, 476, -1268, 476, -1264, 480, -1260, 472, -396, 476, -1264, 480, -9132, 3488, -1704, 476, -396, 476, -1264, 480, -392, 468, -400, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 468, -400, 472, -400, 472, -396, 476, -1264, 480, -392, 480, -392, 480, -388, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 472, -1268, 476, -396, 472, -396, 476, -396, 476, -392, 480, -392, 472, -396, 476, -396, 476, -396, 476, -1260, 484, -388, 484, -1256, 476, -1264, 480, -1260, 480, -1264, 472, -396, 476, -396, 476, -1264, 480, -392, 476, -1260, 476, -1268, 476, -1264, 480, -1260, 484, -388, 472, -1268, 476, 

Press the button on the remote now - once only

Raw: (299) 3492, -1704, 476, -396, 476, -1264, 480, -392, 468, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 476, -396, 476, -392, 480, -392, 476, -1264, 480, -392, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 480, -392, 472, -396, 476, -1264, 480, -392, 480, -392, 480, -388, 484, -388, 472, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 484, -388, 472, -1268, 476, -1264, 480, -1260, 484, -1256, 476, -396, 476, -396, 476, -1260, 484, -388, 472, -1268, 476, -1264, 480, -1260, 484, -1260, 472, -396, 476, -1264, 480, -9104, 3492, -1704, 476, -396, 476, -1264, 480, -388, 476, -396, 476, -392, 476, -396, 476, -396, 476, -392, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 480, -392, 472, -396, 476, -396, 476, -392, 480, -392, 480, -392, 480, -388, 484, -388, 472, -396, 476, -1264, 480, -392, 480, -388, 484, -388, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 472, -400, 472, -1268, 476, -1264, 480, -1260, 472, -1268, 476, -396, 476, -392, 480, -1260, 484, -388, 472, -1268, 476, -1264, 480, -1260, 484, -1256, 476, -396, 476, -1264, 480, -9128, 3492, -1704, 476, -396, 476, -1264, 480, -388, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 468, -400, 472, -400, 472, -396, 476, -396, 476, -1264, 480, -392, 472, -396, 472, -400, 472, -396, 476, -396, 476, -392, 480, -392, 480, -392, 472, -396, 472, -1268, 476, -396, 476, -392, 480, -392, 480, -392, 472, -396, 476, -396, 476, -392, 476, -396, 476, -1264, 480, -392, 472, -1268, 476, -1264, 480, -1260, 484, -1256, 476, -396, 476, -392, 480, -1260, 484, -388, 472, -1268, 476, -1264, 480, -1260, 484, -1256, 476, -396, 476, -1264, 480, 

Press the button on the remote now - once only

Raw: (299) 3496, -1700, 468, -400, 472, -1268, 476, -396, 476, -392, 480, -392, 468, -404, 468, -400, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 472, -400, 472, -1268, 476, -392, 476, -396, 476, -392, 480, -392, 472, -400, 472, -396, 476, -396, 472, -396, 476, -396, 476, -1264, 480, -392, 472, -396, 476, -396, 476, -392, 480, -392, 476, -392, 480, -392, 480, -392, 472, -1268, 476, -392, 476, -1264, 480, -1260, 476, -1268, 476, -1264, 476, -392, 480, -392, 480, -1260, 476, -396, 476, -1264, 480, -1260, 480, -1260, 472, -1268, 476, -396, 476, -1264, 480, -9104, 3496, -1700, 476, -396, 468, -1268, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -388, 484, -388, 472, -396, 476, -396, 476, -1264, 480, -392, 480, -388, 472, -400, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 480, -1260, 472, -396, 476, -1264, 480, -1264, 480, -1260, 472, -1268, 476, -392, 480, -392, 480, -1260, 472, -400, 472, -1268, 476, -1264, 480, -1260, 472, -1268, 476, -396, 476, -1264, 480, -9128, 3492, -1704, 472, -396, 476, -1264, 480, -392, 480, -392, 472, -396, 476, -396, 472, -396, 476, -396, 476, -396, 476, -392, 480, -392, 472, -396, 476, -396, 476, -1264, 476, -396, 476, -392, 480, -392, 472, -396, 476, -396, 476, -392, 480, -392, 480, -392, 476, -392, 480, -1260, 476, -396, 476, -396, 476, -392, 480, -392, 476, -392, 480, -392, 472, -396, 476, -396, 476, -1264, 480, -392, 480, -1260, 472, -1268, 476, -1264, 480, -1260, 480, -392, 472, -396, 476, -1264, 480, -392, 480, -1260, 480, -1260, 476, -1264, 480, -1260, 484, -388, 480, -1260, 476, 

Press the button on the remote now - once only

I am testing your code out right now anyways though. will update

Okay we're getting somewhere!!

Signal_Pana1_0 turned on my panasonic TV! I used 38 khz.

Unfortunately I couldn't get my electric blinds to move. I used both Signal_Pana1_0 and Signal_erod1_2, as well as each of the suggested frequencies : 36, 38, 40, 56.

I feel we're so close man! I really appreciate you taking the time to help me out AnalysisIR. Let me know what you need from me to make more accurate measurements.

Anyways here's the code I used in case of silly mistakes:

#include <IRremote.h>

int RECV_PIN = 11;
int BUTTON_PIN = 12;
int STATUS_PIN = 13;

IRrecv irrecv(RECV_PIN);
IRsend irsend;

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(BUTTON_PIN, INPUT);
  pinMode(STATUS_PIN, OUTPUT);
}

// Storage for the recorded code
int codeType = -1; // The type of code
unsigned long codeValue; // The code value if not raw
unsigned int rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state

void storeCode(decode_results *results) {
  codeType = results->decode_type;
  int count = results->rawlen;
  
  Serial.print(count);
  Serial.println(" is the count.");
 
    Serial.println("Received unknown code, saving as raw");
    codeLen = results->rawlen - 1;
    for (int i = 1; i <= codeLen; i++) {
      if (i % 2) {
        // Mark
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;
        Serial.print(" m");
      } 
      else {
        // Space
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;
        Serial.print(" s");
      }
      Serial.print(rawCodes[i - 1], DEC);
    }
    Serial.println("");
    
    // print array, just wnated to see if negatives get stored
    for (int i = 1; i <= codeLen; i++) {
      Serial.print(rawCodes[i - 1], DEC);
      Serial.print(" " );
    }
}

// the panasonic array
//unsigned int rawCodesb[] = {1692, 480, 388, 480, 1260, 476, 396, 476, 392, 480, 392, 480, 392, 480, 388, 484, 388, 472, 396, 476, 396, 476, 392, 480, 392, 480, 392, 480, 1260, 472, 396, 476, 396, 476, 396, 476, 392, 480, 392, 480, 388, 484, 388, 472, 396, 476, 396, 476, 1264, 480, 388, 484, 388, 484, 388, 472, 396, 476, 396, 476, 392, 480, 392, 480, 392, 480, 1260, 472, 396, 476, 1268, 476, 1260, 484, 1260, 476, 1264, 476, 392, 480, 392, 480, 1260, 476, 396, 476, 1264, 476, 1264, 480, 1260, 476, 1264, 480, 392, 476, 1264, 480, 9104, 3468, 1728, 472, 396, 448, 1292, 480, 392, 448, 420, 488, 384, 484, 388, 452, 416, 448, 424, 448, 420, 452, 420, 452, 420, 452, 416, 452, 420, 444, 1296, 476, 392, 452, 420, 452, 416, 456, 416, 476, 396, 476, 392, 480, 392, 480, 388, 484, 388, 484, 1256, 476, 392, 448, 424, 448, 424, 480, 388, 484, 388, 452, 420, 452, 416, 444, 424, 448, 1296, 480, 388, 484, 1256, 476, 1264, 480, 1264, 480, 1260, 472, 396, 448, 424, 476, 1264, 480, 392, 448, 1292, 476, 1264, 476, 1264, 480, 1260, 476, 396, 484, 1256, 476, 9132, 3472, 1724, 476, 392, 480, 1260, 484, 388, 476, 392, 456, 416, 444, 428, 444, 424, 448, 424, 448, 420, 452, 420, 484, 384, 448, 424, 448, 420, 448, 1296, 480, 388, 484, 388, 472, 396, 476, 396, 476, 396, 476, 392, 480, 392, 480, 388, 484, 388, 476, 1264, 480, 392, 476, 392, 480, 392, 480, 388, 476, 396, 476, 392, 480, 392, 480, 388, 484, 1260, 480, 388, 476, 1264, 480, 1260, 484, 1260, 472, 1268, 476, 392, 480, 392, 480, 1260, 484, 388, 452, 1288, 476, 1264, 480, 1260, 484, 1256, 476, 396, 444, 1296, 480};
//unsigned int Signal_erod1_2[] = {948,184,948,184,376,752,952,180,380,752,380,752,948,160,400,752,384,748,380,752,380,748,384}; //AnalysIR Batch Export - RAW
unsigned int Signal_Pana1_0[] = {3496,1700,480,388,484,1256,476,396,476,392,480,392,480,392,480,388,476,396,476,392,480,392,480,388,484,388,484,384,484,1256,480,392,480,392,480,388,484,388,484,384,476,396,476,392,480,392,480,392,480,1260,484,384,476,396,476,392,480,392,480,392,480,388,484,388,476,392,480,1260,484,388,480,1260,476,1264,480,1260,484,1256,476,396,476,396,476,1264,480,388,484,1260,472,1268,476,1264,472,1268,476,392,480,1264,476}; //AnalysIR Batch Export - RAW

void sendCode(int repeat) {
  // Assume 38 KHz
  //irsend.sendRaw(rawCodes, codeLen, 38);
  //irsend.sendRaw(Signal_erod1_2, sizeof(Signal_erod1_2)/sizeof(int), 38);
  irsend.sendRaw(Signal_Pana1_0, sizeof(Signal_Pana1_0)/sizeof(int), 38);
  Serial.println("Sent raw");
  
}

int lastButtonState;

void loop() {
  // If button pressed, send the code.
  int buttonState = digitalRead(BUTTON_PIN);
  if (lastButtonState == HIGH && buttonState == LOW) {
    Serial.println("Released");
    irrecv.enableIRIn(); // Re-enable receiver
  }

  if (buttonState) {
    Serial.println("Pressed, sending");
    digitalWrite(STATUS_PIN, HIGH);
    sendCode(lastButtonState == buttonState);
    digitalWrite(STATUS_PIN, LOW);
    delay(50); // Wait a bit between retransmissions
  } 
  else if (irrecv.decode(&results)) {
    digitalWrite(STATUS_PIN, HIGH);
    storeCode(&results);
    irrecv.resume(); // resume receiver
    digitalWrite(STATUS_PIN, LOW);
  }
  
  lastButtonState = buttonState;
  
}

OK, I did some extra analysis on the signal and came up with the following 'extrapolated' timings.

Replace the timings in the erod signal as follows:
(replace the first value with the second, such that the only timings are 850 and 290 in the signal)

948 -->	850
184	290
948	850
184	290
376	290
752	850
952	850
180	290
380	290
752	850
380	290
752	850
948	850
160	290
400	290
752	850
384	290
748	850
380	290
752	850
380	290
748	850
384 -->	290

Again try all of the frequencies.
If that doesn't work, then I suggest you get a 56kHz IRreceiver, which is my best guess,for you, at this stage.

PS: it looks like I left a comma at the start of the erod signal last time (but you seem to have removed it which was correct)

I will test out your script once I get home and update.

I just wanted to share some good news. The manufacturer just got back to me!!

Thank you for contacting us. Below are additional codes you can try. I am not certain if these codes are compatible with your device, but they have worked for other customers. Please let us know if you have any other questions.

OPEN:

0000 006D 0000 0030 002C 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0010 052F 0030 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0010 0D2E 0030 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0010 052F 0030 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0010 0ED8

CLOSE:

0000 006D 0000 0030 002F 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 052F 0030 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0022 001E 0004 003F 0010 0030 0010 0030 0010 0030 0010 0D2E 0030 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0025 001B 0004 003F 0010 0030 0010 0030 0010 0030 0010 052F 0030 0010 0030 0010 0010 0030 0030 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0ED8

STOP:

0000 006A 0000 0030 002E 0010 0030 0010 0010 0031 0030 0010 0010 0031 0010 0031 0010 0031 0010 0031 0030 0010 0010 0031 0010 0031 0010 0549 0030 0010 0030 0010 0010 0031 0030 0010 0010 0031 0010 0031 0010 0031 0010 0031 0030 0010 0010 0031 0010 0031 0010 0D6F 0030 0010 0030 0010 0010 0031 0030 0010 0010 0031 0010 0031 0010 0031 0010 0031 0030 0010 0010 0031 0010 0031 0010 0549 0030 0010 0030 0010 0010 0031 0010 0031 0010 0031 0010 0031 0010 0031 0010 0031 0010 0031 0010 0031 0010 0031 0010 0F22

Does this help? I'm not even sure how to convert this to an array that I can use with sendRaw... What follow up question should I ask?

Great - these are in PRONTO format.

IRremote code below (Automatically imported into AnalysIR & exported as below)

/*
Automatically Generated by AnalysIR - Batch Export Utility
Registered to: xxxxxxxx
Session History
Type : Key : Value : Bits
0 : RAW : Open :  : 0
1 : RAW : Stop :  : 0
2 : RAW : Close :  : 0
*/

// NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
// Automatically Generated by AnalysIR for xxxxxxxx, visit http://www.AnalysIR.com or email info@....... for further details
int khz=38; //NB Change this default value as neccessary to the correct modulation frequency


unsigned int Signal_Open_0[] = {1144,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_Open_0, sizeof(Signal_Open_0)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  Open


unsigned int Signal_Stop_1[] = {1222,416,1248,416,416,1248,1248,416,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,884,780,104,1638,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,962,702,104,1638,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,416,1248,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_Stop_1, sizeof(Signal_Stop_1)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  Stop


unsigned int Signal_Close_2[] = {1196,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,16383}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_Close_2, sizeof(Signal_Close_2)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  Close

Note if they dont work as is, just truncate each signal just before the first 16383.
The modulation frequency comes up as 38 kHz (but again try them all if things dont work).

It looks like your IR receiver didnt like that signal for some reason? strange. (you could check/verify the model number which should be on the top surface, but very small)

PS KUDOS to the erod for being so responsive and open. Great customer support!

IT WORKS!!! Thank you so much AnalysisIR!!

How did you convert the signal from Pronto to array? Like do you just copy it into your software as-is?

Great!
...glad to be of help.

Now you can open/close the curtains when you are not at home.... :slight_smile:

How did you convert the signal from Pronto to array? Like do you just copy it into your software as-is?

Yes, AnalysIR can import/export from/to a range of industry formats and also generates C code for IRremote & IRLib.

Wasn't sure if I should create separate thread with this issue I'm having with IR again.

So my project is 95% done, only thing is that the transmission for only ONE of the three commands is unreliable.

Open curtain and stop curtain work perfectly, and I have like 12ft + range, and don't even need to point the LED right at the curtain. Never any issues with signal not going through except when I'm outright standing inbetween the IR LED and the receiver.

Close curtain sometimes works at like 3-4 feet. Even with a clear line of sight at 3-4 feet it only sometimes works.

I'm guessing the close curtain's raw array may have more noise the rest?

What I've tried:

  • using lower resistance band. 33 ohm, with 5v voltage so driving LED's max 100mA
  • amplify via transistor ( well I was already doing this )
  • Fire code only once or multiple times (like 50)

Here's the code

PROGMEM unsigned int Signal_Open[] = {1144,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW
PROGMEM unsigned int Signal_Stop[] = {1196,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,1248,416,416,1274,416,1274,416,1274,416,1274,1248,416,416,1274,416,1274,416,16383,1248,416,1248,416,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,1274,416,16383}; //AnalysIR Batch Export - RAW
PROGMEM unsigned int Signal_Close[] = {1222,416,1248,416,416,1248,1248,416,416,1248,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,884,780,104,1638,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,962,702,104,1638,416,1248,416,1248,416,1248,416,16383,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,416,1248,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW

void sendRawCode(byte code_type){
  // get the relevant code from PROGMEM
  int rawLen = sizeof(Signal_Open) / sizeof(unsigned int);;
  unsigned int rawCode[rawLen];
  
  switch(code_type){
    case 0:  for(int i=0; i<rawLen;i++){ rawCode[i]=(pgm_read_word(&Signal_Stop[i]));  } break; // stop
    case 1:  for(int i=0; i<rawLen;i++){ rawCode[i]=(pgm_read_word(&Signal_Open[i]));  } break; // open
    case 2:  for(int i=0; i<rawLen;i++){ rawCode[i]=(pgm_read_word(&Signal_Close[i]));  } break; // close
  }
  
  Serial.print(F("Sending raw codetype: "));
  Serial.println(code_type);
  
  irsend.sendRaw(rawCode,rawLen,38); // send the IR code
  
}
 // blast code 3 times
  for(int i=0; i<3;i++){
    sendRawCode(code_type);
  }