Please help! NODEMCU lose connection after WIFI reset

Hello friends, I’ve been playing OH2 for 3 months and it’s so fascinating!
My system consists of a raspberry pi 3 and bunch of NODEMCUs around my house,which rasberry pi 3 is OH2 broker and NODEMCUs are so-called “slaves” (or “nodes” whatsoever) and are connected to raspberry via my home WIFI network.

The only problem I’m facing is that whenever I reboot my raspberry or my router, which causes rasp’s IP address to change, those NODEMCUs lose connection because in the arduino code, I only gave a static fixed Rasp’s IP address for NODEMCUs to connect to, This is quite a nuisance because I have to re-upload the code whenever I reset raspberry or my home network.

Is there anyway to overcome this?
Please help! Thanks in advance!

You could reserve the IP for your rPi3 (based on MAC Address) on your DHCP server.
In this way, it won’t change after each reboot

Thanks for the quick reply, as I am following this tutorial: https://www.raspberrypi.org/learning/networking-lessons/lesson-3/plan/

It said it would be a problems to have many DHCP servers in the network. Unfortunately, I am having 3 raspberry pi 3 at the moment and I need to change all of them into DHCP servers.

Is there another way?

My router has the configuration option to always give the same IP adress to the same device. Maybe your router can do this as well?

Alternatively you could use the hostname of each device instead of the IP address!

Don’t do that. In a normal home network, your router is the only DHCP server. Everything else should be a DHCP client.
The advice is to set up your router’s DHCP to issue the same IP to your Pi.

1 Like