Pages: [1]   Go Down
Author Topic: How to use 2 IR receivers ?  (Read 1522 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I need to be able to read some IR signals at two different physical points too far from each other to use the same receiver. See my ASCII drawing :


  0                                                                                                                 0
-+-                                                                                                              -+-
  |    <-3m->   IR recv1<-10m cable->[Arduino]<-10m cable->IR recv2   <-3m->         |
 /\    <------------------------------  ~26 meters  ------------------------------>  /\

As you can see, because of the distance between the two points, a single receiver can't work.
That's why I need a second receiver.
They won't receive a signal a the same time

How can I get this to work ?

NOTE : Ken Shirriff (IRRemote library) talked many months ago about "AND-ing" the output. It wasn't clear to me...

Thanks for your help.
« Last Edit: October 04, 2012, 07:26:07 am by delirii » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you wanna get this done reliably, use hardware on every receiver's end (an ATtiny should be enough) and use RS485 for the connection to the Arduino. If you don't wanna invest that much, use the best cable you can afford and connect it directly to your Arduino. If you wanna use the IRremote library you have to modify it quite extensively, but the principal functionality should work with multiple receivers.

ANDing the input is probably not what you want. If you put the two signal to an OR gate and then to one input pin. If you never have concurrent signals, this is just a if you just have one receiver but two remote controls sending signals. This is OK, if you don't need to distinguish between signals from one receiver and the other, but unusable if you need that information.

Do you have a reference to the ANDing output article from Ken Shirriff?
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 29
Posts: 2244
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The signal on the lines for a 38KHz receiver is only ~6KHz. I think you could get away with the cable lengths you're describing, or at least it would be worth a try to see if things run stably.


 
« Last Edit: October 05, 2012, 09:47:48 am by Chagrin » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, thanks for your answers.

First, here is the link mentioning the AND gate to couple two receiver :
http://arduino.cc/forum/index.php/topic,20794.msg153653.html#msg153653

The AND logic seems odd to me too, the OR is more what I'm looking for.
In fact, I don't need to know which receiver receives the signal, both will act exactly the same in my program. I just need two of them because of the distance between the two points.

My need could be satisfied with the OR gate solution. Could you please tell me more about this ? Should I choose a CMOS gate ? a particular model ? do I need something else to wire the whole thing ?

@Chagrin : do you need it won't work due to the cable length ? Should I try with a shielded cable ? What is the maximum cable length you think I can use ?

NOTE: I may be able to reduce the cable length this way:
each 10 meters cable may become 4 to 5 meters.


Is a RS485 based solution more robust ?

Thanks for your tips
« Last Edit: October 05, 2012, 05:37:41 am by delirii » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The AND logic seems odd to me too, the OR is more what I'm looking for.

The linked post from Ken tells the reason for the AND gate: the signal is active low. So if one of the two goes low, the output has to be low, an AND gate is doing exactly this.

Quote
Is a RS485 based solution more robust ?

Definitely, but it's also a lot more work. I agree with Chagrin, that testing the low cost version is worth a try.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So an AND gate is what I need to test the low cost version, right ?

If so, should I choose a TTL or CMOS gate ? Any model in particular (I've found this one for instance: CD4081 (http://www.alldatasheet.com/datasheet-pdf/pdf/50864/FAIRCHILD/CD4081.html)) ?
Do I need something else ? like some kind of (frequency) filter to remove noise from my signal?

Is a shielded cable worth the price in my case ?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So an AND gate is what I need to test the low cost version, right ?

Yes, that's right.

Quote
Any model in particular (I've found this one for instance: CD4081

I'm not the specialist in those things but I see no reason why a simple 7408 wouldn't do the job.

Quote
Is a shielded cable worth the price in my case ?

This depends a lot how electrically noisy your environment is. If in doubt and you can afford it, take the shielded version.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If you wanna use the IRremote library you have to modify it quite extensively,

Why ?

This is the code of one of the IRremote examples (dump function stripped down because it's long and not relevant here):

Code:
#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

// ...

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

Just by looking at this example I don't see why instantiating two IRremote objects each one on its own pin shouldn't work. (Of course there should be also two results variables...)
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why ?

Because the receiving part is not done in the object but in an interrupt service routine. The object constructor sets a global variable with the RECV_PIN parameter, so if you initialize a second object the first object's pin will be overwritten. The interface looks very object oriented but in fact only one object can be used.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your detailed and informative reply. smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to contribute to the knowledge base: I've tested with some 5 meters long cables, clearly not the best quality cables, and my (single for the moment) receiver works like a charm.
=> That's a good point!

I've have to try with a second receiver and a logical gate now (have to buy both before).
Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to contribute to the knowledge base: I've tested with some 5 meters long cables, clearly not the best quality cables, and my (single for the moment) receiver works like a charm.
=> That's a good point!
Where I work we had a Satellite box at one end of the building and someone who wanted to channel change it one floor down and at opposite side of building. We de-soldered the IR LED from the remote and placed it on about 50 meters of screened audio cable at the satellite box and it worked a charm. I would assume IR receiver would work just as well.
Logged

Handle every stressful situation like a dog. If you can't eat it or hump it. Piss on it and walk away.

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where I work we had a Satellite box at one end of the building and someone who wanted to channel change it one floor down and at opposite side of building. We de-soldered the IR LED from the remote and placed it on about 50 meters of screened audio cable at the satellite box and it worked a charm. I would assume IR receiver would work just as well.

That's even better. Thanks for sharing. If my logical gate does the trick, I'll solve my problem!
Logged

Pages: [1]   Go Up
Jump to: