In this article I’ll show how to set a static/fixed IP address using Arduino using ESP8266 NodeMCU board. And if it is not working, I recommend you to assign with MAC address that includes: what is MAC Address and how to use it to fix the IP address every time you restart your board when you are running a web server or Wi-Fi client. I hope by the end of this tutorial you can fix your IP address as it is very to apply.
We are using the ESP8266 web server code for two LED’s ON/OFF. Copy the given code after that you need to apply some changes on this code.
Type your password and SSID so that it can connect with your router.
IP address and Gate way
Just need to insert your own local IP address and gateway address correspondingly before loop() and setup function(). You should use available local and gateway IP address given in your router.
After that upload this code then in the serial monitor you will get a static IP address
As you can see in the above figure it always gives you a static IP address everytime you restart the board. Here it is 192.168.10.150 in the serial monitor.
NOTE: Select the right board and Port COM
Copy this IP address and open web server.
I hope this article help you and upload successfully but still if it causes some issue or you do not want to use this method, I have other option for you to use ESP8266 MAC address.
What is MAC address?
As you know IP (Internet Protocol) is unique number assign for a computer so that it connects with internet. It has unique structure of IP6 or IP6.
Same with MAC (Media Access Control) address is also a unique number use in networking. It is also called Physical address, Hardware address or Ethernet hardware address.MAC address has a unique structure of 12-digit hexadecimal (6-Byte binary number) with a group of two, separate by colon like this:68:C6:3A:F8:E2:F9
You just need to copy the given code and upload it on Arduino using ESP8266 board.
After uploading the code, the next step is to open the serial monitor and copy the MAC address.
Getting it your own router’s control panel
Every router does different kind of structure. In this step you need find out where you can assign IP address by logging in admin page through name and password. If you want to get current IP address go to control panel and then it depends on the router that, how to change or assign the IP address to MAC address in that specific router. I recommend you to first try to search on google and fins out the tutorial on how to do that. It may be something within “Local Network”. Therefore, I can’t give you any tutorial on this that three are wide variety of router available in the market. Just need to find out router configuration and change the IP with MAC address.
ESP8266 Adafruit MQTT Broker,DHT11 ESP8266 Web Server,ESP-NOW ESP8266
That’s all for this project. If you any question issue related to this topic and coding let me know in the comment section. I make sure to solve your problem. And about my next project stay tuned for latest article on ESP8266 using Arduino board. Thank you!