WiFi scanner with Wemos D1 mini

For the best performance, you should choose a wireless channel less used by any of your neighbors. Many routers use the same channel by default–e.g., 6–and unless you know to test for and change the Wi-Fi channel when you first install your router, you’re probably using the same channel as someone else nearby. In other words, decreased performance.

Wemos D1 mini

Find the Best Wi-Fi Channel Number

You can use the ESP8266E which sits on the Wemos D1 mini as WiFi scanner to check which channel to use for your own home WiFi setup.
You do not need any additional hardware to make the WiFi scanner.
With the WiFi scanner you can check which WiFi channels are mostly used in your neighborhood, and with what strength they are.

Here an example output from my neighborhood:

scan start
16 networks found
1: NETGEAR08 (-88) [1] CCMP
2: HZN243330904 (-92) [1] CCMP
3: Ziggo beneden (-88) [1] AUTO
4: NETGEAR54 (-87) [3] CCMP
5: ThewoodfamilyGuest (-86) [3] CCMP
6: REMOTE25teeh (-94) [3] CCMP
7: Ziggo23355 (-91) [6] CCMP
8: robnet5 (-93) [6] CCMP
9: Ziggo (-93) [6] ?
10: Ziggo (-91) [6] ?
11: TP-LINK_2DEE (-84) [6] CCMP
12: ASUS (-92) [6] CCMP
13: H368N0E860E (-90) [8] AUTO
14: FRITZ!Box 7581 MO (-91) [10] CCMP
15: robnet2 (-44) [11] CCMP
16: Ziggo19179 (-87) [11] TKIP
scan done

Here the code that gives the above output

#include "ESP8266WiFi.h"
WiFiClient client;

void setup() {
  Serial.begin(57600);
}

void loop() {
  SSID_scan();
  delay(10000);
}

void SSID_scan() {
  Serial.println("");
  Serial.println("scan start");
  WiFi.disconnect();
  delay(100);
  // WiFi.scanNetworks will return the number of networks found
  int n = WiFi.scanNetworks();
  if (n == 0)
    Serial.println("no networks found");
  else
  {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i)
    {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i));
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i));
      Serial.print(") ");
      Serial.print(" [");
      Serial.print(WiFi.channel(i));
      Serial.print("] ");
      Serial.println((String) encryptionTypeStr(WiFi.encryptionType(i)));
      delay(10);
    }
  }
  Serial.println("scan done");
  Serial.println("");
}

String encryptionTypeStr(uint8_t authmode) {
  switch (authmode) {
    case ENC_TYPE_NONE:
      return "NONE";
    case ENC_TYPE_WEP:
      return "WEP";
    case ENC_TYPE_TKIP:
      return "TKIP";
    case ENC_TYPE_CCMP:
      return "CCMP";
    case ENC_TYPE_AUTO:
      return "AUTO";
    default:
      return "?";;
  }
}

Change the Wi-Fi Channel on Your Router

Once you know the wireless channel that's least congested near you, head to your router's administration page by typing in its IP address in the browser address bar. Depending on your router, this will likely be something like 192.168.2.1, 192.168.1.1, or 10.0.0.1 (check your router manual or the bottom of your router for details).

Head to your router's wireless settings to change the Wi-Fi channel and hit apply for it to take effect.

See this page for a WiFi scanner with the ESP32

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.