Go Down

Topic: Samsung AC IR remote Decode Problem (Read 4348 times) previous topic - next topic

Mar 07, 2013, 05:34 am Last Edit: Mar 07, 2013, 05:35 am by arslankhan Reason: 1
Hi, I want to decode the Samsung AC IrRemote. I am using the Arduino Uno, and using arduino example IRrecvDump
Code: [Select]

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
}

// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
// void * to work around compiler issue
//void dump(void *v) {
//  decode_results *results = (decode_results *)v
void dump(decode_results *results) {
 int count = results->rawlen;
 if (results->decode_type == UNKNOWN) {
   Serial.print("Unknown encoding: ");
 }
 else if (results->decode_type == NEC) {
   Serial.print("Decoded NEC: ");
 }
 else if (results->decode_type == SONY) {
   Serial.print("Decoded SONY: ");
 }
 else if (results->decode_type == RC5) {
   Serial.print("Decoded RC5: ");
 }
  else if (results->decode_type == SANYO) {
   Serial.print("Decoded SANYO: ");
 }
 else if (results->decode_type == RC6) {
   Serial.print("Decoded RC6: ");
 }
 else if (results->decode_type == PANASONIC) {
   Serial.print("Decoded PANASONIC - Address: ");
   Serial.print(results->panasonicAddress,HEX);
   Serial.print(" Value: ");
 }
 else if (results->decode_type == JVC) {
    Serial.print("Decoded JVC: ");
 }
 Serial.print(results->value, HEX);
 Serial.print(" (");
 Serial.print(results->bits, DEC);
 Serial.println(" bits)");
 Serial.print("Raw (");
 Serial.print(count, DEC);
 Serial.print("): ");

 for (int i = 0; i < count; i++) {
   if ((i % 2) == 1) {
     Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
   }
   else {
     Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
   }
   Serial.print(" ");
 }
 Serial.println("");
}


void loop() {
 if (irrecv.decode(&results)) {
   Serial.println(results.value, HEX);
   dump(&results);
   irrecv.resume(); // Receive the next value
 }
}

Following is the output after pressing IR remote button on and off.
Code: [Select]

FFFFFFFF
Decoded SANYO: FFFFFFFF (0 bits)
Raw (116): -8900 600 -400 600 -1400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -1350 600 -400 650 -400 550 -1450 550 -1450 550 -450 600 -1400 550 -1450 550 -1450 600 -1400 600 -1400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -350 600 -400 600 -450 600 -400 550 -450 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -350 650 -400 600 -400 550 -450 550 -450 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -350 650 -400 550 -450 550 -450 600 -400 600 -400 600 -400 600 -1400 600 -1400 600 -2400 3100
FFFFFFFF
Decoded SANYO: FFFFFFFF (0 bits)
Raw (116): -8850 650 -400 600 -1400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -1350 650 -350 650 -350 650 -1350 650 -400 600 -400 600 -1400 600 -1400 600 -1400 600 -1400 600 -1400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -350 650 -350 650 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -350 650 -350 650 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 600 -400 650 -350 650 -350 650 -400 600 -400 600 -400 600 -400 600 -1400 600 -1400 600 -1400 600 -1400 600 -2400 3100



i convert the raw data into 0s and 1s. Then i got the following hex
Code: [Select]

4049F00000000F 16 ON
404DF000000003 16 OFF
4049F00000000F 17 ON
404DF000000003 17 OFF
4049F00000000F 18 ON
404DF000000003 18 OFF

there is no change in raw . I think its long code that . I make the change in Rawbuf.
Code: [Select]
#define RAWBUF 240 // Length of raw duration buffer
I want to know how i can decode the exact code .Kindly tell me how can i do that..
Thanks

UKHeliBob

What do you want to get from the IR ?
Is it a unique value for each key pressed or something else ?
If so, have you tried the demo code rather than the dump code ?
Code: [Select]
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    if (results.value == 0xFF00FF)
    {
      Serial.println("!");
    }
    irrecv.resume(); // Receive the next value
  }
}
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Thanks @UKHeliBob..
Its not unique ... If i pressed temp20 or 21 or any other temprature then same hex code is shown as a result.

Quote

