Home / References / ESP32 Library / WiFi API / Station
Description
The RSSI
method retrieves the Received Signal Strength Indicator (RSSI) of the currently connected Wi-Fi network. RSSI is a measure of the signal strength received by the ESP32, typically ranging from -100 dBm (very weak) to -30 dBm (very strong). This method is useful for network diagnostics and optimization.
Syntax and Usage
This method returns the RSSI value of the connected network in dBm.
WiFi.RSSI()
Argument(s)
This method does not accept any arguments.
Return Value
The RSSI
method returns an integer representing the signal strength in dBm. The value can range from -100 (very weak) to -30 (very strong). If the ESP32 is not connected to a Wi-Fi network, this method will return -127.
Example Codes
This code demonstrates how to use the ESP32 WiFi Library’s RSSI()
method to measure the signal strength of the currently connected WiFi network. The RSSI()
method retrieves the Received Signal Strength Indicator (RSSI) value, which indicates how strong the WiFi signal is. A higher RSSI value means a stronger signal, while a lower value indicates weaker connectivity.
To use this code, replace “your_SSID” and “your_PASSWORD” with your WiFi network’s SSID and password. Upload the code to your ESP32 board and open the Serial Monitor at 115200 baud. The code will connect to the WiFi network and display the RSSI value, allowing you to assess the signal strength. Ensure the ESP32 is within range of the WiFi signal for accurate results.
/*
* Author: Avant Maker
* Date (MM-DD-YY): 02-06-25
* Version: 1.0
* Description: This example code demostrates how to use RSSI
* method to retrieve ESP32's Received Signal Strength Indicator (RSSI)
* of the currently connected Wi-Fi network.
*
* License: MIT
*
* Code Source: This example code is sourced from the Comprehensive Guide
* to the ESP32 Arduino Core Library, accessible on AvantMaker.com.
* For additional code examples and in-depth documentation related to
* the ESP32 Arduino Core Library, please visit:
*
* https://avantmaker.com/references/esp32-arduino-core-index/
*
* AvantMaker.com, your premier destination for all things DIY, AI, IoT,
* Smart Home, and STEM projects. We are dedicated to empowering makers,
* learners, and enthusiasts with the resources they need to bring their
* innovative ideas to life.
*/
#include <WiFi.h>
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("Connecting to WiFi...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nConnected to WiFi!");
// Retrieve and print the RSSI value
int rssi = WiFi.RSSI();
Serial.print("RSSI: ");
Serial.println(rssi);
}
void loop() {
// Your code here
}
AvantMaker Tutorial Suggestion
If you want to learn more about the ESP32’s WiFi capabilities, we’ve created a beginner-friendly guide that explains them in detail. Just click the link below, and you’ll be teleported to that page. It will clear up any confusion you may have while connecting your ESP32 to WiFi or setting it up as a WiFi access point (AP).
ESP32 Library Index
- ESP32 WiFiClient Library
- ESP32 HTTPClient Library
- ESP32 WiFiClientSecure Library
- ESP32 WebServer Library
- ESP32 WiFi Library
- Which ESP32 Boards are Recommended for Learners
- How to Copy Codes from AvantMaker.com
- What is SPIFFS and how to upload files to it?
- What is LIttleFS and how to upload files to it?
Ready to experiment and explore more about ESP32? Visit our website’s All About ESP32 Resources Hub, packed with tutorials, guides, and tools to inspire your maker journey. Experiment, explore, and elevate your skills with everything you need to master this powerful microcontroller platform!