Connecting to any WiFi using in Browser Login

Updated: Feb 27, 2020

  • Download following source code as previous

  • Go to Network and find “AutoconnectAP” in network on pc/laptop/mobile in Wi-Fi available network and connect it.

  • Go to browser and and enter following IP address

"192.168.4.1"

  • Following window will appear and connect to available network by selecting

Configure WiFi”. and save. Device will Connect to That Network.

  • Reset WiFi setup with Button on D7 pin




Source code for Download as follows:-


#include <ESP8266WiFi.h>

#include <WiFiManager.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 16, 2);

int counter_s;

int rstpin =D7;


void setup()

{

lcd.begin();

lcd.backlight();

lcd.setCursor(0, 0);

delay(10);

lcd.print("connect AutoconnectAP");

lcd.setCursor(0, 1);

delay(1000);

lcd.print("type-192.168.4.1 in browser");

delay(400);

WiFiManager wifiManager;

wifiManager.setTimeout(10);

wifiManager.autoConnect("AutoConnectAP");

if(WiFi.status() != WL_CONNECTED)

{

lcd.clear();

lcd.print("connect AutoconnectAP");

delay(400);

lcd.setCursor(0, 1);

lcd.print("type-192.168.4.1 in browser");

delay(400);

for(counter_s=0;counter_s<45;counter_s++)

{

lcd.scrollDisplayLeft();

delay(400);

}


}

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("connect ");

delay(400);

lcd.setCursor(0, 0);

lcd.print("AutoconnectAP");

delay(400);

lcd.setCursor(0, 1);

lcd.print("In browser ");

delay(800);

lcd.setCursor(0, 1);

lcd.print("192.168.4.1");

delay(400);

if(!wifiManager.autoConnect("AutoConnectAP"))

{

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("failed to connect");

delay(3000);

//reset and try again, or maybe put it to deep sleep

ESP.reset();

delay(5000);

}


lcd.clear();

lcd.setCursor(0, 0);

lcd.print("WiFi connected");

delay(400);

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("IP address: ");

delay(400);

lcd.setCursor(0, 1);

lcd.print(WiFi.localIP());

delay(400);

}


void loop()

{

if(digitalRead(rstpin)==HIGH)

{

WiFi.disconnect();

delay(5000);

}

}

  • Circuit Diagram






89 views0 comments

Recent Posts

See All