FFFFFFFF
Decoded SANYO: FFFFFFFF (0 bits)
FFFFFFFF
Decoded SANYO: FFFFFFFF (0 bits)
FFFFFFFF
Decoded SANYO: FFFFFFFF (0 bits)
FFFFFFFF
Decoded SANYO: FFFFFFFF (0 bits)

Grumpy_Mike

The problem is that the Samsung AC remote control codes are very much longer than the normal TV type code, so you will have to do some work yourself. This link will give you a start;-
http://www.pcbheaven.com/userpages/Reverse_Engineering_Fidji_Air_Condition_IR_Protocol/

Thank You Very Much @Grumpy_Mike.... I will come back with all simulation after the experiment.

Thanks to all for Great help. I successfully decoded the  IR code of Samsung from gnuplot 4.6. I  Will Upload all Simulation after my complete experiment.

rNmScale

@arslankhan, That is great new ! I have been thinking of doing a project with my sammy ;)  It involves completely simulating the remote control using an arduino connected to my android phone via bluetooth.

Can you post the decoding portion of your arduino sketch ?

Currently I am using a raspberry pi and some python to decode the ir signals sent by the remote. My estimate is I would be able to decode the remote in a few days !

#7
Apr 02, 2013, 01:12 pm Last Edit: Apr 02, 2013, 02:00 pm by arslankhan Reason: 1
Sorry to all i was too late to post the solution of samsung IR remote decoding.
I am here to explain step by step.
Code: [Select]

#include <avr/interrupt.h>
#include <avr/io.h>

#define TIMER_RESET  TCNT1 = 0
#define SAMPLE_SIZE  255

int IRpin = 3;
unsigned int TimerValue[SAMPLE_SIZE];
char direction[SAMPLE_SIZE];
byte change_count;
long time;

void setup() {
 Serial.begin(115200);
 Serial.println("Analyze IR Remote");
 TCCR1A = 0x00;          // COM1A1=0, COM1A0=0 => Disconnect Pin OC1 from Timer/Counter 1 -- PWM11=0,PWM10=0 => PWM Operation disabled
 // ICNC1=0 => Capture Noise Canceler disabled -- ICES1=0 => Input Capture Edge Select (not used) -- CTC1=0 => Clear Timer/Counter 1 on Compare/Match
 // CS12=0 CS11=1 CS10=1 => Set prescaler to clock/64
 TCCR1B = 0x03;          // 16MHz clock with prescaler means TCNT1 increments every 4uS
 // ICIE1=0 => Timer/Counter 1, Input Capture Interrupt Enable -- OCIE1A=0 => Output Compare A Match Interrupt Enable -- OCIE1B=0 => Output Compare B Match Interrupt Enable
 // TOIE1=0 => Timer 1 Overflow Interrupt Enable
 TIMSK1 = 0x00;          
 pinMode(IRpin, INPUT);
}

void loop()
{
 Serial.println("Waiting...");
 change_count = 0;
 while(digitalRead(IRpin) == HIGH) {}                                
 TIMER_RESET;
 TimerValue[change_count] = TCNT1;
 direction[change_count++] = '0';
 while (change_count < SAMPLE_SIZE) {
   if (direction[change_count-1] == '0') {
     while(digitalRead(IRpin) == LOW) {}
     TimerValue[change_count] = TCNT1;
     direction[change_count++] = '1';
   } else {
     while(digitalRead(IRpin) == HIGH) {}
     TimerValue[change_count] = TCNT1;
     direction[change_count++] = '0';
   }
 }
 Serial.println("Bit stream detected!");
 change_count = 0;
 time = (long) TimerValue[change_count] * 4;
 Serial.print(time);
 Serial.print("\t");
 Serial.println(direction[change_count++]);
 while (change_count < SAMPLE_SIZE) {
   time = (long) TimerValue[change_count] * 4;
   Serial.print(time);
   Serial.print("\t");
   Serial.println(direction[change_count-1]);
   Serial.print(time);
   Serial.print("\t");
   Serial.println(direction[change_count++]);    
 }
 Serial.println("Bit stream end!");
 delay(2000);
}

result shows
Code: [Select]

