So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By BjornJ
#90652 The ESP-01 module connects to the router and gets an IP, I can see it on the router page, but it will not accept incoming clients nor pings. I've tried two ESP modules, different ports, various "Tool" settings in Arduino IDE 1.8.13. Such a simple code, with examples on the web, should just work. It must be something stupid, but I have days into this problem. What is the problem?

Code: Select all#include <ESP8266WiFi.h>

const char *ssid = "XXXX";
const char *password = "yyyy";

ESP8266WiFiClass wifi;   // For printDiag()
WiFiServer server( 80 );

void setup() {
   Serial.begin( 74880 );   // Same as boot loader
   while( !Serial );
   WiFi.begin( ssid, password );
   Serial.print( "Connecting " );
   while( WiFi.status() != WL_CONNECTED ) {
      delay( 500 );
      Serial.print( "." );
   }
   Serial.println();

   Serial.print( "Connected to WiFi. IP: " );
   Serial.println( WiFi.localIP() );
   server.begin();
   wifi.printDiag( Serial );
}

void loop() {
   WiFiClient client = server.available();
   if( client ) {
      Serial.println( "Have pending client connection" );   // Never executes
      while( client.connected() ) {
         while( client.available() > 0 ) {
            char c = client.read();
            Serial.write( c );
         }
         delay( 10 );
      }
      client.stop();
      Serial.println( "Client disconnected" );
   }
}


The serial monitor output after module reset:
Code: Select all ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld
Connecting .
Connected to WiFi. IP: 192.168.0.26
Mode: STA+AP
PHY mode: N
Channel: 6
AP id: 0
Status: 5
Auto connect: 1
SSID (17): XXXX
Passphrase (30): yyyy
BSSID set: 0


Using Putty (Win10) to connect, set to Connection type: Raw. Also tried Telnet and Ubuntu command line, pinging.
After 20 sec or so it times out "Network error: Connection timed out"

Update: I discovered a diagnostics feature of my router where it can send pings. This works, the ESP responds within 2ms four times. It does not work from Win10 command line, "ping 192.168.0.26", nor from Ubuntu. Nothing I've tried can connect except the router's ping. Still stumped.
I can ping other devices on the LAN from command line, including other WiFi devices, just not the ESP-01.
User avatar
By BjornJ
#90656 I have been able to connect with some devices, but I need to connect with all. My ancient HP laptop can both ping and connect with Putty,

The following methods do not work:
  • Dell Win10 PC, wired. ping and Putty time out
  • Dell Win7 PC, wired, ping and Putty time out
  • Ubuntu 18.04 PC built from components, wired, ping and telnet time out

The following methods work:
  • HP Win7 laptop, Wi-Fi, ping and Putty work
  • Router's ping utility works
  • iPad Air, Wi-Fi, app Ping Lite works
The common thread here is Wi-Fi vs. wired client. The fact that I can ping other Wi-Fi devices, wired-to-Wi-Fi, seems to exonerate the router, but maybe not. It is specifically the ESP-01 modules that have problems.

I can see two possible causes.
    Software decay. This can be anywhere in the chain of software that need to be compatible with each other, starting with the Wi-Fi stack in ESP8266. The stack is perhaps hard-coded in the chip, like the boot loader that states the year 2013. Other points are the router firmware, the ESP8266 libraries that seems to not have been touched since 2015, and many others.
    Router problems. TP-Link Archer C2700, June 2019, firmware up to date but not maintained since 2019. This router was marked End-of-Life within months of its release. It was their first model featuring an Intel chipset. The web is mum on the reason why, no real product reviews based on actual use. In other aspects it is working well.
It would be great if you guys can point me in another direction, or what to do about the issue. I could dump the expensive, almost new router. Or I can dump the two ESP-01 modules, but what will I replace them with? I have a NodeMCU 1.0 kicking around, never put to use. It is almost as old as the ESP-01, using the same libraries, so...
User avatar
By BjornJ
#90668 Switching the laptop from Wi-Fi to Ethernet kills the connection, it now acts like the other Ethernet PCs. It seems that it is the router blocking the connection internally, but why just to the ESP-01? It must interact in a different way than the other Wi-Fi devices that I can ping.
I made a post on the TP-Link forums, but I am not holding my breath that there will be a solution.
Short of ditching my router, again, I could try an ESP-32 device. That would be cheaper, but no guarantees that it would work.
BTW, NodeMCU 1.0 has the same problem.