I have two nodeMCU boards, one from LoLin ( and one from Amica ( 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.begin(SSID, PASSWORD);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    myBlink(LED_PIN, 20, 100);

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 (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.

  • 1
    By "broken" you mean that even ping doesn't work? Or it's just access to MQTT broker? What show your broker logs? – user31481 Nov 14 '17 at 22:22
  • 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

My bad!

Although my symptoms were consistent with WiFi interference, the interference was actually at the MQTT level.

The root cause was that I hadn't realised that each MQTT client must have a unique client ID. When the 2nd nodeMCU connected, it disconnected the first nodeMCU from MQTT, which then went into a reboot sequence to recover, which then returned the favour to the other nodeMCU.

  • Please, acept your answer to close the question. – user31481 Nov 15 '17 at 15:27
  • I can only do that after 24 hours. Thanks for the hint to the solution. – pinoyyid Nov 15 '17 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.