Arduino - Ir Communications over long rang?

Hello I was wondering g if it is possible to IR communication over long distance, up to 10ft may be. Just enough to turn on and off led's and relays?

josephchrzempiec:
Hello I was wondering g if it is possible to IR communication over long distance, up to 10ft may be. Just enough to turn on and off led's and relays?

For IR, 10 feet is not a long distance. My remote control uses IR to communicate with my TX, and works from 20 feet or more.

10ft (3 metres) is not far for IR if it's configured correctly, what IR LED and IR receiver are you using.

Hello all thanks for the information. The IR led's and emitter i have was from Radio shack before they closed down i have a few of them. like this one here. If this is the wrong ones what would be the better to use?

To help with improved range & false signal rejection use a 38kHz modulated IR signal and something like the VS1838B (here) to receive and decode the signal.

Thank you Riva

Hello Riva does this IR transmitters and receivers Vs1838B program the same way as the other IR ones? ones Because they look Different.

josephchrzempiec:
Hello Riva does this IR transmitters and receivers Vs1838B program the same way as the other IR ones? ones Because they look Different.

I don't know how your old ones were programmed but the easy way is to use an infrared library like this or this to both send and receive IR codes.
Because the IR receiver (Vs1838B) has internal circuitry to only pass a 38kHz carrier signal the IR LED needs to have it's output modulated at 38kHz as well.
Also an Arduino pin is not capable of delivering enough current to properly drive an IR LED so it's worth considering using a transistor to turn on/off the IR LED.
Adafruit have a nice article that describes the whole RX/TX method and shows how to wire the IR LED for best effect.

Hello i tried the Receiving side of the IR and that worked with a remote. But when i tried The IR transmitting I got nothing Not sure IF it's transmitting or not.

Edited: I finally got something to show up and i get some strange things on it.

Enabling IRin
Enabled IRin
4CB0FADF
4B0D9D45
A90
A90
A90
0
A90
0
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
A90
BC484DB
4B0D9D45
4B0D9D45
4B0D9D45
4B0D9D45
75F2B3F9

Using the default sketch below

Receiving

/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>
IRsend irsend;
int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  // In case the interrupt driver crashes on setup, give a clue
  // to the user what's going on.
  Serial.println("Enabling IRin");
  irrecv.enableIRIn(); // Start the receiver
  Serial.println("Enabled IRin");
}

void loop() {



  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  delay(1);
}

Sending:

/*
 * 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() {
	for (int i = 0; i < 3; i++) {
		irsend.sendSony(0xa90, 12);
		delay(40);
	}
	delay(5000); //5 second delay between each signal burst
}

Did you have the IR LED connected to the correct Arduino pin, connected the correct way round and with a current limiting resistor?
The output you posted above seem to show the A90 being sent by the sending demo and the other codes look like they are from a normal remote control signal.
It might be worth trying one of the newer IR libraries as well to see if they offer better performance.

The a90 is feom receiving serial monitoring not transmitting. The transmitting should send out 0x90. From some of the examples i found they say to put a 100ohm resistor in the transmitting led. Was thst wrong?

This is all about long range, right? The range you get depends on how bright the IR led shines.

Putting a 100 ohm resistor in series with the led will protect your Arduino but make the led dimmer and reduce its range.

I experimented with a 330 ohm resistance in series and I had to point the rounded end of the emitter at the receiver no more than 1 cm away (yes, 1 CENTIMETRE!) before I got reliable reception.

You need an amplifying circuit:

An ordinary telly remote transmits across the 30ft diagonal of my living-room.

10 ft should be a doddle.

josephchrzempiec:
The a90 is feom receiving serial monitoring not transmitting. The transmitting should send out 0x90. From some of the examples i found they say to put a 100ohm resistor in the transmitting led. Was thst wrong?

The transmitter is sending 0xA90 in the example you posted (irsend.sendSony(0xa90, 12):wink: so the result is correct.
kayel has pointed out in #11 what I said about in #7 that to get good range you need to power the IR LED from a source that can deliver a higher current than an Arduino pin can deliver.

Hello thank you but I'm trying to get as much range as i can.

Riva So that is why In some of the examples i see people using a Transistor like a 2n2222. I guess it is to make it work?

josephchrzempiec:
Riva So that is why In some of the examples i see people using a Transistor like a 2n2222. I guess it is to make it work?

Yes. The Arduino I/O pin can only deliver a max of 40mA but better to stay below 20mA else the pin will be damaged over time.
Depending on what IR LED your using it may be able to handle about 100mA continuous current so a lot more power/range that the Arduino pin can deliver.
Another thing to note is IR covers a range of frequencies and it's best to ensure the IR sender/receivers are using the same frequency else this will reduce range or stop them working together.

Riva let me ask you a question. On the IR transmitting LED i know the further Transmitter is the less the receivers sees that transmitting LED?

josephchrzempiec:
Riva let me ask you a question. On the IR transmitting LED i know the further Transmitter is the less the receivers sees that transmitting LED?

If I'm understanding you correctly then yes. IR intensity at the receiver drops off using the inverse square law.

interesting. Okay here my problem my problem with my project. I know there is other ways of doing this. But I'm building a IR communications between two arduino. The problem is I need to figure out how far from the Transmitting arduino to the Receiving arduino. I Don't know how to figure out far they are apart from each other or If the transmitter IR is to the left a little of the receiver Basic more like tracking i guess you can say.

Finding out how far apart they are using IR intensity will be a difficult thing to do properly but to overcome the direction problem you can drive multiple IR LED's from a transistor so the signal sends in all directions. To reduce power you could also drive just a quadrant at a time and when you get a reply your pointing in the right direction.

Something like the below image but all the way round instead of just half a circle.