Hello , I have the problem that every time you restart the ESP8266 modules by power cycling the power supply the IP address changes , and I can set up a static ip each module to never change ?
One way to do this is in your Wifi router. I have a D-Link router, and in the setup I go to Setup / Network settings / DHCP reservation. I can then ask the router to give a given MAC address a fixed IP address.
Alternatively, the ESP can request a certain IP address from the router. The command will depend on which firmware you're running.
In NodeMCU/Lua:
SSID = "YOUR SSID"
PW = "YOUR SSID PASSWORD"
IPADR = "192.168.0.126" //Requested static IP address for the ESP
IPROUTER = "192.168.0.1" // IP address for the Wifi router
wifi.setmode(wifi.STATION)
wifi.sta.setip({ip=IPADR,netmask="255.255.255.0",gateway=IPROUTER})
wifi.sta.config(SSID,PW)