I have two nodeMCU boards, one from LoLin (192.168.1.52) and one from Amica (192.168.1.53). For each nodeMCU, I have mapped its MAC address to a fixed IP address using my Movistar WiFi router. I confirm from the serial monitor that each nodeMCU is being correctly assigned to the correct IP address
My sketch is a simple IoT/MQTT client.
My problem is that if I power up both nodeMCUs, the WiFi connection is broken on both.
The WiFi portion of my sketch is
void setup_wifi() {
Serial.println(" Booting..");
WiFi.mode(WIFI_STA);
WiFi.begin(SSID, PASSWORD);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
myBlink(LED_PIN, 20, 100);
delay(5000);
ESP.restart();
}
WiFi.printDiag(Serial);
Serial.println(WiFi.localIP());
}
The output is
Mode: STA PHY mode:
N Channel: 1
AP id: 0
Status: 5
Auto connect: 1
SSID (13): MOVISTAR_xxxx
Passphrase (20): 509A8EC4Exxxxxxxxx
BSSID set: 0
192.168.1.53 (or .52 on the other device)
I realise that the symptoms are consistent with clashing IP addresses, but to confirm, both the serial diagnostics and the DHCP report from my router confirm that the two devices are on different IP addresses.
I realise that the symptoms are consistent with clashing IP addresses
- how do you figure this, since they each output a different IP address - try staggering the power up times - does the problem persist? try having the units further apart - does the problem persist? – Jaromanda X Nov 15 '17 at 1:02