Analyze IR Remote
Waiting...
Bit stream detected!
0 0
3548 0
3548 1
5180 1
5180 0
5684 0
5684 1
6864 1
6864 0
7364 0
7364 1
8548 1
8548 0
9044 0
9044 1
9380 1
9380 0
9888 0
9888 1
10224 1
10224 0
10724 0
10724 1
11060 1
11060 0
11564 0
11564 1
12744 1
12744 0
13248 0
13248 1
13584 1
13584 0
14084 0
14084 1
14420 1
14420 0
14928 0
14928 1
16104 1
16104 0
16608 0
16608 1
17788 1
17788 0
18292 0
18292 1
18628 1
18628 0
19128 0
19128 1
20312 1
20312 0
20812 0
20812 1
21148 1
21148 0
21648 0
21648 1
21992 1
21992 0
22488 0
22488 1
23668 1
23668 0
24172 0
24172 1
25352 1
25352 0
25856 0
25856 1
26192 1
26192 0
26692 0
26692 1
27876 1
27876 0
28376 0
28376 1
29552 1
29552 0
30060 0
30060 1
30396 1
30396 0
30896 0
30896 1
31236 1
31236 0
31736 0
31736 1
32916 1
32916 0
33420 0
33420 1
33756 1
33756 0
34256 0
34256 1
34592 1
34592 0
35100 0
35100 1
36276 1
36276 0
36780 0
36780 1
37116 1
37116 0
37616 0
37616 1
37952 1
37952 0
38460 0
38460 1
38796 1
38796 0
39296 0
39296 1
39636 1
39636 0
40136 0
40136 1
40472 1
40472 0
40980 0
40980 1
41316 1
41316 0
41816 0
41816 1
42152 1
42152 0
42656 0
42656 1
42992 1
42992 0
43492 0
43492 1
43828 1
43828 0
44336 0
44336 1
44672 1
44672 0
45172 0
45172 1
45512 1
45512 0
46012 0
46012 1
46348 1
46348 0
46848 0
46848 1
47192 1
47192 0
47692 0
47692 1
48028 1
48028 0
48532 0
48532 1
48868 1
48868 0
49368 0
49368 1
49704 1
49704 0
50208 0
50208 1
50544 1
50544 0
51044 0
51044 1
51380 1
51380 0
51888 0
51888 1
52224 1
52224 0
52724 0
52724 1
53064 1
53064 0
53564 0
53564 1
54744 1
54744 0
55248 0
55248 1
55584 1
55584 0
56084 0
56084 1
56428 1
56428 0
56928 0
56928 1
57264 1
57264 0
57760 0
57760 1
58104 1
58104 0
58604 0
58604 1
58940 1
58940 0
59444 0
59444 1
59784 1
59784 0
60280 0
60280 1
60620 1
60620 0
61128 0
61128 1
61460 1
61460 0
61960 0
61960 1
62296 1
62296 0
62800 0
62800 1
63136 1
63136 0
63636 0
63636 1
63980 1
63980 0
64480 0
64480 1
64816 1
64816 0
65316 0
65316 1
65656 1
65656 0
66156 0
66156 1
67340 1
67340 0
67840 0
67840 1
68176 1
68176 0
68676 0
68676 1
69020 1
69020 0
69520 0
69520 1
69856 1
69856 0
70356 0
70356 1
70696 1
70696 0
71196 0
71196 1
71532 1
71532 0
72036 0
72036 1
73216 1
73216 0
73716 0
73716 1
74900 1
74900 0
75400 0
75400 1
75736 1
75736 0
76240 0
76240 1
77420 1
77420 0
77924 0
77924 1
79104 1
79104 0
79600 0
79600 1
79944 1
79944 0
80444 0
80444 1
80780 1
80780 0
81284 0
81284 1
81620 1
81620 0
82120 0
82120 1
82456 1
82456 0
82964 0
82964 1
83300 1
83300 0
83800 0
83800 1
84136 1
84136 0
84640 0
84640 1
84976 1
84976 0
85476 0
85476 1
85820 1
85820 0
86320 0
86320 1
87504 1
87504 0
88000 0
88000 1
88340 1
88340 0
88836 0
88836 1
89180 1
89180 0
89680 0
89680 1
90016 1
90016 0
90516 0
90516 1
90860 1
90860 0
91356 0
91356 1
91692 1
91692 0
92192 0
92192 1
92536 1
92536 0
93036 0
93036 1
93372 1
93372 0
93876 0
93876 1
94212 1
94212 0
94712 0
94712 1
95048 1
95048 0
95556 0
95556 1
95892 1
95892 0
96392 0
96392 1
96732 1
96732 0
97232 0
97232 1
97568 1
97568 0
98068 0
98068 1
98412 1
98412 0
98912 0
98912 1
99248 1
99248 0
99748 0
99748 1
100088 1
100088 0
100588 0
100588 1
100924 1
100924 0
101432 0
101432 1
101768 1
101768 0
102268 0
102268 1
102608 1
102608 0
103116 0
103116 1
103444 1
103444 0
103944 0
103944 1
104288 1
104288 0
104784 0
104784 1
105124 1
105124 0
105620 0
105620 1
105964 1
105964 0
106464 0
106464 1
106800 1
106800 0
107300 0
107300 1
107644 1
107644 0
108140 0
108140 1
108480 1
108480 0
108984 0
108984 1
109320 1
109320 0
109820 0
109820 1
110160 1
110160 0
110660 0
110660 1
110996 1
110996 0
111496 0
111496 1
111840 1
111840 0
112340 0
112340 1
112676 1
112676 0
113176 0
113176 1
113516 1
113516 0
114016 0
114016 1
114352 1
114352 0
114852 0
114852 1
115196 1
115196 0
115696 0
115696 1
116032 1
116032 0
116532 0
116532 1
116872 1
116872 0
117372 0
117372 1
117716 1
117716 0
118216 0
118216 1
118552 1
118552 0
119052 0
119052 1
119392 1
119392 0
119892 0
119892 1
120228 1
120228 0
120728 0
120728 1
121072 1
121072 0
121572 0
121572 1
121908 1
121908 0
122408 0
122408 1
122748 1
122748 0
123248 0
123248 1
123584 1
123584 0
124084 0
124084 1
124428 1
124428 0
124928 0
124928 1
125264 1
125264 0
125768 0
125768 1
126104 1
126104 0
126604 0
126604 1
126948 1
126948 0
Bit stream end!
Waiting...


