Wi-Fi Signal Strength Mapper using ESP32

Hey there, fellow DIY enthusiasts! Today, I'll walk you through an exciting project: building an ESP32 Wi-Fi Signal Strength Mapper. This little device will help you map the Wi-Fi signal strength in different areas of your home or workspace, allowing you to find the best spots for strong and stable connectivity. It's a perfect blend of programming and electronics, leveraging the powerful capabilities of the ESP32. Let’s dive right into it!


Before we get started, make sure you have the following components:


- ESP32 development board (any model with Wi-Fi capability)

- Micro USB cable for programming the ESP32

- Laptop/PC with the Arduino IDE installed

- Breadboard and jumper wires (optional for testing)

- OLED Display (128x64 I2C) (optional, for displaying signal strength in real-time)

  

Step 1: Setting Up the Arduino IDE for ESP32


If you haven't set up the Arduino IDE to program the ESP32, follow these steps:


1. Open the Arduino IDE.

2. Go to File > Preferences.

3. In the Additional Boards Manager URLs field, paste the following link:

https://dl.espressif.com/dl/package_esp32_index.json

4. Go to Tools > Board > Boards Manager, search for "ESP32", and install the ESP32 by Espressif Systems package.

5. Select your ESP32 board from Tools > Board > ESP32 Dev Module.


Step 2: Understanding Wi-Fi Signal Strength Mapping


The ESP32 has a built-in Wi-Fi library that allows it to scan nearby networks and measure their RSSI (Received Signal Strength Indicator) values. The RSSI is a measure of the power level that a device receives from a Wi-Fi access point (AP). In simpler terms, it tells you how strong or weak the Wi-Fi signal is in a particular spot.


RSSI Range Interpretation:


- -30 dBm to -50 dBm: Excellent signal

- -51 dBm to -60 dBm: Good signal

- -61 dBm to -70 dBm: Fair signal

- -71 dBm to -90 dBm: Weak signal

- Below -90 dBm: Extremely poor or no signal


Step 3: Writing the Code


Now, let's write the code that will scan nearby Wi-Fi networks, read their RSSI values, and display the results either through the serial monitor or on an OLED display. If you don't have an OLED, you can skip the display part.


#include <WiFi.h>

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>


// Define OLED display width and height

#define SCREEN_WIDTH 128

#define SCREEN_HEIGHT 64


// Define the OLED reset pin (if required)

#define OLED_RESET -1


// Create an OLED display object

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


void setup() {

    // Initialize serial communication

    Serial.begin(115200);

    

    // Initialize the OLED display

    if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {

        Serial.println("OLED display failed to initialize");

        while (true);

    }


    display.clearDisplay();

    display.setTextSize(1);

    display.setTextColor(SSD1306_WHITE);

    display.setCursor(0, 0);

    display.println("Wi-Fi Signal Mapper");

    display.display();

    

    // Start Wi-Fi in station mode

    WiFi.mode(WIFI_STA);

    WiFi.disconnect();

    delay(100);

}


void loop() {

    Serial.println("Scanning for Wi-Fi networks...");

    int numberOfNetworks = WiFi.scanNetworks();

    

    display.clearDisplay();

    display.setCursor(0, 0);

    display.println("Scanning...");

    display.display();

    delay(500);


    for (int i = 0; i < numberOfNetworks; i++) {

        // Print each network's SSID and RSSI to the serial monitor

        Serial.print("Network: ");

        Serial.println(WiFi.SSID(i));

        Serial.print("Signal strength (RSSI): ");

        Serial.print(WiFi.RSSI(i));

        Serial.println(" dBm");


        // Display SSID and RSSI on OLED (if available)

        display.setCursor(0, (i * 10) + 10);

        display.print(WiFi.SSID(i).substring(0, 10)); // Display first 10 characters of SSID

        display.print(": ");

        display.print(WiFi.RSSI(i));

        display.print(" dBm");

        display.display();

        delay(500);

    }

    

    // Wait before scanning again

    delay(5000);

}


Step 4: Uploading the Code to the ESP32


1. Connect your ESP32 to your computer using the USB cable.

2. Select the correct Port and Board under the Tools menu.

3. Click the Upload button (right arrow icon) in the Arduino IDE.

4. Once the upload is complete, open the Serial Monitor (Tools > Serial Monitor) to see the Wi-Fi networks and their RSSI values.


Step 5: Testing the Mapper


Now that the code is running on the ESP32, it's time to test it out!


- Serial Monitor Output: As you move around with the ESP32, you will see the list of detected Wi-Fi networks and their corresponding RSSI values in the Serial Monitor. Note how the RSSI changes as you move closer or further from the Wi-Fi access point.


- OLED Display Output: If you're using an OLED display, it will show the SSID of the nearby networks and their signal strengths in dBm. This makes it even easier to visualize the strength of each network as you move around.


Step 6: Using the Mapper for Site Surveys


Now that you have a working Wi-Fi signal strength mapper, you can use it to:


- Find the Best Wi-Fi Spots: Walk around your space to identify areas with strong Wi-Fi signals.

- Identify Dead Zones: Map out areas where the signal drops or is too weak to use.

- Optimize Router Placement: Use the RSSI values to help find the best place to position your router for optimal coverage.


Optional: Adding Data Logging


If you want to take this project a step further, you could add data logging to store the Wi-Fi signal strength values with timestamps in a microSD card or even send the data to a Google Sheet using the ESP32's Wi-Fi capabilities. That way, you can create a comprehensive map of your Wi-Fi signal strength over time!


Conclusion


And there you have it! A fully functional ESP32 Wi-Fi Signal Strength Mapper. This project is a great way to learn about Wi-Fi protocols, RSSI, and the ESP32's capabilities. Plus, it's super practical for everyday use in optimizing your home or office Wi-Fi setup.


I hope you found this tutorial helpful. Happy building, and see you in the next project!