Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Regarding ESP32 Wi-Fi Connection Stability and Scanning Behavior #10979

Open
1 task done
akhilkalariya0 opened this issue Feb 18, 2025 · 0 comments
Open
1 task done
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@akhilkalariya0
Copy link

akhilkalariya0 commented Feb 18, 2025

Board

ESP32-S3-WROOM-1-N16R8

Device Description

ESP32-S3-WROOM-1-N16R8 Module on Custom Board PCB.

Hardware Configuration

UART on IO18 and IO5 to communicate with other mcu (STM32).

Version

latest master (checkout manually)

IDE Name

Platform IO

Operating System

Windows 11

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

115200

Description

Hello,

I am currently using the ESP32 module in an environment where most surrounding structures are made of metal. The ESP32 is connected to a Wi-Fi network, but I have observed frequent connection failures. To handle this, I am using WiFi.scanNetworks(false, false, true); to continuously scan for networks and reconnect when available.

Despite implementing this approach, I am still experiencing occasional failures in network detection and reconnection. Specifically:

The ESP32 does not always detect the network even when it is available.
The scanning process sometimes takes longer than expected or fails to find any networks.
I would like to understand:

Is there a recommended best practice for handling Wi-Fi reconnections more reliably?
Are there any known issues with scanNetworks(false, false, true); that could cause inconsistent results?
Would enabling/disabling Wi-Fi or restarting the ESP32 improve reliability?
Are there firmware updates or alternative solutions that can enhance Wi-Fi stability?
I appreciate your guidance on this matter, as stable network connectivity is critical for my application. Please let me know if additional information is needed.

Sketch

bool network_scanning_process() {
    station_mode.disconnect();
    int numNetworks = station_mode.scanNetworks(false, false, true);
    Serial.printf("Found %d networks\n", numNetworks);

    if (numNetworks == -2) {
        wifi_update_debug_println("WiFi scan failed: WiFi driver not initialized.");
        reinitializeWiFi();
    }

    for (int j = 0; j < numNetworks; j++) {
        String ssid = station_mode.SSID(j);

        for(uint8_t i = 0; i < MAX_SSID_HOLD; i++){
            if (!strcmp(local_ssid[i], ssid.c_str())) {
                Serial.printf("Network %d: %s (RSSI: %d)\n", i + 1, ssid.c_str(), WiFi.RSSI(i));
                wifi_update_debug_println("Target network found! Connecting...");
                connectToTargetNetwork(local_ssid[i], local_pwd[i]);
            }
        }
    }

    if(WL_CONNECTED == station_mode.status()) {
        return 1;
    }
    else {
        live_time_updated = 0;
        return 0;
    }
}

Debug Message

NA

Other Steps to Reproduce

Random Issue

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@akhilkalariya0 akhilkalariya0 added the Status: Awaiting triage Issue is waiting for triage label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant