Configuring ESP8266 Wi-Fi Network Connection Through A Web Page
--
ESP8266 is one of the popular Wi-Fi chips with microcontroller capability. In this article, we will touch on a couple of items that are possible to do with ESP8266 and finally, we will see how to configure a WI-FI network connection through a web page working on the chip by bringing all those together.
Table of contents:
- Creating A WI-FI Access Point
- Connecting A Wi-Fi Network
- Creating A Web Server
- Storing And Reading Data From The Flash Memory
- Setting Up Wi-Fi Network Through A Web Page on ESP8266
Creating A WI-FI Access Point
ESP8266 can operate in station and access point modes. As we need to access a web page to be running on ESP8266, we will see how to run the chip in access point mode first.
In order to configure the WI-FI, we import the ESP8266WiFi library.
#include <ESP8266WiFi.h>
Next, we define an SSID and a password for the Wi-Fi network we’re going to create.
const char *AP_SSID="MyDevice";
const char *AP_PASSWORD="123456789";
And finally, it’s time to start our mini access point.
void setup() {
WiFi.mode(WIFI_AP);
WiFi.softAP(AP_SSID, AP_PASSWORD);
}
Let’s compile the code below and upload it to the development board (In my case, I used a NodeMCU board with an EP8266 chip)
#include <ESP8266WiFi.h>
const char *AP_SSID="MyDevice";
const char *AP_PASSWORD="123456789";
void setup() {
WiFi.mode(WIFI_AP);
WiFi.softAP(AP_SSID, AP_PASSWORD);
}
void loop() {}
As you can see from the following picture, the access point name appears on the list.
Enter the password that we defined in the code to authenticate the network.