Copy the result and past it in notpad, save it as dat extension file.
Open this file in gnuplot .(explain in uploaded figure named "gnuplot command"). Press enter to see the graph.
Graph shows mark and spaces.
code decoding is explained in the figure"gnuplot explain"
Anybody who did not understand can share his confusion.





I'm using IRRemote Library , to decode by Samsung TV Remote
but even if I press the same key/button , each time I'm getting different raw codes !!
Code: [Select]

Received unknown code, saving as raw
m4450 s4550 m550 s1700 m550 s1700 m500 s1700 m550 s600 m550 s600 m500 s600 m500 s650 m500 s600 m500 s1700 m550 s1700 m550 s1700 m550 s600 m500 s600 m550 s600 m450 s650 m500 s650 m450 s650 m500 s1700 m550 s600 m500 s650 m500 s600 m500 s650 m450 s650 m500 s600 m500 s1750 m500 s650 m450 s1750 m550 s1700 m550 s1700 m500 s1700 m550 s1700 m550 s1700 m550
Received unknown code, saving as raw
m4500 s4550 m550 s1700 m550 s1700 m500 s1750 m500 s600 m500 s600 m550 s600 m550 s550 m500 s650 m500 s1750 m500 s1700 m550 s1700 m550 s550 m550 s600 m550 s600 m500 s600 m550 s600 m450 s650 m500 s1700 m550 s600 m500 s650 m450 s650 m500 s650 m450 s650 m500 s600 m500 s1750 m500 s600 m500 s1750 m550 s1700 m500 s1750 m500 s1700 m550 s1700 m550 s1700 m550
Received unknown code, saving as raw
m4500 s4550 m550 s1700 m550 s1700 m550 s1700 m500 s600 m500 s650 m500 s600 m500 s600 m550 s600 m500 s1750 m500 s1700 m550 s1700 m550 s600 m500 s600 m500 s650 m500 s600 m500 s600 m550 s600 m500 s1750 m500 s600 m500 s600 m550 s600 m500 s600 m550 s600 m500 s600 m500 s1750 m500 s600 m550 s1700 m500 s1750 m550 s1700 m550 s1700 m500 s1700 m550 s1700 m550
Received unknown code, saving as raw
m4500 s4550 m550 s1700 m500 s1700 m550 s1700 m550 s600 m500 s600 m500 s600 m550 s600 m500 s600 m550 s1700 m500 s1750 m500 s1750 m550 s550 m500 s650 m500 s600 m500 s600 m550 s600 m500 s600 m500 s1750 m500 s650 m500 s600 m500 s600 m550 s600 m500 s600 m500 s650 m500 s1750 m500 s600 m500 s1750 m500 s1750 m500 s1700 m550 s1700 m550 s1700 m550 s1700 m550

