-->
Page 1 of 2

ESP8266 NodeMCU deep sleep working ramdomly

PostPosted: Mon Jan 04, 2021 5:58 pm
by hellraiser
Hi folks,

I am fighting with an issue I am not able to solve by myself even after days of googling and testing.

I am trying to put my ESP into deep sleep without satisfying result. So I have this traditional measure, send and sleep routine. After I execute machine.deepsleep() command my ESP is waking up for a random number of times. So it can send 15 measures over mqtt or 50 measures, no pattern at all.

I've obviously connected D0 with RST, I tried 2 differernt power banks and power supply with the same result.

What is strange, when ESP stops sending data it should be in deep sleep (last command in log) but I can access it via rshell (when connected to rpi3 usb port). So I am totally confused :/

Any help much appreciated.

Re: ESP8266 NodeMCU deep sleep working ramdomly

PostPosted: Wed Jan 06, 2021 11:04 am
by urs_eppenberger
I do have some experience in this field. To give some advice I would need to have a look at your code.

Re: ESP8266 NodeMCU deep sleep working ramdomly

PostPosted: Wed Jan 06, 2021 6:59 pm
by hellraiser
Excellent. You can find my code under this link: https://pastebin.pl/view/171c0fa0

Re: ESP8266 NodeMCU deep sleep working ramdomly

PostPosted: Fri Jan 08, 2021 6:13 am
by schufti
for one thing I see, you are not in line with the randomnerdtutorial for deepsleep in µPython:
the example has "machine.deepsleep()" wherase you have "machine.deepsleep(msecs)"

so you maybe set up a wake event twice: once in lines 34-37 and second in line 41.
remark: for machine.deepsleep() a msec argument won't work as expected, it uses µsecs ...