I want to connect both 315MHz and 433Mhz transmit and receive modules to a ESP8266 with OpenMQTTGateway and have them working on both bands at the same time. But after checking the source code I found that seems like the RF module need to occupy two special pins rather than any. Is there a way so that I can do both? Thanks for answering!
Well I discovered that I can change the pin assigning. However after I tried using a 315 module to connect to the two receiving pin one after another, I found that the data output is quite random (usually publishes on 433ToMQTT topic, sometimes on 315ToMQTT). I searched a little bit and discovered that this is due to a centralized interrupt callback and the MCU cannot decide which pin triggered it. Until now I would give up and use only one frequency.
You are not the first to ask for this function, maybe whe should analyse this PR :
Thanks for your reply. Seems like it must be used with SparkIO Core, I might try to modify a standalone version of the library although the code seem a little bit complex.
OK I slightly modified the library to use it without Spark. It does allow to listen to multiple receivers, but you can only achieve that by stating multiple
enableReceive() rather than instantiate more than one
RCSwitch otherwise the ESP8266 would crash at any time. I made the example sketch to work and tested with my modules and transmitters. Now the only thing to do seems to be to add something like
ZgatewayRFMulti.ino so that only one instance of
RCSwitch is used to do the job.
This seems very interesting. Thanks for the researchs. Indeed maybe we should remove ZgatewayRF315, keep only RF one and adapt it to handle both frequencies with the same instance of RCSwitch.
Successfully modified the source code to adapt for two RF modules (just a quick and dirty hack for two input and output, not extensible) and passed test on breadboard. Available here. I have already made a custom PCB (clicking will open Chinese version of EasyEDA) for it, after receiving it I will do more real-life testing.