Wemos D1 mini wrong IP

I try to connect Wemos D1 mini to my new router. In the router i see it with a valid IP address 192.168.1.213.
But in the serial monitor i see only endless dots and after a while a wrong IP address 194.254.220.0. The code is simple because i try to track the problem. With my older router it worked fine. All other wifi appliances works without error only the Wemos broken after the change of the router.

Do you have any suggestions?

#include <ESP8266WiFi.h>
 
// Set WiFi credentials
#define WIFI_SSID "ssid"
#define WIFI_PASS "pass"
 
void setup() {
  // Setup serial port
  Serial.begin(115200);
  Serial.println();
 
  // Begin WiFi
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
 
  // Connecting to WiFi...
  Serial.print("Connecting to ");
  Serial.print(WIFI_SSID);
  // Loop continuously while WiFi is not connected
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(100);
    Serial.print(".");
  }
 
  // Connected to WiFi
  Serial.println();
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());
 
}
 
void loop() {
  // put your main code here, to run repeatedly:
 
}

Does it print,

Connected! IP address: 

at least?

Can you copy and post the output?

Tried again to copy the serial output. The router shows the wemos immediately with a valid IP, but the serial is "dotting" ca. 4 minutes... These are the only things i see in the serial monitor.

17:46:24.665 -> ........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
17:50:05.260 -> Connected! IP address: 169.254.220.0

Have you pinged both addresses? Maybe the other address belongs to some other device...

Now i tried, here is the result:

PS C:\WINDOWS\system32> ping 169.254.220.0

Pinging 169.254.220.0 with 32 bytes of data:
Reply from 169.254.220.0: bytes=32 time=98ms TTL=255
Reply from 169.254.220.0: bytes=32 time=3ms TTL=255
Reply from 169.254.220.0: bytes=32 time=109ms TTL=255
Reply from 169.254.220.0: bytes=32 time=23ms TTL=255

Ping statistics for 169.254.220.0:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 3ms, Maximum = 109ms, Average = 58ms
PS C:\WINDOWS\system32> ping 192.168.1.213

Pinging 192.168.1.213 with 32 bytes of data:
Reply from 192.168.1.35: Destination host unreachable.
Reply from 192.168.1.35: Destination host unreachable.
Reply from 192.168.1.35: Destination host unreachable.
Reply from 192.168.1.35: Destination host unreachable.

Ping statistics for 192.168.1.213:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

I don't understand the different IPs in the second try. And don't understand the first try too, that the pings are working, because my valid IP range is 192.168.1.XXX.

Why did you ping on a different subnet? NM, I see now...

You said, though, that the router "sees" 192.168.1.213. Now it looks like that's not so.

Are you sure that your router uses 192.168.xx.xx ?

Try to ping 192.168.1.0

PS C:\WINDOWS\system32> ping 192.168.1.0

Pinging 192.168.1.0 with 32 bytes of data:
Reply from 192.168.1.35: Destination host unreachable.
Reply from 192.168.1.35: Destination host unreachable.
Reply from 192.168.1.35: Destination host unreachable.
Reply from 192.168.1.35: Destination host unreachable.

Ping statistics for 192.168.1.0:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

The 192.168.1.35 is my laptops IP i figured out.

When a device fails to communicate with the DHCP server, APIPA (Automatic Private IP Addressing) takes into effect and it will assign an IP address starting with 169.254 for the computer. Computers with an IP in this range (169.254.x.x) cannot see the network. The addresses only work on local networks, not the Internet.

Search on "ip address 169.254" for some reasons and possible solutions.

Thanks!

Now i checked the router, the IP above was bind to the Wemos MAC. I removed the binding and now the router doesn't shot the Wemos. So the problem is that my Wemos won't connect to my new router, but worked for months with the old. Every setting is copied from the old, so i don't understand.

I need to change some wifi settings maybe? Channel or something?

Edit: i changed the Channel Width from Auto to fixed 40MHz and it works... I never would have thought of that

Nor me. That is one of the weirdest fixes I've seen in a while...

Afterthought. When I see stuff like that, I always try reverting back to the previous settings, to see if something just got "fed" and the original settings work again.

Who gave that suggestion? Did you post your question elsewhere in this forum, or another forum?

Unfortunately it still doesn't work, I tried to reload the code and it wasn't connected then and it hasn't since.

I simply checked the router settings I remembered from the previous router and there I remembered that setting.

Try to rule out the router. Enable a hotspot on your phone and connect to it.

Thanks this is a great idea! Tried with the mobile hotspot and it has an IP in a few seconds...

19:14:58.909 -> ..........................
19:15:01.414 -> Connected! IP address: 192.168.43.128

So the problem is in my router, but what? Every other computer, phone, TV, IoT switch everything works but this one not.

Haha! But you did think of it! :grinning_face_with_smiling_eyes:

Ok, end of story, it's just a waste of time. If everything works, but one thing is not, then one thing is not good, not the other, so I'm looking for another solution.

Looking here, or somewhere else?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.