Go Down

Topic: Trouble sending IR command to rc curtains (Read 10976 times) previous topic - next topic

juntao65

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!!

Code: [Select]
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?

AnalysIR

Great - these are in PRONTO format.

IRremote code below (Automatically imported into AnalysIR & exported as below)
Code: [Select]
/*
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!

juntao65

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?

AnalysIR

Great!
...glad to be of help.

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

Quote
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.

juntao65

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
Code: [Select]
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);
  }

AnalysIR

Couple of points:

First, As you probably guessed, requests for private support via PM, are ususally ignored. (Reason: other people don't get to see the solution)

Second: You are right, the 'close' signal is corrupted after the first pattern. So copy the first bit of the signal upto and including 16383 and create a new one with this first part 3 times and you should be good to go. (Alternatively, just make the signal with the first part and send it 3 times if needed. It may only need to be sent once)

Third: Yes, your current should be circa 90+ mA. This should be fine and your issue is probably the distorted signal. However, you could drive it harder becacuse the 90mA is only on for one sixth of the time (50% for spaces & 33% duty cycle => 1/2 * 1/3 =1/6).
So by adding on a second 38 ohm resistor in paralled you should still have a good safety margin and more range, if needed.

If you want an even  better circuit check this blog out:
http://www.analysir.com/blog/2013/11/22/constant-current-infrared-led-circuit/

juntao65

My bad on the PM, this IR issue has been driving me crazy so there was a lapse in judgement.

The rest of this post will demonstrate how crazy.

Let's start with your suggestions I've tried. First part 3 times in one signal, and the alternative of sending the first part alone 3 times had no action at all from the curtains.

Now up until this point I've been in the dark as to what was going on and what you meant by the first part of the code being corrupt.

The post is big because I wanted to be detailed. 2l;dr is ... nothings really changed.

So I did a little reading, well more specifically this post :
http://www.hifi-remote.com/infrared/IR-PWM.shtml

I ended up writing a PHP script which takes in the PRONTO codes from the manufacturer and spits out some useful information.

Here's what I got:

Open code as input:
Code: [Select]
Carrier frequency 38028.866495633
Multiplier: 26.295814
Length of One Time Burst: 0
Length of repeat burst: 48
Lead in burst: 1157, 421
Burst pair 1: 1262, 421 | Bit 1: 1
Burst pair 2: 421, 1262 | Bit 2: 0
Burst pair 3: 1262, 421 | Bit 3: 1
Burst pair 4: 421, 1262 | Bit 4: 0
Burst pair 5: 421, 1262 | Bit 5: 0
Burst pair 6: 421, 1262 | Bit 6: 0
Burst pair 7: 1262, 421 | Bit 7: 1
Burst pair 8: 421, 1262 | Bit 8: 0
Burst pair 9: 421, 1262 | Bit 9: 0
Burst pair 10: 421, 1262 | Bit 10: 0
Burst pair 11: 421, 34895 | Bit 11: 0
Deliminator timeoff: 34895

Burst pair 12: 1262, 421 | Bit 12: 1
Burst pair 13: 1262, 421 | Bit 13: 1
Burst pair 14: 421, 1262 | Bit 14: 0
Burst pair 15: 1262, 421 | Bit 15: 1
Burst pair 16: 421, 1262 | Bit 16: 0
Burst pair 17: 421, 1262 | Bit 17: 0
Burst pair 18: 421, 1262 | Bit 18: 0
Burst pair 19: 1262, 421 | Bit 19: 1
Burst pair 20: 421, 1262 | Bit 20: 0
Burst pair 21: 421, 1262 | Bit 21: 0
Burst pair 22: 421, 1262 | Bit 22: 0
Burst pair 23: 421, 88722 | Bit 23: 0
Deliminator timeoff: 88722

Burst pair 24: 1262, 421 | Bit 24: 1
Burst pair 25: 1262, 421 | Bit 25: 1
Burst pair 26: 421, 1262 | Bit 26: 0
Burst pair 27: 1262, 421 | Bit 27: 1
Burst pair 28: 421, 1262 | Bit 28: 0
Burst pair 29: 421, 1262 | Bit 29: 0
Burst pair 30: 421, 1262 | Bit 30: 0
Burst pair 31: 1262, 421 | Bit 31: 1
Burst pair 32: 421, 1262 | Bit 32: 0
Burst pair 33: 421, 1262 | Bit 33: 0
Burst pair 34: 421, 1262 | Bit 34: 0
Burst pair 35: 421, 34895 | Bit 35: 0
Deliminator timeoff: 34895

Burst pair 36: 1262, 421 | Bit 36: 1
Burst pair 37: 1262, 421 | Bit 37: 1
Burst pair 38: 421, 1262 | Bit 38: 0
Burst pair 39: 1262, 421 | Bit 39: 1
Burst pair 40: 421, 1262 | Bit 40: 0
Burst pair 41: 421, 1262 | Bit 41: 0
Burst pair 42: 421, 1262 | Bit 42: 0
Burst pair 43: 1262, 421 | Bit 43: 1
Burst pair 44: 421, 1262 | Bit 44: 0
Burst pair 45: 421, 1262 | Bit 45: 0
Burst pair 46: 421, 1262 | Bit 46: 0
Burst pair 47: 421, 99924 | Bit 47: 0
Deliminator timeoff: 99924


Close code:

Code: [Select]
Carrier frequency 38028.866495633
Multiplier: 26.295814
Length of One Time Burst: 0
Length of repeat burst: 48
Lead in burst: 1236, 421
Burst pair 1: 1262, 421 | Bit 1: 1
Burst pair 2: 421, 1262 | Bit 2: 0
Burst pair 3: 1262, 421 | Bit 3: 1
Burst pair 4: 421, 1262 | Bit 4: 0
Burst pair 5: 421, 1262 | Bit 5: 0
Burst pair 6: 1262, 421 | Bit 6: 1
Burst pair 7: 421, 1262 | Bit 7: 0
Burst pair 8: 421, 1262 | Bit 8: 0
Burst pair 9: 421, 1262 | Bit 9: 0
Burst pair 10: 421, 1262 | Bit 10: 0
Burst pair 11: 421, 34895 | Bit 11: 0
Deliminator timeoff: 34895

Burst pair 12: 1262, 421 | Bit 12: 1
Burst pair 13: 1262, 421 | Bit 13: 1
Burst pair 14: 421, 1262 | Bit 14: 0
Burst pair 15: 1262, 421 | Bit 15: 1
Burst pair 16: 421, 1262 | Bit 16: 0
Burst pair 17: 421, 1262 | Bit 17: 0
Burst pair 18: 894, 789 | Bit 18: 1
Burst pair 19: 105, 1657 | Bit 19: 0
Burst pair 20: 421, 1262 | Bit 20: 0
Burst pair 21: 421, 1262 | Bit 21: 0
Burst pair 22: 421, 1262 | Bit 22: 0
Burst pair 23: 421, 88722 | Bit 23: 0
Deliminator timeoff: 88722

Burst pair 24: 1262, 421 | Bit 24: 1
Burst pair 25: 1262, 421 | Bit 25: 1
Burst pair 26: 421, 1262 | Bit 26: 0
Burst pair 27: 1262, 421 | Bit 27: 1
Burst pair 28: 421, 1262 | Bit 28: 0
Burst pair 29: 421, 1262 | Bit 29: 0
Burst pair 30: 973, 710 | Bit 30: 1
Burst pair 31: 105, 1657 | Bit 31: 0
Burst pair 32: 421, 1262 | Bit 32: 0
Burst pair 33: 421, 1262 | Bit 33: 0
Burst pair 34: 421, 1262 | Bit 34: 0
Burst pair 35: 421, 34895 | Bit 35: 0
Deliminator timeoff: 34895

Burst pair 36: 1262, 421 | Bit 36: 1
Burst pair 37: 1262, 421 | Bit 37: 1
Burst pair 38: 421, 1262 | Bit 38: 0
Burst pair 39: 1262, 421 | Bit 39: 1
Burst pair 40: 421, 1262 | Bit 40: 0
Burst pair 41: 421, 1262 | Bit 41: 0
Burst pair 42: 421, 1262 | Bit 42: 0
Burst pair 43: 421, 1262 | Bit 43: 0
Burst pair 44: 421, 1262 | Bit 44: 0
Burst pair 45: 421, 1262 | Bit 45: 0
Burst pair 46: 421, 1262 | Bit 46: 0
Burst pair 47: 421, 99924 | Bit 47: 0
Deliminator timeoff: 99924


Stop:

Code: [Select]
Carrier frequency 39105.155170038
Multiplier: 25.572076
Length of One Time Burst: 0
Length of repeat burst: 48
Lead in burst: 1176, 409
Burst pair 1: 1227, 409 | Bit 1: 1
Burst pair 2: 409, 1253 | Bit 2: 0
Burst pair 3: 1227, 409 | Bit 3: 1
Burst pair 4: 409, 1253 | Bit 4: 0
Burst pair 5: 409, 1253 | Bit 5: 0
Burst pair 6: 409, 1253 | Bit 6: 0
Burst pair 7: 409, 1253 | Bit 7: 0
Burst pair 8: 1227, 409 | Bit 8: 1
Burst pair 9: 409, 1253 | Bit 9: 0
Burst pair 10: 409, 1253 | Bit 10: 0
Burst pair 11: 409, 34599 | Bit 11: 0
Deliminator timeoff: 34599

Burst pair 12: 1227, 409 | Bit 12: 1
Burst pair 13: 1227, 409 | Bit 13: 1
Burst pair 14: 409, 1253 | Bit 14: 0
Burst pair 15: 1227, 409 | Bit 15: 1
Burst pair 16: 409, 1253 | Bit 16: 0
Burst pair 17: 409, 1253 | Bit 17: 0
Burst pair 18: 409, 1253 | Bit 18: 0
Burst pair 19: 409, 1253 | Bit 19: 0
Burst pair 20: 1227, 409 | Bit 20: 1
Burst pair 21: 409, 1253 | Bit 21: 0
Burst pair 22: 409, 1253 | Bit 22: 0
Burst pair 23: 409, 87942 | Bit 23: 0
Deliminator timeoff: 87942

Burst pair 24: 1227, 409 | Bit 24: 1
Burst pair 25: 1227, 409 | Bit 25: 1
Burst pair 26: 409, 1253 | Bit 26: 0
Burst pair 27: 1227, 409 | Bit 27: 1
Burst pair 28: 409, 1253 | Bit 28: 0
Burst pair 29: 409, 1253 | Bit 29: 0
Burst pair 30: 409, 1253 | Bit 30: 0
Burst pair 31: 409, 1253 | Bit 31: 0
Burst pair 32: 1227, 409 | Bit 32: 1
Burst pair 33: 409, 1253 | Bit 33: 0
Burst pair 34: 409, 1253 | Bit 34: 0
Burst pair 35: 409, 34599 | Bit 35: 0
Deliminator timeoff: 34599

Burst pair 36: 1227, 409 | Bit 36: 1
Burst pair 37: 1227, 409 | Bit 37: 1
Burst pair 38: 409, 1253 | Bit 38: 0
Burst pair 39: 409, 1253 | Bit 39: 0
Burst pair 40: 409, 1253 | Bit 40: 0
Burst pair 41: 409, 1253 | Bit 41: 0
Burst pair 42: 409, 1253 | Bit 42: 0
Burst pair 43: 409, 1253 | Bit 43: 0
Burst pair 44: 409, 1253 | Bit 44: 0
Burst pair 45: 409, 1253 | Bit 45: 0
Burst pair 46: 409, 1253 | Bit 46: 0
Burst pair 47: 409, 99066 | Bit 47: 0
Deliminator timeoff: 99066


I took all the raw codes derived from this script and tested them. They work just like the codes AnalyzeIR gave me on the first sketch. Open/stop without flaw, close sometimes works only at close range.

What's interesting is how STOP has more differences from the other 2 codes, yet it's CLOSE giving me problems. The deliminator and the frequency is different. I still fired it at 38khz without problem...

Part 2 contd...

juntao65

In order to find patterns, I listed the important information derived like so below:

first line - binary/hex straight from manufacturer's site
second line - full binary sequence
lines 3,4,5,6 - analyzing each part of the code from line 2

Open:
Code: [Select]
Open codes from manufacturer:: 110100010000  |  D10
Binary: 10100010000 110100010000 110100010000 110100010000
Binary: 10100010000 Hex: 510 Dec: 1296 | Deliminator: 34895
Binary: 110100010000 Hex: D10 Dec: 3344 | Deliminator: 88722
Binary: 110100010000 Hex: D10 Dec: 3344 | Deliminator: 34895
Binary: 110100010000 Hex: D10 Dec: 3344 | Deliminator: 99924


Close:
Code: [Select]
Close codes from manufacturer:: 110100100000   | D20
Binary: 10100100000 110100100000 110100100000 110100000000
Binary: 10100100000 Hex: 520 Dec: 1312 | Deliminator: 34895
Binary: 110100100000 Hex: D20 Dec: 3360 | Deliminator: 88722
Binary: 110100100000 Hex: D20 Dec: 3360 | Deliminator: 34895
Binary: 110100000000 Hex: D00 Dec: 3328 | Deliminator: 99924


Stop:
Code: [Select]
Stop codes from manufacturer: 110100001000  | D08
Binary: 10100001000 110100001000 110100001000 110000000000
Binary: 10100001000 Hex: 508 Dec: 1288 | Deliminator: 34599
Binary: 110100001000 Hex: D08 Dec: 3336 | Deliminator: 87942
Binary: 110100001000 Hex: D08 Dec: 3336 | Deliminator: 34599
Binary: 110000000000 Hex: C00 Dec: 3072 | Deliminator: 99066


Some things I noticed from the above:
- OPEN/CLOSE have the same deliminators
- the first part of each binary sequence is just the manufacturer listed code minus the first digit. So for example if you remove the first digit from manufacturer's code for STOP 110100001000, it becomes 10100001000... which is the first part of the burst. This is consistent on all 3 signals so I'm assuming the binary derived from the PRONTO for the first part is okay.
- for the last part, or part4 of each codes' binary sequence... I couldn't find a consistent pattern.

Since part4 for OPEN was just the manufacturer's listed code, I decided to try that for CLOSE, while preserving the deliminator. It didn't change anything. Signal goes through sometimes at really close range but nada at slightly further distances.

Here's the raw array:
Code: [Select]
PROGMEM unsigned int Signal_Close[] = {1236,421,1262,421,421,1262,1262,421,421,1262,421,1262,1262,421,421,1262,421,1262,421,1262,421,1262,421,34895,1262,421,1262,421,421,1262,1262,421,421,1262,421,1262,894,789,105,1657,421,1262,421,1262,421,1262,421,88722,1262,421,1262,421,421,1262,1262,421,421,1262,421,1262,973,710,105,1657,421,1262,421,1262,421,1262,421,34895,1262,421,1262,421,421,1262,1262,421,421,1262,421,1262,973,710,105,1657,421,1262,421,1262,421,1262,421,99924};



I am stumped. This project is useless without CLOSE working reliably ='(

Anyways I'm going to try to amplify the signal some more per AnalysisIR's suggestion.

Edit: php code is below if anyone cares
Code: [Select]
<?php
$raw 
"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";

$splithex explode(" ",$raw);


// first convert all entires to decimal
foreach($splithex as $each){
$split_dec[] = hexdec($each);

}

// remove first 0000
unset($split_dec[0]);
unset(
$each);


// Get carrier frequency from 2nd item
$freq 1000000/($split_dec[1]*0.241246);

// calc multiplier microsec
$microsecs 1/$freq*1000*1000;

$out "Carrier frequency ".$freq."<br>";
$out .= "Multiplier: ".$microsecs."<br>";

// get num of burst pairs with 3rd number
$out .= "Length of One Time Burst: ".$split_dec[2]."<br>";

// 4th - length of repeat burst
$length_repeat $split_dec[3];
$out .= "Length of repeat burst: ".$length_repeat."<br>";

// 5,6 - lead in burst
$timeon round($microsecs*$split_dec[4]);
$timeoff round($microsecs*$split_dec[5]);
$out .= "Lead in burst: ".$timeon.", ".$timeoff."<br>";
$rawarray "{".$timeon.",$timeoff";

unset(
$split_dec[1]);
unset(
$split_dec[2]);
unset(
$split_dec[3]);
unset(
$split_dec[4]);
unset(
$split_dec[5]);
unset(
$timeon);
unset(
$timeoff);

// 7,8 onwards
$i=1;
$k=6;

while(
$i $length_repeat){
$timeon round($microsecs*$split_dec[$k],0);
$timeoff round($microsecs*$split_dec[$k+1],0);

// the binary bit
$bit = ($timeon>$timeoff) ? 10;

$out .= "Burst pair $i: ".$timeon.", ".$timeoff." | ";
$out .= "Bit $i$bit <br>";

// Figure out if deliminator
if($timeoff>10000){
$binary .= $bit." ";

$binarytotal .= $binary." ";
$binaries[] = trim($binary); // add to array to seperate
$deliminators[] = $timeoff;
$binary "";

$out.= "Deliminator timeoff: $timeoff<br><br>";


}else{
$binary .= $bit;
}


// add to output array
$rawarray .= ",$timeon,$timeoff";

$k $k+2;
$i++;
}

$rawarray .= "};";

$out .= "Binary: $binarytotal <br>";

// convert binaries to hex
unset($each);
$i=0;
foreach(
$binaries as $each){
$delim $deliminators[$i];
$out .= "Binary: $each " "Hex: ".bin2hex($each)." Dec: "bindec($each) . " | Deliminator: $delim<br>";
$i++;
}


$out .="<br><textarea>$rawarray</textarea>";



echo 
$out;

//var_dump($binaries);
?>


AnalysIR

Looks like you are becomming a bit of an expert !   :)
Well done on the offline work & research.

The signals you posted originally in PRONTO format, have the same signal repeated three time(=  4 x signal)

The Close signal is corrupted. However, the first part is looks OK. That is why I suggested sending the first part repeated 3 times (or even just once).


So can you post the 'CLose' signal you created (as per my suggestion, if the signal below does not work)


PS: The problem is unlikely to be related to the power of the signal.


heck....try this
Code: [Select]
unsigned int Signal_Close_2[] =
{1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,16383
,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,16383
,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,16383
,1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,16383}; //AnalysIR Batch Export - RAW


it looks like your stop signal has some corruption as well, which could be cleaned up like above

juntao65

I forking did it !!

The signal you suggested didn't work. So I tried sending the raw D20 code 4 times.. didn't work.

I'll spare you all the things I tried that didn't work.

What worked:

Overriding the frequency in my php script to 40khz and using that raw dump for the signal. Wtf right?

Like my script extracts the frequency from the manufacturer's codes that they emailed me. Normally I get :
Code: [Select]
Carrier frequency 38028.866495633

I overrode that and changed it to 40000. With carrier frequency you get the multiplier in microseconds.

Whenever I changed frequency in IRsend... it either didn't make a difference or it stopped working entirely.

So this begs the question.... what's even the point of setting the frequency in irsend.sendRaw() ? If you were entering the PRONTO code format as raw, I could understand. Or even hex->decimal in raw, but with the values already taking in the multiplier.... ah who cares it works.

Thanks a lot for the help man!


AnalysIR

Sounds like the the manufacturer got the PRONTO codes from a customer and it looks like the customer didnt do a great job capturing the signal, as it is corrupted.

Main thing is it works.

BTW: setting the frequency is important, but most systems tolerate some deviation. So it would not be surprising to be able to receive a 40kHz signal on a 38kHz receiver and vice-versa . Of course range & reliability would be impacted.


After some more thought I decided to cross reference the signals against the binary codes provided and was able to generate the signals from the binary codes as folows:
Code: [Select]
unsigned int Signal_Open_0[] =
{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
,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   Open- 110100010000

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


unsigned int Signal_Stop_1[] =
{1248,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,1248,416,416,1248,416,1248,416,1248,416,1248,416,16383
,1248,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,1248,416,416,1248,416,1248,416,1248,416,1248,416,16383
}; //AnalysIR Batch Export - RAW   Stop- 110100001000


below is the approach taken based on the following codes (Close example)
Close- 110100100000, Open- 110100010000, Stop- 110100001000
Code: [Select]

Close- 110100100000

ORIGINAL SIGNAL
1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,416,1248,416,1248,1248,416,416,1248,416,1248,416,16383
       1        1        0        1        0        0        0        0        1        0        0    0
NEW SIGNAL
1248,416,1248,416,416,1248,1248,416,416,1248,416,1248,1248,416,416,416,1248,416,416,1248,416,1248,416,16383
       1        1        0        1        0        0        1        0        0        0       0   0


If you have time , try these new ones out at 38 kHz (and of course 40 etc if they dont work)

juntao65

So I'm back and having similar IR issues again.

Not with the curtains though, I bought a lutron IR lightswitch and I'm attempting to control that with the duino.

I think I figured out why my previous attempts to clone the curtain signal didn't work: wrong receiver frequency. Unfortunately the lightswitch is also at 40 khz whereas my receiver is 38khz... so there isn't much chance on me cloning it through that method.

So I checked the manufacturer's website and found this:

Code: [Select]

Full On:
IRCommand: FF8884B80h
Pronto: 0000 0069 0006 0000 032a 010e 005a 010e 005a 0168 005a 00b4 005a 005a 010e 0276

Full Off:
IR Command: FF88BD120h
Pronto: 0000 0069 0007 0007 032a 010e 005a 010e 005a 005a 0168 005a 005a 010e 005a 00b4 005a 01c2 032a 010e 005a 010e 005a 005a 0168 005a 005a 010e 005a 00b4 005a 01c2



So I took the pronto codes and dumped it in php script and tried using the sendRaw command in the duino. No luck =x

Raw code for off:

Code: [Select]
{20518,6839,2280,6839,2280,11399,2280,6839,2280,6839,2280,11399,20518,6839,2280,6839,2280,11399,2280,6839,2280,6839,2280,11399};



I find that the decoded PRONTO codes are a bit weird. For example for the off code:

Code: [Select]
PRONTO code: 0000 0069 0006 0006 032a 010e 005a 010e 005a 01c2 005a 010e 005a 010e 005a 01c2 032a 010e 005a 010e 005a 01c2 005a 010e 005a 010e 005a 01c2
Carrier frequency 39477.585219276
Multiplier: 25.33083
Length of One Time Burst: 6
Length of repeat burst: 6
Lead in burst: 20518, 6839
Burst pair 1: (90,270) 2280, 6839 | Bit 1: 0
Burst pair 2: (90,450) 2280, 11399 | Bit 2: 0
Burst pair 3: (90,270) 2280, 6839 | Bit 3: 0
Burst pair 4: (90,270) 2280, 6839 | Bit 4: 0
Burst pair 5: (90,450) 2280, 11399 | Bit 5: 0
Burst pair 6: (810,270) 20518, 6839 | Bit 6: 1
Deliminator timeoff: 6839

Burst pair 7: (90,270) 2280, 6839 | Bit 7: 0
Burst pair 8: (90,450) 2280, 11399 | Bit 8: 0
Burst pair 9: (90,270) 2280, 6839 | Bit 9: 0
Burst pair 10: (90,270) 2280, 6839 | Bit 10: 0
Burst pair 11: (90,450) 2280, 11399 | Bit 11: 0
Binary: 000001


Each bit isn't as obvious as the curtains, where you could easily tell if it was 1 or 0 because it was a combination of 2 different numbers. Whereas this code has more variation.

Here is a link to lutron's IR specs:
http://webcache.googleusercontent.com/search?q=cache:WkVDdMfTqUUJ:www.lutron.com/TechnicalDocumentLibrary/048158.doc+&cd=4&hl=en&ct=clnk&gl=ca

Not sure if I goofed the decoding or not.

AnalysIR

#27
Apr 16, 2014, 10:45 pm Last Edit: Apr 16, 2014, 10:46 pm by AnalysIR Reason: 1
A couple of things.....

- First, I have imported the signals and uploaded a screenshot of both signals, FYI
- You can see that your calculations for PRONTO conversion, differs from mine (I think mine is more correct)
- check your calculations for rounding errors or similar.
- The frequency is 40 kHz
- The second OFF signal is just sent twice, which is why it is longer
- The IR protocol is pretty easy to decode (if you know how  :) )
- All it is....each bit in the signal is 2250 uSecs long. So just divide the mark length by 2250 and you get the number of 1s at that position. - Ditto for spaces to get 0's. I verified the first ON signal to match the HEX codes you provided.

juntao65

So does that come out to this array for sendRaw? I tried this one but it didn't work. =(

Code: [Select]
int on_signal= {1000,20250,6750,2250,6750,2250,9000,2250,4500,2250,2250,6750,15750};

Where does the first 1000 come from?

Btw I bought a copy of AnalysisIR =). I guess I need to get it activated before I can import the PRONTO to a channel right?

AnalysIR

We just add 1000 at the start of displayed signals, to make things pretty. It is removed automatically on export.

Below are your signals exported for IRLib.
Code: [Select]
/*
Automatically Generated by AnalysIR - Batch Export Utility
Registered to: xxxxxxxx
Session History
Type : Key : Value : Bits
0 : RAW :  : : 0
1 : RAW :  :  : 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=40; //NB Change this default value as neccessary to the correct modulation frequency


unsigned int Signal_0_0[] = {20250,6750,2250,6750,2250,2250,9000,2250,2250,6750,2250,4500,2250,11250,20250,6750,2250,6750,2250,2250,9000,2250,2250,6750,2250,4500,2250,11250}; //AnalysIR Batch Export - RAW

My_Sender.IRsendRaw::send(Signal_0_0, sizeof(Signal_0_0)/sizeof(int), khz); //AnalysIR Batch Export - RAW
// AnalysIR IR Protocol: SANYO, Key: 


unsigned int Signal_1_1[] = {20250,6750,2250,6750,2250,9000,2250,4500,2250,2250,6750,15750}; //AnalysIR Batch Export - RAW

My_Sender.IRsendRaw::send(Signal_1_1, sizeof(Signal_1_1)/sizeof(int), khz); //AnalysIR Batch Export - RAW
// AnalysIR IR Protocol: RAW, Key: 


Note: because of the longer bursts in these signals, IRremote cannot send them (because of the max length of delayMicroseconds in Arduino). So you will need to use the latest version of IRLib which now supports these longer type bursts (based on our suggestions)

Go Up