Having Trouble with sending IR codes to my AC

Hey guys, I am kinda new to Arduino projects. And I'm working on a project which will be applied in a room that includes two Air Conditioners. First AC runs 7/24. My goal is to control the second AC with IR led connected to Arduino. I get my IR codes by IRremote library's ReceiveDemo example sketch. Below, you can see my received AC_ON and AC_OFF codes and how I used them on my sender codes. I designed my circuit to transmit these codes, I point the LED right to the AC from about 1 meter away. I confirmed that IR LED works from my Phone camera but AC does not respond to any of them. What am I doing wrong? What should I do?

AC_ON

Protocol=PulseDistance Raw-Data=0x2 35 bits LSB first
Send on a 8 bit platform with:
uint32_t tRawData[]={0x50400419, 0x2};
IrSender.sendPulseDistanceWidthFromArray(38, 9000, 4350, 650, 1650, 650, 550, &tRawData[0], 35, PROTOCOL_IS_LSB_FIRST, , );

AC_OFF

Protocol=PulseDistance Raw-Data=0x2 35 bits LSB first
Send on a 8 bit platform with:
uint32_t tRawData[]={0x50000411, 0x2};
IrSender.sendPulseDistanceWidthFromArray(38, 9000, 4350, 650, 1650, 650, 550, &tRawData[0], 35, PROTOCOL_IS_LSB_FIRST, , );

How I used them on my code (on different lines):

uint32_t tRawData_ON[]={0x50400419, 0x2};
uint32_t tRawData_OFF[]={0x50000411, 0x2};

IrSender.sendPulseDistanceWidthFromArray(38, 9000, 4350, 650, 1650, 650, 550, &tRawData_ON[0], 35, PROTOCOL_IS_LSB_FIRST, 1000, 0);

IrSender.sendPulseDistanceWidthFromArray(38, 9000, 4350, 650, 1650, 650, 550, &tRawData_OFF[0], 35, PROTOCOL_IS_LSB_FIRST, 1000, 0);

Dis you try the ReceiveDemo to see how it decodes your transmissions?

No, I did not. I will be back with the results today. Thanks.

What kind of AC?
That raw in your code doesn't look typical AC remote code, maybe only small fraction of it.

Typical looks like this:
Raw: (139) 9068, -4404, 708, -1580, 712, -488, 712, -484, 712, -1580, 712, -1580, 708, -1580, 712, -488, 708, -488, 708, -1584, 708, -1584, 708, -1580, 708, -492, 708, -488, 704, -496, 704, -492, 708, -492, 708, -492, 704, -492, 708, -492, 708, -488, 712, -488, 712, -1580, 708, -1580, 712, -488, 712, -484, 712, -488, 712, -488, 712, -484, 712, -1580, 712, -484, 712, -1580, 712, -484, 716, -484, 712, -1580, 712, -484, 712, -19848, 684, -512, 704, -496, 708, -492, 708, -488, 708, -492, 708, -488, 712, -488, 712, -488, 708, -488, 712, -488, 712, -484, 712, -488, 712, -488, 708, -1580, 712, -488, 712, -484, 712, -488, 708, -488, 712, -488, 712, -488, 708, -488, 712, -488, 708, -488, 712, -488, 712, -488, 708, -488, 712, -488, 708, -492, 708, -488, 708, -492, 708, -1584, 704, -1584, 708,

Typical 24000btu/h AC. When I asked ChatGPT to give me a code to receive raw data. I received this, just looks like the one you sent.

Received RAW data: rawData[74]:
-3276750
+9050,-4350

  • 700,-1600 + 700,- 500 + 700,- 500 + 700,- 500
  • 650,-1650 + 650,-1600 + 700,- 500 + 700,- 500
  • 700,- 500 + 650,- 550 + 650,-1650 + 650,- 550
  • 650,- 550 + 650,- 550 + 650,- 500 + 700,- 550
  • 650,- 550 + 650,- 550 + 650,- 550 + 600,- 600
  • 600,- 550 + 650,- 550 + 650,- 550 + 650,- 550
  • 650,- 550 + 600,- 600 + 600,- 600 + 600,- 600
  • 600,-1700 + 600,- 550 + 650,-1650 + 650,- 550
  • 600,- 600 + 600,-1700 + 600,- 600 + 600

I have played with quite many, they are normally at least length in that example. Yours look like a start of a complete signal.
What library you use?
What brand/model is your AC?

I use IRremote.hpp library in arduino. My AC is

Sigma Comfort SGM24INVDMS. Should I use IRlib?

Get your signal with this first, it's done for air conditioners and post your result

most sensible outputs are these with choices 4 and 5.( 4 for Hyundai etc. codes, 5 for Samsung etc. codes)

Enter choice: 4

Ready to decode IR for choice '4'

################# Start

Number of symbols: 71

Symbols:

Hh10001000001000000000000000001010010W00000000000000100000000000001100

Bytes:

00: 1000|1000 | 11 | 00010001

01: 0010|0000 | 04 | 00000100

02: 0000|0000 | 00 | 00000000

03: 0000|1010 | 50 | 01010000

04: 01004: 0000|0000 | 00 | 00000000

05: 0000|0010 | 40 | 01000000

06: 0000|0000 | 00 | 00000000

07: 0000|1100 | 30 | 00110000

11,04,00,50,00,40,00,30

Timings (in us):

PAUSE SPACE: 20012

HEADER MARK: 9104

HEADER SPACE: 4396

BIT MARK: 619

ZERO SPACE: 560

ONE SPACE: 1662

Decoding known protocols...

Looks like a Gree protocol

Checksum does not match

POWER OFF

MODE COOL

Temperature: 20

FAN: 1

SLEEP: OFF

SWING: OFF

Unknown protocol

Bytecount: 8

################# End

Enter choice: 5

Ready to decode IR for choice '5'

################# Start

Number of symbols: 71

Symbols:

Hh10001000001000000000000000001010010W00000000000000100000000000001100

Bytes:

00: 1000|1000 | 11 | 00010001

01: 0010|0000 | 04 | 00000100

02: 0000|0000 | 00 | 00000000

03: 0000|1010 | 50 | 01010000

04: 01004: 0000|0000 | 00 | 00000000

05: 0000|0010 | 40 | 01000000

06: 0000|0000 | 00 | 00000000

07: 0000|1100 | 30 | 00110000

11,04,00,50,00,40,00,30

Timings (in us):

PAUSE SPACE: 19980

HEADER MARK: 9076

HEADER SPACE: 4400

BIT MARK: 632

ZERO SPACE: 546

ONE SPACE: 1654

Decoding known protocols...

Looks like a Gree protocol

Checksum does not match

POWER OFF

MODE COOL

Temperature: 20

FAN: 1

SLEEP: OFF

SWING: OFF

Unknown protocol

Bytecount: 8

################# End

Ok, maybe some new or slightly modified Gree rebranded and not recognized for checksum...
Take the bits and timings and insert them in rawsender.ino (in examples) and give a try with with your transmitter (check the right pin) to see if AC responds.

By the way, how is your circuit?

It contains only IR led and DHT22. nothing much

Not transistor driven?

Well, there is a little issue about trying with transmitter. The AC is at the company, I am an intern there, I do not have access to arduino IDE from company computers (cyber security protocol, I do not know why). So, I took the remote controller at home to collect signals and make changes on my codes. I can only give it a try tomorrow.

One more thing, I have about 25 different codes for all temperature transitions, fans etc. When I implement the PAUSE SPACE, HEADER MARK, HEADER SPACE, BIT MARK, ZERO SPACE, ONE SPACE, can I use common values or is it differ for all of them?

No. Should I use?

If you want "usable" range yes. But first make that AC to respond, even at 5cm distance. With correct circuit you can arrive to 10 meters.

Once you have the timings correct, you can just send different codes like that
Hh10001000001000000000000000001010010W00000000000000100000000000001100.
Every temp/fan setting is changing that code little bit. It's much more efficient than sending raw timings.
Ideally you find a library that can decode it, but for arduino I don't know any better.

I just tested it and it does not turn on my AC. It sends signal but AC does not get the codes. Can you help me?

What was the distance when you tried?
Can you see led pulsing on your camera (with this last code)?
Are you using 940nm led?

Distance was about 10-30cm.
Yes, I checked the led with my phone camera, it sends the signal.
I don’t know if its 940nm, I pulled it out from an old air curtain remote.