From past few days I'm searching for a work around
I have just tried your code and this is output , I'm not able to view this data in gnuplot .
can you once try the same from your side ? Thanks .
Code: [Select]
0 0
4588 0
4588 1
9040 1
9040 0
9676 0
9676 1
11284 1
11284 0
11916 0
11916 1
13516 1
13516 0
14156 0
14156 1
15760 1
15760 0
16404 0
16404 1
16880 1
16880 0
17516 0
17516 1
18000 1
18000 0
18636 0
18636 1
19120 1
19120 0
19732 0
19732 1
20240 1
20240 0
20848 0
20848 1
21360 1
21360 0
21972 0
21972 1
23604 1
23604 0
24212 0
24212 1
25840 1
25840 0
26452 0
26452 1
28080 1
28080 0
28692 0
28692 1
29200 1
29200 0
29812 0
29812 1
30324 1
30324 0
30932 0
30932 1
31444 1
31444 0
32052 0
32052 1
32564 1
32564 0
33176 0
33176 1
33688 1
33688 0
34296 0
34296 1
35924 1
35924 0
36536 0
36536 1
37044 1
37044 0
37656 0
37656 1
39284 1
39284 0
39896 0
39896 1
40404 1
40404 0
41016 0
41016 1
41528 1
41528 0
42136 0
42136 1
42648 1
42648 0
43256 0
43256 1
43768 1
43768 0
44380 0
44380 1
44892 1
44892 0
45500 0
45500 1
46008 1
46008 0
46620 0
46620 1
48248 1
48248 0
48860 0
48860 1
49372 1
49372 0
49980 0
49980 1
51608 1
51608 0
52220 0
52220 1
53852 1
53852 0
54460 0
54460 1
56092 1
56092 0
56700 0
56700 1
58332 1
58332 0
58944 0
58944 1
60572 1
60572 0
61184 0
61184 1
107940 1
107940 0
112536 0
112536 1
116956 1
116956 0
117596 0
117596 1
119196 1
119196 0
119832 0
119832 1
121436 1
121436 0
122072 0
122072 1
123676 1
123676 0
124312 0
124312 1
124796 1
124796 0
125436 0
125436 1
125920 1
125920 0
126556 0
126556 1
127040 1
127040 0
127676 0
127676 1
128160 1
128160 0
128796 0
128796 1
129280 1
129280 0
129916 0
129916 1
131520 1
131520 0
132160 0
132160 1
133760 1
133760 0
134396 0
134396 1
136000 1
136000 0
136636 0
136636 1
137124 1
137124 0
137760 0
137760 1
138244 1
138244 0
138884 0
138884 1
139368 1
139368 0
140000 0
140000 1
140484 1
140484 0
141096 0
141096 1
141608 1
141608 0
142216 0
142216 1
143848 1
143848 0
144484 0
144484 1
144968 1
144968 0
145576 0
145576 1
147208 1
147208 0
147844 0
147844 1
148328 1
148328 0
148968 0
148968 1
149448 1
149448 0
150088 0
150088 1
150572 1
150572 0
151180 0
151180 1
151692 1
151692 0
152332 0
152332 1
152812 1
152812 0
153424 0
153424 1
153988 1
153988 0
154544 0
154544 1
156172 1
156172 0
156784 0
156784 1
157296 1
157296 0
157932 0
157932 1
159536 1
159536 0
160172 0
160172 1
161772 1
161772 0
162412 0
162412 1
164016 1
164016 0
164656 0
164656 1
166256 1
166256 0
166896 0
166896 1
168496 1
168496 0
169132 0
169132 1
38448 1
38448 0
43040 0
43040 1
47544 1
47544 0
48128 0
48128 1
49760 1
49760 0
50368 0
50368 1
52000 1
52000 0
52608 0
52608 1
54240 1
54240 0
54852 0
54852 1
55360 1
55360 0
55968 0
55968 1
56484 1
56484 0
57092 0
57092 1
57600 1
57600 0
58212 0
58212 1
58724 1
58724 0
59336 0
59336 1
59844 1
59844 0
60432 0
60432 1
62084 1
62084 0
62696 0
62696 1
64324 1
64324 0
64936 0
64936 1
66564 1
66564 0
67176 0
67176 1
67684 1
67684 0
68296 0
68296 1
68804 1
68804 0
69420 0
69420 1
69928 1
69928 0
70512 0
70512 1
71048 1
71048 0
71632 0
71632 1
72168 1
72168 0
72752 0
72752 1
74408 1
74408 0
75020 0
75020 1
75528 1
75528 0
76112 0
76112 1
77772 1
77772 0
78380 0
78380 1
78888 1
78888 0
79472 0
79472 1
80012 1
80012 0
80596 0
80596 1
81132 1
81132 0
81716 0
81716 1
82252 1
82252 0
82836 0
82836 1
83372 1
83372 0
83956 0
83956 1
84492 1
84492 0
85080 0
85080 1
86736 1
86736 0
87348 0
87348 1
87852 1
87852 0
88440 0
88440 1
90096 1
90096 0
90708 0
90708 1
92336 1
92336 0
92948 0
92948 1
94576 1
94576 0
95188 0
95188 1
96820 1
96820 0
97428 0
97428 1
99056 1
99056 0
99668 0
99668 1
146404 1
146404 0
150968 0
150968 1
155472 1
155472 0
156080 0
156080 1
157716 1
157716 0
158324 0
158324 1
159924 1
159924 0
160564 0
160564 1
162164 1
162164 0
162776 0
162776 1
163312 1
163312 0
163896 0
163896 1
164408 1
164408 0
165016 0
165016 1
165552 1
165552 0
166136 0
166136 1
166676 1
166676 0
167256 0
167256 1
167768 1
167768 0
168348 0
168348 1
170008 1
170008 0
170620 0
170620 1
172248 1
172248 0
172860 0
172860 1
174488 1
174488 0
175096 0
175096 1
175608 1
175608 0
176192 0
176192 1
176732 1
176732 0
177312 0
177312 1
177852 1
177852 0
178432 0
178432 1
178972 1
178972 0
179556 0
179556 1
180092 1
180092 0
180676 0
180676 1
182332 1
182332 0
182940 0
182940 1
183456 1
183456 0
184036 0
184036 1
185692 1
185692 0
186304 0
186304 1
186816 1
186816 0
187400 0
187400 1
187936 1
187936 0
188516 0
188516 1
189056 1
189056 0
189612 0
189612 1
190176 1
190176 0
190732 0
190732 1
191296 1
191296 0


