Projects / ESP32 Wi-Fi network lister

ESP32 Wi-Fi network lister

Intermediate2.3 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. ESP32

    Wire the display

    SDA to GPIO21, SCL to GPIO22, power at 3.3 V.

  2. ESP32

    Wire the button

    GPIO27 to GND.

  3. ESP3211.6 mASSD1306

    Install the libraries

    Adafruit SSD1306 and Adafruit GFX.

  4. ESP32

    Upload the sketch

    A list of networks appears.

  5. ESP32

    Press the button

    The channel chart appears.

  6. ESP32

    Move your router channel

    Rescan and compare.

In short

How do you build an ESP32 Wi-Fi network lister?

An ESP32 lists the names and signal strength of nearby Wi-Fi networks on an OLED, and counts networks per channel to help you pick a quiet one for your own router. You need ESP32 DevKit V1, SSD1306 OLED Display, Tactile push button 6 mm and Breadboard 830 Tie Points. It takes 6 steps and about 140 minutes.

Level
Intermediate
Time
About 140 min
Parts
4

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
OLED VCCESP32 3V3Power at 3.3 V
OLED GNDESP32 GNDGround
OLED SDAESP32 GPIO21I2C data
OLED SCLESP32 GPIO22I2C clock
Page buttonESP32 GPIO27 and GNDSwitch between the name list and the channel chart

Code

Every Wi-Fi router broadcasts its name and signal many times a second, so any device can list the networks around it. The ESP32 scans, and the program shows the five strongest with a bar for the signal strength, and a second page that counts how many networks use each channel. In the 2.4 GHz band only channels 1, 6 and 11 do not overlap, so if your router shares a crowded channel, moving it to a quieter one among those three can help. The scan only reads what is broadcast to everyone. It does not join any network and it must never be used to try to connect to or test networks that are not yours. Signal strength is measured in dBm, a negative number: minus 40 is very strong and minus 90 is barely usable. Bars drawn here are rough, so treat them as a guide. Scanning takes a couple of seconds, so the page redraws every ten seconds.

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

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

Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int BTN = 27;
int chanCount[14];
bool page = false;
unsigned long lastScan = 0, lastEdge = 0;
bool prevBtn = HIGH;

void scanAndDraw() {
  int n = WiFi.scanNetworks();                      // lists only what every device can see
  for (int i = 0; i < 14; i++) chanCount[i] = 0;
  for (int i = 0; i < n; i++) {
    int ch = WiFi.channel(i);
    if (ch >= 1 && ch <= 13) chanCount[ch]++;
  }
  oled.clearDisplay();
  oled.setTextColor(SSD1306_WHITE);
  oled.setTextSize(1);
  if (!page) {
    oled.setCursor(0, 0); oled.print(n); oled.print(" networks");
    for (int i = 0; i < n && i < 5; i++) {
      oled.setCursor(0, 12 + i * 10);
      String name = WiFi.SSID(i);
      if (name.length() == 0) name = "(hidden)";
      oled.print(name.substring(0, 14));
      int bars = constrain(map(WiFi.RSSI(i), -100, -40, 0, 5), 0, 5);
      for (int b = 0; b < bars; b++) oled.fillRect(88 + b * 8, 12 + i * 10, 6, 7, SSD1306_WHITE);
    }
  } else {
    oled.setCursor(0, 0); oled.print("Networks per channel");
    for (int ch = 1; ch <= 13; ch++) {
      int h = constrain(chanCount[ch] * 6, 0, 40);
      oled.fillRect((ch - 1) * 9 + 5, 56 - h, 7, h, SSD1306_WHITE);
      if (ch == 1 || ch == 6 || ch == 11) { oled.setCursor((ch - 1) * 9 + 5, 57); oled.print(ch); }
    }
  }
  oled.display();
  WiFi.scanDelete();
}

void setup() {
  pinMode(BTN, INPUT_PULLUP);
  Wire.begin(21, 22);
  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { while (true) {} }
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  scanAndDraw();
}

void loop() {
  bool b = digitalRead(BTN);
  if (prevBtn == HIGH && b == LOW && millis() - lastEdge > 50) {
    page = !page; lastEdge = millis(); scanAndDraw(); lastScan = millis();
  }
  prevBtn = b;
  if (millis() - lastScan > 10000) { lastScan = millis(); scanAndDraw(); }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Start-upNetwork count and the strongest five names
Button pressedChannel chart with bars
Walk away from a routerIts bars fall
Wait ten secondsThe page refreshes
Hidden networkShown as hidden

If it does not work

Blank screen

Check the OLED address 0x3C and the GPIO21 and GPIO22 wires.

No networks listed

Move closer to a router and check the antenna is clear.

Compile error

Install the Adafruit libraries and select ESP32 Dev Module.

Names cut off

The display shows only 14 characters.

Upload fails

Hold BOOT during the upload.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the ESP32 Wi-Fi network lister?

ESP32 DevKit V1, SSD1306 OLED Display, Tactile push button 6 mm and Breadboard 830 Tie Points.

How long does the ESP32 Wi-Fi network lister take to build?

About 140 minutes for a intermediate maker, in 6 steps.

How do I know the ESP32 Wi-Fi network lister works?

Start-up: Network count and the strongest five names. Button pressed: Channel chart with bars. Walk away from a router: Its bars fall.

Blank screen: what should I check?

Check the OLED address 0x3C and the GPIO21 and GPIO22 wires.

No networks listed: what should I check?

Move closer to a router and check the antenna is clear.

Compile error: what should I check?

Install the Adafruit libraries and select ESP32 Dev Module.

Names cut off: what should I check?

The display shows only 14 characters.