Introduction: WiFi Manager With ESP8266

About: My name is Muhammad Irsyad Yunus. I like to build many related Arduino project from multiple hardware. Instagram account: @techwithbob Don't Forget To Follow For More DIY Content And Tech Development!

Learn to build WiFi manager on your ESP8266 using Soft Access Point mode and Station mode.

Step 1: Gather Reqired Components

List Of Hardware And Components:

Step 2: Assembling the Board

Wiring The OLED:

  1. SCL to pin D1
  2. SDA to pin D2
  3. VCC to 3V
  4. GND to Ground

Step 3: Install Required Library

Library Required:

Please install the following library in the library manager.

#include <WiFiManager.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Step 4: Upload the Sketch

//Library Involved
#include <WiFiManager.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

WiFiManager manager;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(500); // Pause for 2 seconds
  // Clear the buffer
  display.clearDisplay();
  //Clear previous stored data
  manager.resetSettings();// To reset the previous restored ssid and password data
  Text_Display("Disconnected", 2, 0, 20);
  manager.autoConnect("My-WiFi-Manager", "BobWithTech");// Format (ssid, password)
  Text_Display("Connected", 2, 0, 20);
  Serial.println("Connected...");

}
void loop() {
  // put your main code here, to run repeatedly:

}

//Function for efficient text displayer in the OLED
void Text_Display(String msg, int fontsz, int x, int y)
{
  display.clearDisplay();
  display.setTextSize(1.5); // Draw 2X-scale text
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("WiFi Status:")
  display.setTextSize(fontsz);
  display.setCursor(x, y);
  display.println(msg);
  display.display();      // Show initial text
  delay(20);
}

Step 5: Enjoy the Build