Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Saartjie_69
#89162 Good day everyone

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
User avatar
By Saartjie_69
#90566 Good day who ever might come across this post.

A month after I made the original post, I think I've finally fixed the reset problems I had.
Heres what I did:

1. Ive added an extra 100nf ceramic caps to my circuit, so there is one close to the Vcc and GND pins of the esp8266 and a second one just after the 3.3v regulator.

2. one of my Esp8266s is running my aquaponics system, but ive converted the aquaponics to run of 12v solar power. So now the esp8266 and its 3.3v regulator are powered via a 12v lead acid battery and a step down Buck converter (12v to 5v). This way the Esp8266 can pull all the power it needs from the battery without any problems.

3. THIS IS ALSO A VERY IMPORTANT ONE WHICH I THINK ARE OVERLOOKED: STABLE WIFI My aquaponics' esp8266 used to be connected to my home wifi, however after experimenting A LOT, I've found that when my family are also using the wifi, it becomes slow, causing esp8266 to freeze and then reseting itself.
So then I bought a 4g mobile wifi hotspot dongle with a simcard, which is providing internet ONLY for the esp8266. Since I did this, it never reseted again.

4. As I am using Telegram to control my Esp8266, I've tried reduced the network activity of the esp8266 by reducing how frequently the Esp8266 checks for incoming messages on Telegram. It checks once every minute.
My data consumption is about 5mb per day. This is just a trade off between data consumption, responsiveness to messages and network activity.

I hope someone might find this useful.