Sorry to all i was too late to post the solution of samsung IR remote decoding.
I am here to explain step by step.
Code: [Select]

#include <avr/interrupt.h>
#include <avr/io.h>

#define TIMER_RESET  TCNT1 = 0
#define SAMPLE_SIZE  255

int IRpin = 3;
unsigned int TimerValue[SAMPLE_SIZE];
char direction[SAMPLE_SIZE];
byte change_count;
long time;

void setup() {
 Serial.begin(115200);
 Serial.println("Analyze IR Remote");
 TCCR1A = 0x00;          // COM1A1=0, COM1A0=0 => Disconnect Pin OC1 from Timer/Counter 1 -- PWM11=0,PWM10=0 => PWM Operation disabled
 // ICNC1=0 => Capture Noise Canceler disabled -- ICES1=0 => Input Capture Edge Select (not used) -- CTC1=0 => Clear Timer/Counter 1 on Compare/Match
 // CS12=0 CS11=1 CS10=1 => Set prescaler to clock/64
 TCCR1B = 0x03;          // 16MHz clock with prescaler means TCNT1 increments every 4uS
 // ICIE1=0 => Timer/Counter 1, Input Capture Interrupt Enable -- OCIE1A=0 => Output Compare A Match Interrupt Enable -- OCIE1B=0 => Output Compare B Match Interrupt Enable
 // TOIE1=0 => Timer 1 Overflow Interrupt Enable
 TIMSK1 = 0x00;          
 pinMode(IRpin, INPUT);
}

