Closed mcpacific closed 3 years ago
Try with 27 or 26 for the receiver on ESP32, here is a schematic example: https://docs.openmqttgateway.com/setitup/rf.html#esp32-hardware-setup
I tried both 27 and 26, still nothing. I even tried different RF receivers... it's like it never becomes available.
I think I'm going to have to rack this one up as a defective receiver (actually all 5 in the box). I read on Amazon others had issues and I'll replace them from another supplier. Thank you 1technophile for your speedy reply!
Are you sure your emitter is emitting a compatible signal?
If you are not sure, you may build a setup with rcswitch and a simple sendDemo example for your tests.
1technophile, I assume you mean upload sendDemo to another ESP32 and see if the original ESP32 receives it, is that correct? That's what I've done and it still doesn't seem to receive anything. I purchased another set of 3 from a different vendor and none of them seem to be working either.
1technophile, I assume you mean upload sendDemo to another ESP32 and see if the original ESP32 receives it, is that correct?
Yes this is correct.
Could you post your sketch and pictures of your emitter and receiver setup?
My sendDemo sketch:
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(115200);
mySwitch.enableTransmit(27);
// Optional set protocol (default is 1, will work for most outlets)
// mySwitch.setProtocol(2);
// Optional set pulse length.
// mySwitch.setPulseLength(320);
// Optional set number of transmission repetitions.
// mySwitch.setRepeatTransmit(15);
}
void loop() {
/* See Example: TypeA_WithDIPSwitches */
mySwitch.switchOn("11111", "00010");
delay(1000);
mySwitch.switchOff("11111", "00010");
delay(1000);
/* Same switch as above, but using decimal code */
mySwitch.send(5393, 24);
delay(1000);
mySwitch.send(5396, 24);
delay(1000);
/* Same switch as above, but using binary code */
mySwitch.send("000000000001010100010001");
delay(1000);
mySwitch.send("000000000001010100010100");
delay(1000);
/* Same switch as above, but tri-state code */
mySwitch.sendTriState("00000FFF0F0F");
delay(1000);
mySwitch.sendTriState("00000FFF0FF0");
delay(1000);
delay(20000);
}
My ReceiveDemo_Advanced sketch:
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(115200);
mySwitch.enableReceive(27); // Receiver on interrupt 27
}
void loop() {
if (mySwitch.available()) {
output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
mySwitch.resetAvailable();
} else {
Serial.println("Not receiving.");
}
delay(5000);
}
Here are my pics of the setup.
I was finally able to get this to work. The problem was, there were multiple bad transmitters and receivers in each package from BOTH vendors.
I've loaded up ReceiveDemo_Advanced in my Arduino IDE and uploaded it to my DOIT ESP32 DevKit V1 board, but I can't seem to get it to work. I thought it would be best to use GPIO 4 or GDIO 23 but neither works. In fact, any interrupt I use doesn't seem to have an impact on the mySwitch.available() statement in the loop.
I included a serial output in the loop if mySwitch ever becomes available, but it does not:
Pressing buttons on the remote produces no output.