controling SAMSUNG Air Conditioner

Everything related to protocols and IR codes
jonalama
Posts: 12
Joined: Fri Sep 06, 2019 10:42 pm

Re: controling SAMSUNG Air Conditioner

Post by jonalama » Thu Sep 19, 2019 5:26 am

I made the changes as you have said.
Now, should I upload the code as below:

/*
Author: AnalysIR
Revision: 1.0 - Initial release
Revision: 1.1 - update generic digitalPinToInterrupt to support most arduino platform

This code is provided to overcome an issue with Arduino IR libraries
It allows you to capture raw timings for signals longer than 255 marks & spaces.
Typical use case is for long Air conditioner signals.

You can use the output to plug back into IRremote, to resend the signal.

This Software was written by AnalysIR.

Usage: Free to use, subject to conditions posted on blog below.
Please credit AnalysIR and provide a link to our website/blog, where possible.

Copyright AnalysIR 2014-2019

Please refer to the blog posting for conditions associated with use.
http://www.analysir.com/blog/2014/03/19 ... s-arduino/

Connections:
IR Receiver Arduino
V+ -> +5v
GND -> GND
Signal Out -> Digital Pin 2
(If using a 3V3 Arduino, you should connect V+ to +3V3)

Tested on UNO only
*/

#define LEDPIN 13
//you may increase this value on Arduinos with greater than 2k SRAM
#define maxLen 800
#define rxPinIR 3 //pin D2 or D3 on standard arduinos. (other pins may be available on More mordern modules like MEga2560, DUE, ESP8266, ESP32)


volatile unsigned int irBuffer[maxLen]; //stores timings - volatile because changed by ISR
volatile unsigned int x = 0; //Pointer thru irBuffer - volatile because changed by ISR

void setup() {
Serial.begin(115200); //change BAUD rate as required
attachInterrupt(digitalPinToInterrupt(rxPinIR), rxIR_Interrupt_Handler, CHANGE);//set up ISR for receiving IR signal
}

void loop() {
// put your main code here, to run repeatedly:

Serial.println(F("Press the button on the remote now - once only"));
delay(5000); // pause 5 secs
if (x) { //if a signal is captured
digitalWrite(LEDPIN, HIGH);//visual indicator that signal received
Serial.println();
Serial.print(F("Raw: (")); //dump raw header format - for library
Serial.print((x - 1));
Serial.print(F(") "));
detachInterrupt(digitalPinToInterrupt(rxPinIR));//stop interrupts & capture until finshed here
for (int i = 1; i < x; i++) { //now dump the times
if (!(i & 0x1)) Serial.print(F("-"));
Serial.print(irBuffer - irBuffer);
Serial.print(F(", "));
}
x = 0;
Serial.println();
Serial.println();
digitalWrite(LEDPIN, LOW);//end of visual indicator, for this time
attachInterrupt(digitalPinToInterrupt(rxPinIR), rxIR_Interrupt_Handler, CHANGE);//re-enable ISR for receiving IR signal
}

}

void rxIR_Interrupt_Handler() {
if (x > maxLen) return; //ignore if irBuffer is already full
irBuffer[x++] = micros(); //just continually record the time-stamp of signal transitions

}
You do not have the required permissions to view the files attached to this post.

User avatar
AnalysIR
Site Admin
Posts: 606
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: controling SAMSUNG Air Conditioner

Post by AnalysIR » Thu Sep 19, 2019 9:46 am

I just checked pinout for one manufacturers 2N2222 and it seems you may have the transistor wired up the wrong way.

Please verify & check the pinout in the data sheet & redo your wiring accordingly.

jonalama
Posts: 12
Joined: Fri Sep 06, 2019 10:42 pm

Re: controling SAMSUNG Air Conditioner

Post by jonalama » Thu Sep 19, 2019 4:53 pm

Please tell me if everything is ok now. Let me know what can i do next for my project.

Thank you in advance
Regards
You do not have the required permissions to view the files attached to this post.

User avatar
AnalysIR
Site Admin
Posts: 606
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: controling SAMSUNG Air Conditioner

Post by AnalysIR » Fri Sep 20, 2019 1:30 pm

looks fine now.

If you don't get a lot of range, try reducing the value of the resistor connected to the IR LED to 68R/47R/22R or 10R (or similar e.g. 2x100R in parallel =50R)

jonalama
Posts: 12
Joined: Fri Sep 06, 2019 10:42 pm

Re: controling SAMSUNG Air Conditioner

Post by jonalama » Fri Sep 20, 2019 4:48 pm

Could you please tell me how to send raw code ?

User avatar
AnalysIR
Site Admin
Posts: 606
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: controling SAMSUNG Air Conditioner

Post by AnalysIR » Fri Sep 20, 2019 6:07 pm

Go to the IRremote library on Github.

Install the library using the Arduino IDE. (You might be able to install it directly from the IDE without going to Github)

Play with all of the examples provided with the library....maybe start with your TV first, before trying the more difficult AC signals.

Once you have completed all of the examples, you should be able to answer your own question.....The best way to learn these things is to do some research and then try things out.

....let us know how you get on...

jonalama
Posts: 12
Joined: Fri Sep 06, 2019 10:42 pm

Re: controling SAMSUNG Air Conditioner

Post by jonalama » Sun Sep 22, 2019 5:55 pm

Hello,

Thank you for your help. But if you can give me a hand, I would really appreciate it. I have 3 months trying to solve the issue here and I really need to have a solution tonight since tomorrow is my thesis presentation. Thank you in advance
Regards,
Jona

User avatar
AnalysIR
Site Admin
Posts: 606
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: controling SAMSUNG Air Conditioner

Post by AnalysIR » Mon Sep 23, 2019 12:36 pm

The solution approach was already provided in my previous post.

Unfortunately, I am not in a position to do the work for you.

Best of luck with your thesis.

Post Reply