I am trying to connect 2 IR receiver on 2 different data pins of esp32, but at a time receiving data only on 1 pin. Please help.
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#define IR_RECEIVER_PIN1 16
#define IR_RECEIVER_PIN2 17
IRrecv irrecv1(IR_RECEIVER_PIN1);
IRrecv irrecv2(IR_RECEIVER_PIN2);
decode_results results1;
decode_results results2;
void setup() {
Serial.begin(115200);
irrecv1.enableIRIn(); // Start the IR receiver on pin1
irrecv2.enableIRIn(); // Start the IR receiver on pin2
}
void loop() {
if (irrecv1.decode(&results1)) {
Serial.print("IR Receiver 1 Value: ");
Serial.println(results1.value, HEX);
irrecv1.resume(); // Receive the next value
}
if (irrecv2.decode(&results2)) {
Serial.print("IR Receiver 2 Value: ");
Serial.println(results2.value, HEX);
irrecv2.resume(); // Receive the next value
}
delay(100); // Adjust the delay based on your requirements
}
Wiring is as below:
5v-VCC of ir of both receiver
GND-GND of both receiver
16- Data pin of receiver 1
17- data pin of receiver 2
Still not found any appropriate way to do this any kind of help will be appreciated.
Thanks in advance.
i am making a system where i require 2 ir receiver one signifying back and other front, and i want to receive data from both receivers on pin 16 and 17 of esp32 . I tried with code but at a time only 1 which is defined last is receiving only.
below is my code
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#define IR_RECEIVER_PIN1 16
#define IR_RECEIVER_PIN2 17
IRrecv irrecv1(IR_RECEIVER_PIN1);
IRrecv irrecv2(IR_RECEIVER_PIN2);
decode_results results1;
decode_results results2;
void setup() {
Serial.begin(115200);
irrecv1.enableIRIn(); // Start the IR receiver on pin1
irrecv2.enableIRIn(); // Start the IR receiver on pin2
}
void loop() {
if (irrecv1.decode(&results1)) {
Serial.print("IR Receiver 1 Value: ");
Serial.println(results1.value, HEX);
irrecv1.resume(); // Receive the next value
}
if (irrecv2.decode(&results2)) {
Serial.print("IR Receiver 2 Value: ");
Serial.println(results2.value, HEX);
irrecv2.resume(); // Receive the next value
}
delay(100); // Adjust the delay based on your requirements
}
Wiring is as below:
5v-VCC of ir of both receiver
GND-GND of both receiver
16- Data pin of receiver 1
17- data pin of receiver 2
any kind of lead on this project will be very helpful for me.
Thanks in advance
Does this library support multiple distinct IR capture sources?
No. It only supports a single IR signal source in order to reduce IRAM/ICACHE_FLASH_ATTR and memory usage. IRAM is a very limited resource on the ESP8266. It is used by Interrupt routines, which the IR receiving routines are.
You can however, connect multiple hardware IR demodulator units together in a circuit, and use them via a single input GPIO on your ESP, and it will typically work. However, you will not be able tell which IR demodulator received the signal.
ok I read that, I saw similar projects online and many people are working on same thing and there it is working, and unfortunately I am not able to find code or any hardware references for the same.
This is for an ESP32 and not the library you have been using.
They are using the RMT peripheral on ESP32 (initially designed for infrared communication but flexible enough to be repurposed for various signal types).
The ESP32 RMT has multiple channels available and each can operate independently as either a transmitter or a receiver. That’s how you can handle multiple receivers in parallel.
If you are not using an ESP32 this is not available to you, if you are using an ESP32 then use an RMT based library.
Hy, I read this documentation and other articles as well. But i am not able to figure out how can i use this for receiving purpose, If you have any idea on this then Can you help me with this?