This is my first post so bear with me please.
The Problem:
I have two identical ESP 8266 - 07 versions which I am using to switch water pumps on/off with Telegram (its for free), both running the same code but on two different WIFI networks. I found that the ESPs would do random resets (sometimes 3 hours but mostly a day or three after previous reset or startup) and I am suspecting it might be related to slow internet or Telegram.
What I fixed already:
I did fix the notorious hardware and software issues that cause common ESP resets i.e. power supplies, sufficient capacitors, delay(1) every where, yield() everywhere, ESP.wdtFeed, no Serial.print/ln, I increased wdt timer from default 1 second to 4 seconds, I dont have endless while() loops and I even replaced all Strings to Char functions to prevent fragmenting the heap memory. I CONFIRMED there are no memory leaks.
My WIFI SSID and Password is placed in a separate header file.
Why do I think it is Wifi or Telegram related:
1.) The first ESP, which gives the most problems, are connected to my dads small bussiness WIFI network ( Uncapped @~512kbs, runs five computers, a printer and two or three cellphones). Resets occur from 4 times to sometimes 10 times during a single working week, Mondays to Fridays. Over weekends the ESP is the only device on the network and runs smoothly, it turns timers on and off, check the pump pressure level and it sends all the info to my phone over Telegram to my phone.
2.) The send ESP (same model as the first), runs the same code from my home network (Capped @~1 or 2mbs). During the week days this ESP along with one computer on sleep is connected to the WIFI. However, in the evenings when every one at home is on social media or in the mornings before works this ESP tend to resets itself. Once everyone is gone the ESP is fine.
3.) 99% of the time these resets happens 5 to 10 minutes after the ESP uses the Wifi to sent a message to my phone.
4.) Today at 1pm it switch the water pump on, 8 minutes after I recieved the message it performed a reset.
My question:
Is this a build-in feature for the ESP to reset when the Wifi is slow or is this related to Telegram? I did use "bot.longPoll = 10;" to keep the ESP litening for commands from my phones Telegram.
Is this wifi related? If so, how can I overcome this? I do have a "WifiReconnect()" function, similar to many examples found online, however if the ESP loses connection, its blue status light would start to flicker (This never happens during the times I was nearby while it resets.
Should I used "delay()" between messages the ESP sends to my phone?
Notes: I didnt post the code for security reasons and as I sell the specific code I wrote.
Also, I dont know what the error on Serial monitor output is during the resets, as I cant leave my computer connected to the ESP for 3 or four days.
Did anyone else experience something similar? Is this a slow internet problem?
I would appreciate any feedback.
Thanks in advance
Saartjie_69