22 WiFi Manager with NodeMCU and manage your SSID & Password

 Introduction:-

WiFi Manager allows you to connect your NodeMCU (ESP8266) to different Access Point without having to hard code and upload new code to your board. And you can also add custom parameters and manage multiple SSID connections with the WiFi Manager library. the WiFi library is the great library to add your NodeMCU projects, Because using this library you no longer have to hard-code your network SSID & Password. Your NodeMCU board will automatically join the known network or setup an access point that you can use to configure the networsk's SSID & Password.

First of all you have to download and install WiFi manager Library.

Click here to Download Library

WiFi Manager Process Works:-

  • When NodeMCU (ESP8266) starts then it is setup in station mode and tries to connect to a previously saved Access Point.
  • If it fails to connect it sets into Access Point mode.
  • Then it will create a new Access Point default name "AutoConnectAP"  connect your Any WiFi enable device like your smart phone or PC.


  • After establishinga connection with the "AutoConnectAP", then a web page will automatically open and if not open then you can go to the default IP address 192.168.4.1 to open web page that will allows you to configure your SSID and Password.

Programming:-

Here you have to use ESP8266WiFi, ESP8266WebServer and WiFManager library.
 #include <ESP8266WiFi.h>  
#include <ESP8266WebServer.h>
#include<WiFiManager.h>
In void setup function, you have to start Serial monitor to print the message and details about network connection, and create a WiFiManager object. WiFiManager.autoconnect function create SSID name, by default it is "AutoConnectAP". After establishing connection it will print Connected..... on Serial monitor.
 void setup() {  
Serial.begin(115200);
WiFiManager wifiManager;
wifiManager.autoConnect("AutoConnectAP");
Serial.println("Connected.....");
}
Here you can type your main Code.
 void loop() {  
// put your main code here, to run repeatedly:
}
Click here to download Code

Output:-


Click here to watch in full detail.

Thanks for watching🙏

No comments:

Powered by Blogger.