Esp8266 To Find IP Address
Esp8266 To Find IP Address
com/2019/01/05/connecting-esp8266-to-wifi-hotspot-example/
E1
In Station Mode (STA), the ESP8266 WiFi Module will be connected to a WiFi Network that is already
setup by an Access Point, like a WiFi Router.
The second mode of operation is Access Point (AP) Mode. In this mode, the ESP8266 NodeMCU
acts as an access point and provide WiFi Network to other stations (like mobile or laptop).
Usually, an access point can provide internet through a wired network to its stations but as there is no
wired interface, this Access Point mode is called Soft Access Point.
The ESP Module is first setup as Soft AP mode before configuring it in Station Mode. This is helpful
when the username (SSID) and password of the WiFi network is unknown.
Soft AP + Station
In the third mode, the ESP8266 WiFi Module is configured to act in both Station Mode and Soft AP
Mode.
1 WiFi.begin(SSID,PASSWORD);
function. Then wait for the connection to complete, your ESP8266 is now connected to your Local
Area Network.
To connect to a unsecured WiFi or Open WiFi network remove the password field from
/*
* https://circuits4you.com
*
* Connecting NodeMCU ESP8266 to WiFi Example
*
*/
Results
To check and test the connecting open serial monitor. After opening serial monitor press reset button
of NodeMCU to see connection process, Note down the IP.
Open Command prompt by pressing Windows+R key then enter cmd press enter. Enter C:/> ping
192.168.43.225 IP which you got from serial monitor.
The ping command sends small packets to the IP address of the ESP8266. When the ESP receives
such a packet, it sends it back to the sender. Ping is part of the second layer of the TCP/IP stack, the
Internet layer. It relies on both the Data Link layer (Wi-Fi) and the Internet Protocol.
You can see that in the example above, we sent packets to the ESP, and we also received response
(echo) packets. This tells us that the Data Link, the Wi-Fi connection, and the Internet Protocol are
working correctly.
Points to note
1. To check ESP8266 connected to wifi use WiFi.status() != WL_CONNECTED
2. In loop you don’t need to worry about re-connection in case WiFi Connection lost, ESP8266 WiFi
Library Takes care of re-connection to WiFi.
3. In loop() do not use any function that takes longer time, anything that takes longer time will reset the
ESP with Error: WDT reset
4. ESP8266 Connects to only 2.4GHz WiFi.