Wi-Fi Jammer Detector Using ESP32

Objective

The objective of this experiment is to design and implement a Wi-Fi Jammer Detector using the ESP32 microcontroller. The system will continuously scan for available Wi-Fi networks and evaluate their signal strength (RSSI) to detect anomalies. If the signal strength of all networks drops significantly or becomes unstable, the ESP32 will trigger an alert, indicating possible jamming activity.

Introduction

Wi-Fi jamming is a method used to block or interfere with wireless networks, potentially disrupting communication for security or malicious purposes. In this project, we'll use the ESP32’s built-in Wi-Fi capabilities to scan surrounding Wi-Fi networks and analyze signal strength to detect suspicious activities. This can be helpful in identifying possible jamming attacks and improving wireless security awareness.

  • Connect the ESP32 board to your computer and configure it using the Arduino IDE.
  • Set up the code to perform a Wi-Fi scan every few seconds.
  • Calculate the average RSSI value of detected networks.
  • Set a threshold to identify abnormal signal drops.
  • If average RSSI falls below the threshold or if no networks are found, consider it a possible jamming scenario.
  • Trigger an alert via LED or serial print when jamming is detected.

Formula: If (avgRSSI < threshold) OR (no networks detected) → Possible Jamming → Trigger Alert

Components Required

  • ESP32 Development Board
  • USB Cable
  • LED (optional, for visual alert)
  • 220Ω Resistor (if using LED)
  • Breadboard and Jumper Wires
  • Computer with Arduino IDE

Circuit Diagram

  • ESP32 GPIO 2: Connected to LED anode via a 220Ω resistor (optional alert)
  • GND: Connected to LED cathode

You can choose to use the Serial Monitor instead of an LED if you prefer text-based alerts. The RSSI threshold may vary based on your surroundings; adjust it after multiple tests.

Connection Table

  • -> GPIO 2 (via 220Ω resistor)
  • -> GND

Arduino Code

1#include <WiFi.h>
2
3#define LED_PIN 2
4const int signalThreshold = -80;
5
6void setup() {
7  Serial.begin(115200);
8  pinMode(LED_PIN, OUTPUT);
9  WiFi.mode(WIFI_STA);
10  WiFi.disconnect();
11  delay(100);
12}
13
14void loop() {
15  int n = WiFi.scanNetworks();
16  long totalRSSI = 0;
17
18  if (n == 0) {
19    Serial.println("No networks found. Possible jamming.");
20    digitalWrite(LED_PIN, HIGH);
21  } else {
22    for (int i = 0; i < n; ++i) {
23      totalRSSI += WiFi.RSSI(i);
24    }
25
26    int avgRSSI = totalRSSI / n;
27    Serial.print("Average RSSI: ");
28    Serial.println(avgRSSI);
29
30    if (avgRSSI < signalThreshold) {
31      Serial.println("Possible Wi-Fi jamming detected!");
32      digitalWrite(LED_PIN, HIGH);
33    } else {
34      digitalWrite(LED_PIN, LOW);
35    }
36  }
37
38  delay(5000);
39}

Code Explanation

  • #include <WiFi.h>: Includes the WiFi library to enable scanning of nearby Wi-Fi networks.
  • WiFi.mode(WIFI_STA);: Configures ESP32 as a Wi-Fi Station so it can scan other networks.
  • WiFi.scanNetworks();: Scans and returns the number of Wi-Fi networks in range.
  • totalRSSI += WiFi.RSSI(i);: Accumulates the RSSI value of each network to calculate an average.
  • if (avgRSSI < signalThreshold): Checks if the signal strength drops below a critical level indicating possible jamming.

Applications

  • Home or office network security monitoring.
  • Educational tool to understand wireless jamming.
  • Portable device to detect Wi-Fi interference in the field.
  • Enhancing IoT reliability by identifying communication disruptions.

Conclusion

By using the built-in Wi-Fi features of the ESP32, we can effectively detect abnormal signal behavior in surrounding networks. This system can act as a simple yet powerful tool to alert users of potential jamming attacks or interference, especially in sensitive or secure environments. Proper calibration and regular updates to the detection logic can further enhance the reliability of this system.