Using ESP8266 WiFi Scan to see all available WiFi AP with Arduino -Example 1

Project Video
Project Details

This code is to use ESP8266, NodeMCU, Wemos D1 Mini to diplay all available access points (WiFi ) on serial monitor.
In this page I have provided 3 different Arduiono codes:
1-Basic WiFi scan
2-Display Open WiFo only
3-Advanced WiFi scan

See Using ESP8266 WiFi Scan to Open WiFi scan code with Arduino -Example 2
See Using ESP8266 Advanced WiFi scan code with Arduino -Example 3

Project Code

 * WiRi Signal strenght in Percentage (RSSI) calculation 
 * works with any ESP8266 MCU such as Di Mini, D1 Mini Pro, D1, NodeMCU or any other ESP8166 MCU
 * and display on Serial Monitor
 * Written by Ahmad Shamshiri 
 * on Aug 10, 2019 at 18:08 in Ajax, Ontario, Canada

watch video instruction for this code:

Get this code and other Arduino codes from
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on

If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon

or make donation using PayPal

  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see .
#include "ESP8266WiFi.h"

const int RSSI_MAX =-50;// define maximum strength of signal in dBm
const int RSSI_MIN =-100;// define minimum strength of signal in dBm

const int displayEnc=1;// set to 1 to display Encryption or 0 not to display

void setup() {
  Serial.println("Robojax Wifi Signal Scan");
  // Set WiFi to station mode and disconnect from an AP if it was previously connected

  Serial.println("Setup done");

void loop() {
  Serial.println("Wifi scan started");

  // WiFi.scanNetworks will return the number of networks found
  int n = WiFi.scanNetworks();
  Serial.println("Wifi scan ended");
  if (n == 0) {
    Serial.println("no networks found");
  } else {
    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));// SSID

      Serial.print(WiFi.RSSI(i));//Signal strength in dBm  
      Serial.print("dBm (");

      Serial.print(dBmtoPercentage(WiFi.RSSI(i)));//Signal strength in %  
     Serial.print("% )"); 
      if(WiFi.encryptionType(i) == ENC_TYPE_NONE)
          Serial.println(" <<***OPEN***>>");        


  // Wait a bit before scanning again
}// loop

 * Written by Ahmad Shamshiri
  * with lots of research, this sources was used:
 * This is approximate percentage calculation of RSSI
 * WiFi Signal Strength Calculation
 * Written Aug 08, 2019 at 21:45 in Ajax, Ontario, Canada

int dBmtoPercentage(int dBm)
  int quality;
    if(dBm <= RSSI_MIN)
        quality = 0;
    else if(dBm >= RSSI_MAX)
        quality = 100;
        quality = 2 * (dBm + 100);

     return quality;

If you found this Arduino course helpful, please support me so I can continue creating content like this. support me via PayPal