ESP32 Course Example: Module 4, Unit 2, ESP32 Web Server – Control Outputs:
The ESP32 works fine for a few minutes, but when I come back to the ESP32 Web Server several minutes later, it doesn’t respond on the webpage I used to connect with.
Do you have any suggestions as to why this is occurring?
Are you going to add a Unit to the course on Watchdog Timers?
Thank you for any assistance,
Joel
Hi Joel,
- How are you powering the ESP32 through a reliable and stable power source?
- Can you try let the Arduino IDE serial monitor open to print the error that occurs that makes the web server stop working?
- We don’t have any Units about watchdog timers at the moment…
Thanks!
Rui
Powered with the USB port on my computer running Windows 10.
I was using Chrome to access the web server when I had this problem. I switched to Microsoft Edge and now the web server works fine. Can anyone tell me why Chrome isn’t working with the ESP32 Web Server? Is there some setting in Chrome that needs to be changed?
Thanks for any advice,
Joel
Hum… It should work regardless of the web browser and in fact I only use Google Chrome. Did you leave the Google Chrome window open for a long time with the web server open? Did you see the error printed in the Arduino IDE serial monitor?
Thanks!
Hi
I have just completed a project using the ESP8266 which I imagine is similar to the ESP32. It appears to have a default time out of 2 hours. Powering the ESP8266 from a separate 5Volts the ESP8266 will continue to run no matter how many times the browser (Chrome) goes to sleep/switched off PROVIDED it is re-activated about every 2 hours. I am confident that my system is working as I use it to display elapsed time using the function millis( ). The html code was programmed to refresh every 5 seconds – it reached 95 million milli seconds before I went to sleep for greater than 2 hours!
JK
Thanks for providing additional details. Yes, most ESP8266 code should work on an ESP32.
Simply import the WiFi library for your ESP32 with:
#include <WiFi.h>
Instead of using the ESP8266WiFi:
#include <ESP8266WiFi.h>
Hi Rui Santos
I have been a bit slow at the course and only now did the web server interface module. Having the same issue with losing connection after a while. It seems as if the serial monitor also stops and the port gets lost at the same time. There is no way to find the reason that way. My ESP32 board type is a ESP-DEV board. Could there possibly be a way to detect in the sketch program when connection is lost and the re-start it?
Chris
Could I retract an earlier statement and add some explanation:
“…………. if the browser ever closed down for any length of time (eg greater than two hours such as the PC being switched off for the night) the system failed to recover. This is possibly due to the time out on the ESP8266.”
I gave some investigation to that issue. The data sheet indicates that the ESP8266 timeout could be set to up to 7200 seconds (2 hours) so that led me to believe the above statement of the system failing after 2 hours was sensible.
However including the following code Serial.println(“AT+CIPSTO?”) indicated that the default factory setting was 180 seconds or 3 minutes well short of 2 hours.
At this point it was assumed that the ESP8266 was being interrogated by neighbours’ computers. When they went off for the night the ESP8266 timed out. It was nothing to do with my browser not requesting a response after two hours – it was to do with the whole spectrum of computers in range “closing down”.
This result does highlight an issue with testing – it appears that the results will be different between an area heavily populated with computers and a remote area. Testing this system in the city it will work but if it was to go in the middle of the Simpson Desert to advise the next traveller of the status of the next waterhole the situation could be drastically different.
The data sheet indicates setting CIPSTO=0 there will be no time out. However the manual in red does not recommend that. It does not say why.
I cannot help as to what library routine handles CIPSTO- I wanted to understand the ESP8266 so have written my own libraries.
JK
Hi @John Kneen, I think there’s a misunderstanding and please create a new thread here, if you need help with the ESP8266: https://rntlab.com/ask-question/
Basically, after flashing the ESP32/ESP8266 with Arduino IDE sketch, the AT firmware that was originally running is erased, so if you send those AT commands, they won’t wrong/they will be ignored. Regards,
Rui
Hello @Chris Coetser,
- How are you powering the ESP32 through a reliable and stable power source?
- Which web browser are you using (Google Chrome?)?
- Did you leave the web browser window open?
Regards,
Rui
Hi Rui
I am powering it from 1.) Laptop USB 2.) 3.3V LiFeP04 cell 3500mA at Vin and grd pins with same results. I use Google Chrome in windows 10. I have tried on Windows 7 with same results. Yes I did leave web browser window open. After a while it stops working. As soon as I press EN it works again.
I plan to switch on/off my house security lighting through static relay using my smartphone if I can make this reliable.
Cheers
Chris
If you close the web browser window, does it also close the ESP32 web server connection properly?
Yes it does. “waiting for new client”
I have opened a new question on this error message from the serial monitor. I think it has to do with ESP32 memory but I am still a newby 🙂
E (220) spi RAM enabled but initialisation failed. bailing out
Cheers
Chris
Hello @Chris Coetser, @John Kneen, and @Joel Farnham,
I was able to find a solution for the “new client” error. The web server should now be stable and no longer crash with the second client on Google Chrome. Here’s how to fix your web server:
https://rntlab.com/question/solved-esp32-web-server-drops-connection-crashes/
Please continue the discussion in the new thread (or create a new one), if that solution doesn’t work for any of you.
Thanks!