ESP8266 with 433mhz library...Problem while receiving signal
Posted: Wed Apr 10, 2019 12:41 am
Hi, i have been working on an iot project that i toggle 220v ac with a relay by internet connection and also 433 mhz rf connection. I send rf signals with a cheap wall transmitter. I use rfswitch (https://github.com/sui77/rc-switch) library in my iot project for rf connection. I use ESP-01 as mcu.
Problem:
When i short press (<0,5sec approx.) transmitter's button, usually i cannot receive the signal (i receive 1 of 5 maybe) but if i long press transmitter's button, i receive the signal everytime.
What have i tried:
- Same problem occures when i try that with a nodemcu (same library, same rf receiver and same sketch)
- Problem doesn't occure if i try the same on an arduino uno board (same library, same rf receiver and example receive sketches of the library)
- If i erase esp-01 and upload my sketch but dont set wifi credentials, there is no problem.
My researches:
- i am not an expert. But i think the problem is about interrupts of 433 mhz library. There is a github issue (https://github.com/sui77/rc-switch/issues/46) about adding ICACHE_RAM_ATTR to interrupt fuctions. And according to that issue, there is new lines of codes in the library in the new releases. But my problem continues.
- Then i realized that the problem is not only about rcswitch library. In an issue at arduino forum (https://forum.arduino.cc/index.php?topic=583166.0) i saw interrupts fail while wifi is enabled. I saw some discussions that if i disable interrupts before wifi connection fuctions and then enable them after those functions in the esp8266 wifi library, the problem may be solved. But i dont know how to... I know i call some wifi functions in my sketch an dalso some wifi fuctions are called during delays and after loop() is completed.
Do you have any idea what to do about my issue? Thanks in advance.
Problem:
When i short press (<0,5sec approx.) transmitter's button, usually i cannot receive the signal (i receive 1 of 5 maybe) but if i long press transmitter's button, i receive the signal everytime.
What have i tried:
- Same problem occures when i try that with a nodemcu (same library, same rf receiver and same sketch)
- Problem doesn't occure if i try the same on an arduino uno board (same library, same rf receiver and example receive sketches of the library)
- If i erase esp-01 and upload my sketch but dont set wifi credentials, there is no problem.
My researches:
- i am not an expert. But i think the problem is about interrupts of 433 mhz library. There is a github issue (https://github.com/sui77/rc-switch/issues/46) about adding ICACHE_RAM_ATTR to interrupt fuctions. And according to that issue, there is new lines of codes in the library in the new releases. But my problem continues.
- Then i realized that the problem is not only about rcswitch library. In an issue at arduino forum (https://forum.arduino.cc/index.php?topic=583166.0) i saw interrupts fail while wifi is enabled. I saw some discussions that if i disable interrupts before wifi connection fuctions and then enable them after those functions in the esp8266 wifi library, the problem may be solved. But i dont know how to... I know i call some wifi functions in my sketch an dalso some wifi fuctions are called during delays and after loop() is completed.
Do you have any idea what to do about my issue? Thanks in advance.