IR Control not working

Hey :slight_smile:
I am currently working on my very first small project.
I'm trying to control an LED strip via IR, my plan was/is to save the signal from the remote control and then send it via the Arduino.
However, I've been stuck for two days and unfortunately, I don't know what the problem is :/.
I have already managed to capture the signal:
“Protocol=NEC Address=0x0 Command=0x45 Raw-Data=0xBA45FF00 32 bits LSB first”

However, sending simply does not work. I can see with my cell phone camera that the LED goes on and off (and if I connect a “normal” LED, it also goes on and off), but the LED strip that I want to control remains off.
I have also tried it with the TV and even holding it directly to it.

I've attached a picture of the approximate setup, unfortunately not the best, as I've never done anything like this before ^^
Please note that the resistance is 100 Ohm and the board I am using is an Elego UNO R3

The funny thing is, when I run the code here I get the answer
“Protocol=Onkyo Address=0x0 Command=0xA200 Raw-Data=0xA2000000 32 bits LSB first”. But isn't that completely wrong? But I also don't know if my idea of sending and receiving at the same time works.

Hope someone can help me somehow, because I am neither an expert nor do I know what else I can try.

#include <IRremote.hpp>

#define IR_SEND_PIN 7
#define IR_RECEIVE_PIN 3
IRsend irsend; 

void setup() {
  Serial.begin(9600); 
  irsend.begin(IR_SEND_PIN); 
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);  
}

void loop() {
  if (IrReceiver.decode()) {
    IrReceiver.printIRResultShort(&Serial);
    IrReceiver.resume();
  }
  delay(200);
  irsend.sendNEC(0x45, 32);
  
}

From this web site: Sending IR Codes | Using an Infrared Library on Arduino | Adafruit Learning System

Normally you would only need to call myReceiver.enableIRIn(); once in the setup routine but if you are both sending and receiving you have to call it after each send.

Some more IR stuff. IR Communication - SparkFun Learn

Tried that already, sadly doesnt help

How does it not help? What is lacking?

I still can not control any devices using the IRLED :confused:
Even if I just connect the IR-LED by itself and remove the IR-Reciever.
The LED lights up (which I can see with my camera) but nothing happens

I doubt that.

You should insert Serial.print(); statements in key places of your code to watch the flow... if it starts, what it sees, what it tries...

1 Like

Look in the source of sendNEC and tell us what the parameters mean.

I managed to get it working, but something really weird is happening.

I captured the following IR signal from the remote
Protocol=NEC Address=0x0 Command=0x45 Raw-Data=0xBA45FF00 32 bits LSB first.

However, when I used the following code to send the signal:
irsend.sendNEC(0xBA45FF00, 32);

The receiver returned this instead:
Protocol=NEC Address=0x5D Command=0xFF Raw-Data=0xFFA25D 32 bits LSB first

Even though I was explicitly sending 0xBA45FF00, the receiver interpreted it as something completely different.

As a test, I tried sending 0xFFA25D instead:
irsend.sendNEC(0xFFA25D, 32);

And surprisingly, the LED strip turned on! The receiver then reported this:
Protocol=NEC Address=0x0 Command=0x45 Raw-Data=0xBA45FF00 32 bits LSB first.

So basically:

  • Sending 0xBA45FF00 gets interpreted as 0xFFA25D.
  • Sending 0xFFA25D results in the correct signal, interpreted as 0xBA45FF00.

The code I used now is this one:

#include <IRremote.hpp>

#define IR_SEND_PIN 7
#define IR_RECEIVE_PIN 3
IRsend irsend; 

void setup() {
  Serial.begin(9600); 
  irsend.begin(IR_SEND_PIN); 
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);  
}

void loop() {
  if (IrReceiver.decode()) {
    IrReceiver.printIRResultShort(&Serial);
    IrReceiver.resume();
  }
  delay(200);
  irsend.sendNEC(0xFFA25D, 32);

}

However, the question still is, why is this happening lol

BA45FF is FFA25D backwards.
I don't know why there is this confusion, read the documentation about new and old version:

Maybe you should uninstall all IRremote libraries and reinstall the new one...

Edit:
You are using the send syntax from old library, you should use IrSender.sendNEC....

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.