• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

wemos d1 : project loads but webserver does not function

Q&A Forum › Category: ESP8266 › wemos d1 : project loads but webserver does not function
0 Vote Up Vote Down
José Seminario asked 1 month ago

Hi, I\’ve built a webserver on an ESP8266 Wemos D1, with Thonny and the sketch in \”ESP32/ESP8266 Micropython Web Server- Control Outputs\”
The server connects with the WLAN, gets the demand from the browser and then hangs.
The console shows: Connection successful(\’192.168.18.146\’, \’255.255.255.0\’, \’192.168.18.1\’, \’192.168.18.1\’)Got a connection from (\’192.168.18.176\’, 51708)Content = b\’GET / HTTP/1.1\\r\\nHost: 192.168.18.146\\r\\nConnection: keep-alive\\r\\nCache-Control:                          max-age=0\\r\\nDNT: 1\\r\\nUpgrade-Insecure-Requests: 1\\r\\nAccept:                      text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\\r\\nAccept-Encoding: gzip, deflate\\r\\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 LikeWise/95.6.2265.66\\r\\nAccept-Language: es-ES,es;q=0.9,de-DE;q=0.8,de;q=0.7,fr-FR;q=0.6,fr;q=0.5,eu-ES;q=0.4,\’Got a connection from (\’192.168.18.176\’, 51710)
It does repeat it several times
When I stop the back end I get the following message
Traceback (most recent call last): File \”main.py\”, line 23, in <module>
Being line 23 : conn, addr = s.accept()>
On the browser I get:           ERR_CONNECTION_RESET
I’d really appreciate any help. Thank you.  

Question Tags: Esp8266 web server, MicroPython, Thonny
10 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 month ago

Hi.
What is exaclty the code tat you’re trying to run? Can you share a link? We have several micropython web server projects…
Regards,
Sara

0 Vote Up Vote Down
José Seminario answered 1 month ago

´Thank you for your quick answer.
This is the page where I took the code from

ESP32/ESP8266 MicroPython Web Server – Control Outputs


I have to add that I assigned a fixed IP address to the ·ESP8266 and allowed it in the firewall.
Now one in four attempts I get the page requested on the computer but I haven’t been able of getting it on the mobile phone. On the computer, I’ve been able even to click on the buttons, but not to get a new page.
Thank you.
 
 
 

0 Vote Up Vote Down
Sara Santos Staff answered 1 month ago

Hi.
I’m sorry for taking so long to get back to you. I was out of the office during the last few days with little access to the internet.
Are you trying to open the web page on different devices at the same time?
If you’re trying it on your smartphone, I recommend closing the browser on your computer first.
Regards,
Sara

0 Vote Up Vote Down
José Seminario answered 4 weeks ago

Hi Sara, 
Don’t worry, it’s been a quite busy week for me too.
I’ve tried connecting only with the laptop. I only get the name on the browser tab: ESP Web Sever, and a blank page.
I’ve taken the ESP8266 closer to de AP but it doesn’t make any difference.
When looking for APs with my laptop I can find the one of ESP8266.
Any further suggestions?
Thank you.

0 Vote Up Vote Down
Sara Santos Staff answered 4 weeks ago

Do you have another ESP8266 to experiment with that is not a wemos?
If you do, please check with another board.
Regards,
Sara

0 Vote Up Vote Down
José Seminario answered 3 weeks ago

Yes, I have tried with another Wemos D1 and with an ESP 32, with similar results. I have as well reloaded the firmware with the “erase” option ticked on. 
Regards
José

0 Vote Up Vote Down
Sara Santos Staff answered 3 weeks ago

Hi.
I just tested the project again and it is working.
If you have multiple tabs opened, it doesn’t work very well.
But if you just have one client opened at a time, it works as expected.  I tested it on my PC web browser and on my smartphone.
 
I’m not sure if it might be an issue with your connection because of the IP address and firewall…
 
Regards,
Sara

0 Vote Up Vote Down
José Seminario answered 3 weeks ago

You are right!
I had too many tabs open. I have tried fresh from my mobile and has answered instantly. When ticking one option it gets hanged and gives a blank page, but the status has changed, as I can see loading the page again. Why could happen that?
Anyway I am really happy with the advance and very grateful for your advice.
Regards
José  
 
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 weeks ago

Hi.
 
I’m not sure… In my case, the page doesn’t hang. Only if I have multiple clients open.
 
A workaround to this issue is to use a non-blocking code for the webserver using uasyncio, for example: https://docs.micropython.org/en/latest/library/uasyncio.html
Unfortunately, I don’t have any example with uasyncio.
 
I found this library that combines uasyncio with web server features: https://github.com/belyalov/tinyweb
 
I hope this helps.
Regards,
Sara

0 Vote Up Vote Down
José Seminario answered 2 weeks ago

Thank you so much, Sara, for your help. I’ll give it a try the way you’ve pointed me out.
Regards.
José

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.