I'm using one IR Transmitter and two IR Receivers for people counting. IR Transmitter just sends a short burst of a 38kHz carrier signal to the two IR receivers.
How can I pair IR Transmitter and two IR Receivers, so IR Receivers accept only their pair(IR Transmitter)'s signal and ignores any other signals coming from other IR Transmitters?
I was thinking of sending some kind of code instead of just sensing 38kHz carrier signal, so IR Receivers listen only for that code. But, I don't know how to go about it, any help/direction would be appreciated!
I have tried using IRsendDemo and IRreceiveDemo from "File->examples->IRremote" but sending and receiving code is very slow, so not suitable for people counting.
Hi all~
I'm trying to use two IR Receivers for my project. But, as I discovered that IRremote library supports only one IR receiver.
Below is my source code, it works but both ir receivers sharing the same output which means only RECV_PIN_1 is recognized.
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN_1 = 10;
int RECV_PIN_2 = 11;
IRrecv irrecv1(RECV_PIN_1);
IRrecv irrecv2(RECV_PIN_2);
decode_results results1;
decode_results results2;
void setup()
{
Serial.begin(115200);
irrecv1.enableIRIn(); // Start the receiver
irrecv2.enableIRIn(); // Start the receiver
}
void loop() {
//send the incoming data over the serial port
if (irrecv1.decode(&results1)) {
Serial.print("sensor1: ");
Serial.println((results1.value));
irrecv1.resume(); // Receive the next value
}
if (irrecv2.decode(&results2)) {
Serial.print("sensor2: ");
Serial.println((results2.value));
irrecv2.resume(); // Receive the next value
}
// Serial.println("-----------------------------------------");
}
Does anyone have working source code for two IR receivers?
or, Is there any way to make it work with two IR receivers?
For people counting project, want to see them independently.
Do you know 3-pin IR receivers can be used in parallel.
No ,I don't. But I have 3 legged IR receivers in parallel but didn't work as expected.
I found modified IRremote library now it seems work.
But, my problem is now IR transmitter is sending "given message" about 20times per second where I want it to send even faster.
below source code is for IR transmitter
Hi all~
I'm using IR Transmitter and IR Receiver to send and receive simple message(for example just digit 10).
Below code sends digit '10' and on the other side IR receiver reads it.
The code sends digit '10' only 20 times per second where I want it to send faster. Is there any way to send it faster? Like 100 times per second?
You can remove the delay. Other then that you will have to change the library. I am not sure what protocol you are using but you can bypass that completely and do it yourself as you are not interested in headers etc.
Paul_KD7HB:
Why??????
Will your receiver be able to handle a non-standard protocol? Not likely.
Paul
Thanks for your comment!
I'm using IR sensors(one IR transmitter and two IR receivers) as a beam break sensor for people counting project. I get the human moving direction based on which IR Receiver is blocked first, so I can count IN and OUT for room occupancy. If I send just short burst of 38kHz carrier signal, it works like a charm with over 95% accuracy. The problem is that IR Receivers receives any IR signals, so if there is another IR transmitter near by the 'People counting' logic doesn't work.
gilshultz:
You can remove the delay. Other then that you will have to change the library. I am not sure what protocol you are using but you can bypass that completely and do it yourself as you are not interested in headers etc.
Thanks for your comment!
Without delay, IR receivers sees transmitted signal as a one long signal.
Is there any other library I can use other than IRremote?
Wawa:
Why not send a continuous 38kHz IR signal, and just detect HIGH/LOW output of the 3-pin receiver.
So no IR transmit/receive code, no library.
Search for "beam break" and/or "tripwire" on this site (top of this page).
Leo..
Thanks for your comment!
If I send continuous 38kHz IR signal, it works like a charm with over 95% accuracy. The problem is that IR Receivers receives any IR signals, so if there is another IR transmitter near by the 'People counting' logic doesn't work.
I was able to use two IR receivers using "Modified IRremote" libray, but the problem is that, IR sensors communicate(send and receive signals) only 20times per second where I want it to communicate faster so it won't miss the passing object
The IR LED as well as the IR receiver should see each other through small (~2-3cm long, ~5mm diameter) tubes, black on the inside. Then stray IR signals from reflections and/or other devices shouldn't be a problem.
For continuous IR, special receivers should be used (different/no automatic gain).
Like the TSSP38 (not the TSOP38).
Generating a continuous 38kHz transmit signal can be done in setup().
void setup() {
pinMode (11, OUTPUT); // IR transmitter LED with 100ohm (minimum) CL resistor on pin 11
TCCR2A = _BV (COM2A0) | _BV(WGM21);
TCCR2B = _BV (CS20);
OCR2A = 209; // 209 = ~38kHz
}
void loop() {
}
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.
Continued cross posting could result in a time out from the forum.
The IR LED as well as the IR receiver should see each other through small (~2-3cm long, ~5mm diameter) tubes, black on the inside. Then stray IR signals from reflections and/or other devices shouldn't be a problem.
For continuous IR, special receivers should be used (different/no automatic gain).
Like the TSSP38 (not the TSOP38).
Generating a continuous 38kHz transmit signal can be done in setup().
void setup() {
pinMode (11, OUTPUT); // IR transmitter LED with 100ohm (minimum) CL resistor on pin 11
TCCR2A = _BV (COM2A0) | _BV(WGM21);
TCCR2B = _BV (CS20);
OCR2A = 209; // 209 = ~38kHz
}
void loop() {
}
Thanks for your comment Leo, again!
Paul also suggested using tubes and I am gonna try it today.
Do you have any idea why the inside of the tube should be black?
I'm using special receivers for continuous IR.
Following is the code I'm using for sending continuous 38kHz signal.
Wawa:
Should we guess? Link please.
Shouldn't that tone function be in setup()?
I have tested with different IR receivers, this was the only IR that receives continuous signal https://www.devicemart.co.kr/goods/view?no=7641
tone() works in loop, too.
I have bought a people counting device which I want to make same. I don't know how they paired Tx and Rx, it receives signal only sent by its pair.
I have been trying to use for pairing but so far no luck. There should be something other than for infrared communication.