IR Remote Control

Hi everyone,
I'm trying to use arduino and an IR Led to turn my AC on and off.
I've managed to find the remote code and protocol and yet when i'm trying to use the led to transmit and turn on/off the ac nothing happend.
I double checked the code: Using TSOP sensor i got the same code from the AC original remote and also from my phone using AC remote application.
One more important thing: Using the same circuit, i can turn on/off my tv, even from far distance.

Maybe the LED dont get enough current? what do u think?

This is the circuit i'm using:

arduino pin 3 ----> 100 ohm resistor ---> IR Led ----> GND

the code im using for the transmitter:

/*
 * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */


#include <IRremote.h>

IRsend irsend;

void setup()
{
}

void loop() {
  // Turn ON
	for (int i = 0; i < 3; i++) {
		irsend.sendNEC(3499099658, 32);
		delay(40);
	}
	delay(5000); //5 second delay between each signal burst

  // Turn OFF
  for (int i = 0; i < 3; i++) {
    irsend.sendNEC(2147484682, 32);
    delay(40);
  }
  delay(5000); //5 second delay between each signal burst
}

The codes i've got from th original remote using the receiver:

Pressing on ON button:

Encoding  : NEC
Code      : 98DD060A (32 bits)
Timing[73]: 
     +8850, -4400     + 600, -1650     + 600, - 600     + 600, - 550
     + 600, -1650     + 650, -1600     + 650, - 550     + 600, - 600
     + 600, - 550     + 650, -1650     + 600, -1650     + 600, - 550
     + 650, -1650     + 600, -1650     + 600, -1650     + 600, - 600
     + 600, -1650     + 600, - 550     + 650, - 550     + 600, - 600
     + 600, - 600     + 600, - 550     + 600, -1650     + 600, -1650
     + 650, - 550     + 600, - 600     + 600, - 550     + 650, - 550
     + 600, - 550     + 650, -1650     + 600, - 550     + 650, -1600
     + 650, - 550     + 600, - 600     + 600, -1650     + 600, - 600
     + 600
unsigned int  rawData[73] = {8850,4400, 600,1650, 600,600, 600,550, 600,1650, 650,1600, 650,550, 600,600, 600,550, 650,1650, 600,1650, 600,550, 650,1650, 600,1650, 600,1650, 600,600, 600,1650, 600,550, 650,550, 600,600, 600,600, 600,550, 600,1650, 600,1650, 650,550, 600,600, 600,550, 650,550, 600,550, 650,1650, 600,550, 650,1600, 650,550, 600,600, 600,1650, 600,600, 600};  // NEC 98DD060A
unsigned int  data = 0x98DD060A;

Pressing on OFF button:

Encoding  : NEC
Code      : 88DD040A (32 bits)
Timing[73]: 
     +8800, -4400     + 650, -1650     + 600, - 550     + 650, - 550
     + 600, - 550     + 650, -1650     + 600, - 550     + 650, - 550
     + 650, - 500     + 650, -1650     + 600, -1650     + 600, - 600
     + 600, -1650     + 600, -1650     + 600, -1650     + 600, - 600
     + 600, -1650     + 600, - 600     + 600, - 550     + 650, - 550
     + 600, - 550     + 650, - 600     + 550, -1650     + 650, - 600
     + 550, - 600     + 600, - 550     + 650, - 550     + 600, - 550
     + 650, - 550     + 650, -1600     + 650, - 550     + 600, -1650
     + 600, - 600     + 600, - 550     + 650, -1650     + 600, - 550
     + 650
unsigned int  rawData[73] = {8800,4400, 650,1650, 600,550, 650,550, 600,550, 650,1650, 600,550, 650,550, 650,500, 650,1650, 600,1650, 600,600, 600,1650, 600,1650, 600,1650, 600,600, 600,1650, 600,600, 600,550, 650,550, 600,550, 650,600, 550,1650, 650,600, 550,600, 600,550, 650,550, 600,550, 650,550, 650,1600, 650,550, 600,1650, 600,600, 600,550, 650,1650, 600,550, 650};  // NEC 88DD040A
unsigned int  data = 0x88DD040A;

Well, if the Arduino circuit including an IR led is capable of turning your TV on and off, then there is nothing wrong with your circuit, the program or the the led. The only issue is whether the codes your are transmitting are correct for the A/C device.

You appear to receive this code for an 'on' from the original remote control:
98DD060A (HEX)

You appear to send this code for an 'on'
3499099658 (DEC) which translates to D090060A (HEX)

There is a discrepancy unless I have missed something.

Why do you have them in base 10 in the code anyway? The receiver sketch gives them to you in base 16, so just put them in the code that way using the 0x prefix.

Hi,
Thanks for your replies.
The code works with DEC base and turn it to HEX byitself.

If i try to send the HEX code thats what im getting:

IRsendDemo:21: error: unable to find numeric literal operator 'operator""DD060A'

   irsend.sendNEC(98DD060A , 32);

                  ^

exit status 1
unable to find numeric literal operator 'operator""DD060A'

One more important thing: The skecth turn my tv on and off using the DEC number.

The hex format is:

0x98DD060A

or, if you prefer decimal:

2564621834

Thanks for the replies.
Still not working..
Tried HEX and DEC but nothing happend.
meanwhile, I did managed to turn on/off more devices at home, and still the AC giving me a hard time.
anyone else have any idea?

When you connected a TSOP IR Receiver to your Arduino, which exact TSOP did you use ? These can have different carrier frequencies. Important is that it compatible with the one in your A/C for a valid test.

When you used the application on your smartphone and tested it with the Arduino together with the TSOP, did you get exactly the same codes as you have shown in your first post as for the original remote control of the A/C?

I'm not sure the NEC protocol specifies that each message must be transmitted 3 times with a 40 mS pause. Try altering the delay(40); to delay(5000); just to see if that helps.

You could try sending the RAW version to see if that helps. Perhaps the signal isn't really 32 bits but more like 35 bits. The sendNEC() probably can't send more than 32 bits.

Hi,
i tried to send the RAW version - nothing happend.
about the frequency and the bits, i tried to send the codes with my phone app, because i thought maybe the arduino cant deliver enough current. the tv and more devices turn on/off with 30, 34, 38, 30 and 56 kHz with the code i got from the receiver, but the AC not.
I dont have much ideas anymore, expect breaking the remote and look inside.
by the way, this is the remote:

YT1F

irsend.sendNEC(0x98DD060A , 32);

Hexadecimal constants are prefixed with 0x-.

Instead of saying "I tried HEX and DEC", post the actual modifications you tried. Both the On and Off numbers in your original transmitter sketch do not match the numbers from your receiver sketch. You are making several errors, and playing fast and loose with reporting your troubleshooting steps is just wasting everyone's time. I have 0 confidence that when you "tried HEX" you did it correctly, but I can't tell you what you did wrong because I don't know what you changed.