Help with IR

I have recently acquired an arduino for a project I am working on. I have a drone that has an infrared output in order to battle other drones. I would like to make a ground target to attack for practice. I have made a simple target using some LED's and a TSOP IR receiver, but it reacts to any IR input and I'd like it to react only to the drones IR output.

I have followed some tutorials and captured the following IR data:

For IR Scope: +5400 -1000 +950 -500 +450 -550 +450 -500 +500 -500 +500 -950 +1000 -500 +500 -500 +450 -500 +500 -500 +450 -500 +5400 -1000 +950 -500 +500 -500 +500 -500 +500 -450 +500 -1000 +1000 -450 +500 -500 +500 -450 +500 -500 +500 -450 +5450 -950 +1000 -450 +500 -500 +500 -450 +550 -450 +500 -950 +1000 -500 +500 -450 +550 -450 +500 -500 +500 -450 +5450 -950 +1000 -450 +500 -500 +500 -450 +550 -450 +500 -950 +1000 -500 +500 -450 +550 -450 +500 -500 +500 -450 +5400 -1000 +1000 -450 +500 -500 +500 -450 +500 -500 +500 For Arduino sketch: unsigned int raw[100] = {5400,1000,950,500,450,550,450,500,500,500,500,950,1000,500,500,500,450,500,500,500,450,500,5400,1000,950,500,500,500,500,500,500,450,500,1000,1000,450,500,500,500,450,500,500,500,450,5450,950,1000,450,500,500,500,450,550,450,500,950,1000,500,500,450,550,450,500,500,500,450,5450,950,1000,450,500,500,500,450,550,450,500,950,1000,500,500,450,550,450,500,500,500,450,5400,1000,1000,450,500,500,500,450,500,500,500,}; irsend.sendRaw(raw,100,38);

I am having problems finding a method by which I can put this in to a Sketch in order to have the UNO flash an LED on when it receives this IR input. Anyone know a decent tutorial to get me started?

TwigMortal: but it reacts to any IR input and I'd like it to react only to the drones IR output.

What other IR inputs are there that it might be reacting to?

You have not told us what all those numbers represent.

It would also be a good idea to post the program that produced those numbers - then we may be able to get a little closer to the knowledge that you already have.

...R

Robin, my original 'target' was a 'dumb' one. It had only the TSOP sensor attached to some output LED's (and resistors). When an IR signal was detected the LEDs flash, but that means it responds to any signal at 38khz, such as a tv remote control.

What I want to do is use the UNO to detect the incoming IR signal, decide if it is the correct one from the drone and not a tv remote, then signal on an LED to identify a hit.

The sketch used to pick up the drones raw IR signal data was taken from this video/tutorial: https://www.youtube.com/watch?v=rehedYV-qEE

The numbers represent the raw data captured and number of bits and frequency (so as I understand it 100 bits at 38 khz).

TwigMortal: The sketch used to pick up the drones raw IR signal data was taken from this video/tutorial: https://www.youtube.com/watch?v=rehedYV-qEE

That is the program I asked you to post.

...R

// If one keypress results in multiple codes being output, then
// change in IRremoteInt.h:
// #define _GAP 50000
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}
int c = 1;
void dump(decode_results *results) {
  int count = results->rawlen;
  Serial.println(c);
  c++;
  Serial.println("For IR Scope: ");
  for (int i = 1; i < count; i++) {
   
    if ((i % 2) == 1) {
      Serial.print("+");
      Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
    }
    else {
      Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
    }
    Serial.print(" ");
  }
  Serial.println("");
  Serial.println("For Arduino sketch: ");
  Serial.print("unsigned int raw[");
  Serial.print(count, DEC);
  Serial.print("] = {");
  for (int i = 1; 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.print("};");
  Serial.println("");
  Serial.print("irsend.sendRaw(raw,");
  Serial.print(count, DEC);
  Serial.print(",38);");
  Serial.println("");
  Serial.println("");
}
void loop() {
  if (irrecv.decode(&results)) {
    dump(&results);
    irrecv.resume(); // Receive the next value
  }
}

Now post a link to where you got the IRemote library and its documentation.

When an IR signal was detected the LEDs flash, but that means it responds to any signal at 38khz, such as a tv remote control.

It is not going to be possible to prevent a TSOP sensor from picking up other IR signals. All you can do is analyse the data that you received and you may be able to decide whether the received data came from your drone or from something else. But the presence of "something else" may cause the data to be garbled.

Really, you need to operate the drone where there is no possibility of other IR signals.

...R

You seem to get transmissions of 11 bits. Why don't you use the IRrecvDump example, coming with the IRremote library, to find out more about the protocol and received command?