The D1 mini and a 0.96″ OLED make a pocket-sized gadget, and the most useful thing to show on it is the board’s own radio. This sketch lists the 2.4 GHz networks around you, their channel and their signal strength — handy for picking a free channel for your router or finding the dead spot before you mount a sensor.
Wiring is the standard D1 mini I2C pair: SCL on D1, SDA on D2, power from 3V3.
Wiring
| Wemos D1 mini | SSD1306 OLED 0.96″ (128×64, I2C) | Wire | Notes |
|---|---|---|---|
| 3V3 | VCC | red | From 3V3, so the module’s I2C pull-ups go to 3.3 V. |
| GND | GND | black | |
| D1 | SCL | yellow | D1 = GPIO5, the core’s default SCL. |
| D2 | SDA | blue | D2 = GPIO4, the default SDA. |
3.3–5 V (on-board regulator) part, 3.3 V board. Most modules have a regulator and run from 3.3 V or 5 V. Their I2C pull-ups go to VCC, so on ESP32 and Pico power the OLED from 3.3 V to keep SDA/SCL at a safe level.
Board quirks
Wire.begin()on the ESP8266 uses SDA = D2, SCL = D1 — the same two pins every LOLIN I2C shield uses, so you can keep this OLED and stack a sensor shield on the same bus.- The little OLED shield made for the D1 mini is a 0.66″ 64×48 panel. The Adafruit library doesn’t offer that size; use U8g2 (or a 64×48 fork of the Adafruit library) for it. This guide is for the common 0.96″ 128×64 module.
WiFi.scanNetworks()blocks for about 2 s. The core services Wi-Fi and the watchdog while it waits, so noyield()is needed — but don’t put your own long busy loops around it.- The scan only listens for beacons and never connects, so it needs no password and stores nothing.
Code
// Pocket Wi-Fi scanner: 0.96" SSD1306 OLED (128x64, I2C) on a Wemos D1 mini (ESP8266).
// VCC → 3V3, GND → GND, SCL → D1 (GPIO5), SDA → D2 (GPIO4).
// Lists nearby 2.4 GHz networks with channel and signal strength. It only listens:
// it never joins or disturbs any network.
#include <ESP8266WiFi.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1); // -1: the 4-pin module has no reset pin
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_STA);
WiFi.disconnect(); // scan only - don't reconnect to a network saved in flash
Wire.begin(); // SDA = D2 (GPIO4), SCL = D1 (GPIO5)
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("SSD1306 not found at 0x3C - check SDA/SCL and try 0x3D");
while (true) delay(100); // delay() feeds the watchdog
}
display.setTextColor(SSD1306_WHITE);
display.setTextSize(1);
Serial.println("SSD1306 found at 0x3C - scanning every 10 s");
}
void loop() {
int n = WiFi.scanNetworks(); // blocks ~2 s; the core keeps Wi-Fi and the watchdog serviced
if (n < 0) n = 0;
display.clearDisplay();
display.setCursor(0, 0);
display.printf("%d networks\n", n);
Serial.printf("%d networks\n", n);
for (int i = 0; i < n; i++) {
String name = WiFi.SSID(i);
if (name.length() == 0) name = "(hidden)";
Serial.printf(" ch%-2d %4d dBm %s\n", WiFi.channel(i), WiFi.RSSI(i), name.c_str());
if (i < 7) display.printf("%-2d %4d %.12s\n", WiFi.channel(i), WiFi.RSSI(i), name.c_str());
}
display.display();
WiFi.scanDelete(); // free the result list
delay(10000);
}// Pocket Wi-Fi scanner: 0.96" SSD1306 OLED (128x64, I2C) on a Wemos D1 mini (ESP8266).
// VCC → 3V3, GND → GND, SCL → D1 (GPIO5), SDA → D2 (GPIO4).
// Lists nearby 2.4 GHz networks with channel and signal strength. It only listens:
// it never joins or disturbs any network.
#include <ESP8266WiFi.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1); // -1: the 4-pin module has no reset pin
void setup() {
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_STA);
WiFi.disconnect(); // scan only - don't reconnect to a network saved in flash
Wire.begin(); // SDA = D2 (GPIO4), SCL = D1 (GPIO5)
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("SSD1306 not found at 0x3C - check SDA/SCL and try 0x3D");
while (true) delay(100); // delay() feeds the watchdog
}
display.setTextColor(SSD1306_WHITE);
display.setTextSize(1);
Serial.println("SSD1306 found at 0x3C - scanning every 10 s");
}
void loop() {
int n = WiFi.scanNetworks(); // blocks ~2 s; the core keeps Wi-Fi and the watchdog serviced
if (n < 0) n = 0;
display.clearDisplay();
display.setCursor(0, 0);
display.printf("%d networks\n", n);
Serial.printf("%d networks\n", n);
for (int i = 0; i < n; i++) {
String name = WiFi.SSID(i);
if (name.length() == 0) name = "(hidden)";
Serial.printf(" ch%-2d %4d dBm %s\n", WiFi.channel(i), WiFi.RSSI(i), name.c_str());
if (i < 7) display.printf("%-2d %4d %.12s\n", WiFi.channel(i), WiFi.RSSI(i), name.c_str());
}
display.display();
WiFi.scanDelete(); // free the result list
delay(10000);
}Library: Adafruit SSD1306 (Adafruit (also install Adafruit GFX Library)) — compiled with Adafruit SSD1306 2.5.17.
Expected serial output
SSD1306 found at 0x3C - scanning every 10 s
4 networks
ch1 -48 dBm JioFiber-5A2C
ch6 -61 dBm Airtel_Home
ch11 -77 dBm (hidden)
ch6 -83 dBm TP-Link_2B10SSD1306 found at 0x3C - scanning every 10 s 4 networks ch1 -48 dBm JioFiber-5A2C ch6 -61 dBm Airtel_Home ch11 -77 dBm (hidden) ch6 -83 dBm TP-Link_2B10
Common errors
“SSD1306 not found at 0x3C”
SDA/SCL swapped (SDA is D2), a loose jumper, or a 0x3D module. Run the I2C scanner.
Only half the screen shows text
It is a 128×32 module. Change the constructor to Adafruit_SSD1306 display(128, 32, …).
“0 networks” every time
Only 2.4 GHz networks show — the ESP8266 can’t see 5 GHz. If even those are missing, check the board’s antenna end isn’t shielded by metal.