void loop()
{
 Serial.println("Waiting...");
 change_count = 0;
 while(digitalRead(IRpin) == HIGH) {}                                
 TIMER_RESET;
 TimerValue[change_count] = TCNT1;
 direction[change_count++] = '0';
 while (change_count < SAMPLE_SIZE) {
   if (direction[change_count-1] == '0') {
     while(digitalRead(IRpin) == LOW) {}
     TimerValue[change_count] = TCNT1;
     direction[change_count++] = '1';
   } else {
     while(digitalRead(IRpin) == HIGH) {}
     TimerValue[change_count] = TCNT1;
     direction[change_count++] = '0';
   }
 }
 Serial.println("Bit stream detected!");
 change_count = 0;
 time = (long) TimerValue[change_count] * 4;
 Serial.print(time);
 Serial.print("\t");
 Serial.println(direction[change_count++]);
 while (change_count < SAMPLE_SIZE) {
   time = (long) TimerValue[change_count] * 4;
   Serial.print(time);
   Serial.print("\t");
   Serial.println(direction[change_count-1]);
   Serial.print(time);
   Serial.print("\t");
   Serial.println(direction[change_count++]);    
 }
 Serial.println("Bit stream end!");
 delay(2000);
}

result shows
Code: [Select]

Analyze IR Remote
Waiting...
Bit stream detected!
0 0
3548 0
3548 1
5180 1
5180 0
5684 0
5684 1
6864 1
6864 0
7364 0
7364 1
8548 1
8548 0
9044 0
9044 1
9380 1
9380 0
9888 0
9888 1
10224 1
10224 0
10724 0
10724 1
11060 1
11060 0
11564 0
11564 1
12744 1
12744 0
13248 0
13248 1
13584 1
13584 0
14084 0
14084 1
14420 1
14420 0
14928 0
14928 1
16104 1
16104 0
16608 0
16608 1
17788 1
17788 0
18292 0
18292 1
18628 1
18628 0
19128 0
19128 1
20312 1
20312 0
20812 0
20812 1
21148 1
21148 0
21648 0
21648 1
21992 1
21992 0
22488 0
22488 1
23668 1
23668 0
24172 0
24172 1
25352 1
25352 0
25856 0
25856 1
26192 1
26192 0
26692 0
26692 1
27876 1
27876 0
28376 0
28376 1
29552 1
29552 0
30060 0
30060 1
30396 1
30396 0
30896 0
30896 1
31236 1
31236 0
31736 0
31736 1
32916 1
32916 0
33420 0
33420 1
33756 1
33756 0
34256 0
34256 1
34592 1
34592 0
35100 0
35100 1
36276 1
36276 0
36780 0
36780 1
37116 1
37116 0
37616 0
37616 1
37952 1
37952 0
38460 0
38460 1
38796 1
38796 0
39296 0
39296 1
39636 1
39636 0
40136 0
40136 1
40472 1
40472 0
40980 0
40980 1
41316 1
41316 0
41816 0
41816 1
42152 1
42152 0
42656 0
42656 1
42992 1
42992 0
43492 0
43492 1
43828 1
43828 0
44336 0
44336 1
44672 1
44672 0
45172 0
45172 1
45512 1
45512 0
46012 0
46012 1
46348 1
46348 0
46848 0
46848 1
47192 1
47192 0
47692 0
47692 1
48028 1
48028 0
48532 0
48532 1
48868 1
48868 0
49368 0
49368 1
49704 1
49704 0
50208 0
50208 1
50544 1
50544 0
51044 0
51044 1
51380 1
51380 0
51888 0
51888 1
52224 1
52224 0
52724 0
52724 1
53064 1
53064 0
53564 0
53564 1
54744 1
54744 0
55248 0
55248 1
55584 1
55584 0
56084 0
56084 1
56428 1
56428 0
56928 0
56928 1
57264 1
57264 0
57760 0
57760 1
58104 1
58104 0
58604 0
58604 1
58940 1
58940 0
59444 0
59444 1
59784 1
59784 0
60280 0
60280 1
60620 1
60620 0
61128 0
61128 1
61460 1
61460 0
61960 0
61960 1
62296 1
62296 0
62800 0
62800 1
63136 1
63136 0
63636 0
63636 1
63980 1
63980 0
64480 0
64480 1
64816 1
64816 0
65316 0
65316 1
65656 1
65656 0
66156 0
66156 1
67340 1
67340 0
67840 0
67840 1
68176 1
68176 0
68676 0
68676 1
69020 1
69020 0
69520 0
69520 1
69856 1
69856 0
70356 0
70356 1
70696 1
70696 0
71196 0
71196 1
71532 1
71532 0
72036 0
72036 1
73216 1
73216 0
73716 0
73716 1
74900 1
74900 0
75400 0
75400 1
75736 1
75736 0
76240 0
76240 1
77420 1
77420 0
77924 0
77924 1
79104 1
79104 0
79600 0
79600 1
79944 1
79944 0
80444 0
80444 1
80780 1
80780 0
81284 0
81284 1
81620 1
81620 0
82120 0
82120 1
82456 1
82456 0
82964 0
82964 1
83300 1
83300 0
83800 0
83800 1
84136 1
84136 0
84640 0
84640 1
84976 1
84976 0
85476 0
85476 1
85820 1
85820 0
86320 0
86320 1
87504 1
87504 0
88000 0
88000 1
88340 1
88340 0
88836 0
88836 1
89180 1
89180 0
89680 0
89680 1
90016 1
90016 0
90516 0
90516 1
90860 1
90860 0
91356 0
91356 1
91692 1
91692 0
92192 0
92192 1
92536 1
92536 0
93036 0
93036 1
93372 1
93372 0
93876 0
93876 1
94212 1
94212 0
94712 0
94712 1
95048 1
95048 0
95556 0
95556 1
95892 1
95892 0
96392 0
96392 1
96732 1
96732 0
97232 0
97232 1
97568 1
97568 0
98068 0
98068 1
98412 1
98412 0
98912 0
98912 1
99248 1
99248 0
99748 0
99748 1
100088 1
100088 0
100588 0
100588 1
100924 1
100924 0
101432 0
101432 1
101768 1
101768 0
102268 0
102268 1
102608 1
102608 0
103116 0
103116 1
103444 1
103444 0
103944 0
103944 1
104288 1
104288 0
104784 0
104784 1
105124 1
105124 0
105620 0
105620 1
105964 1
105964 0
106464 0
106464 1
106800 1
106800 0
107300 0
107300 1
107644 1
107644 0
108140 0
108140 1
108480 1
108480 0
108984 0
108984 1
109320 1
109320 0
109820 0
109820 1
110160 1
110160 0
110660 0
110660 1
110996 1
110996 0
111496 0
111496 1
111840 1
111840 0
112340 0
112340 1
112676 1
112676 0
113176 0
113176 1
113516 1
113516 0
114016 0
114016 1
114352 1
114352 0
114852 0
114852 1
115196 1
115196 0
115696 0
115696 1
116032 1
116032 0
116532 0
116532 1
116872 1
116872 0
117372 0
117372 1
117716 1
117716 0
118216 0
118216 1
118552 1
118552 0
119052 0
119052 1
119392 1
119392 0
119892 0
119892 1
120228 1
120228 0
120728 0
120728 1
121072 1
121072 0
121572 0
121572 1
121908 1
121908 0
122408 0
122408 1
122748 1
122748 0
123248 0
123248 1
123584 1
123584 0
124084 0
124084 1
124428 1
124428 0
124928 0
124928 1
125264 1
125264 0
125768 0
125768 1
126104 1
126104 0
126604 0
126604 1
126948 1
126948 0
Bit stream end!
Waiting...


Copy the result and past it in notpad, save it as dat extension file.
Open this file in gnuplot .(explain in uploaded figure named "gnuplot command"). Press enter to see the graph.
Graph shows mark and spaces.
code decoding is explained in the figure"gnuplot explain"
Anybody who did not understand can share his confusion.







Ok, once i have my chart what's the next step? Thanks a lot.  XD

tristangrimaux

Anything new about this? I have the same Samsung Air Conditioner, have done the same things, but I cannot use them to control it. Thanks!

Go Up