ESP32 Thing won't connect to WiFi, but sees network in Scan. (SSID, PW correct).

Hello,

I have a couple of Sparkfun ESP32 Things (DEV-13907) that I can’t get to connect to a WiFi network. In brief:

  1. I can easily get the ESP8266 to connect to this network.

  2. The WiFiScan sketch running on the ESP32 sees the network, with strength of about -55.

  3. I’m using a simplified version of the WiFiClient example sketch (included below). The SSID and password are correct. They were cut and paste from the working ESP8266 program and I checked them thoroughly.

  4. I can get the board to connect to a different network (at home) if I am close to the router.

  5. Two boards behave the same, as near as I can tell.

What might be going wrong? Are there transmit power options, or other settings that might be helpful? This is quite frustrating. I feel it’s unlikely that the hardware is bad, suggesting there must be some configuration that’s wrong?

Thanks,

Doug

#include <WiFi.h>

const char* ssid     = "correct_SSID";
const char* password = "correct_password";

void setup()
{
    Serial.begin(115200);
    delay(10);

    // We start by connecting to a WiFi network

    Serial.println();
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
    long rssi = WiFi.RSSI(); 
    Serial.print("RSSI: ");
    Serial.print(rssi);
    Serial.println("dBm");

}

int value = 0;

void loop()
{
    delay(5000);

    long rssi = WiFi.RSSI(); 
    Serial.print("RSSI: ");
    Serial.print(rssi);
    Serial.println("dBm");
}

What kind of security are you using on your router? It’s possible it might be something the ESP32 isn’t happy with.

If you disable security (to test) does it work then?

Does your SSID contain special letters like _ (underscore)? I had problems with these.

No underscores, or anything strange in the SSID, It’s just three capital letters.

Regarding security. I think it’s just WPA, but I don’t administer this (Cisco) router so I don’t actually know. It would be a pain to disable security for testing purposes, but could be done if required. It would probably be easier just to set up another router for testing.

Are there any known problems with security settings?

Oh, and I meant to say, the ESP8266 has no trouble at all connecting to this network. I assumed, perhaps incorrectly, that the ESP8266 and ESP32 would have the same behavior around security.

Doug

An update:

I’ve now switched from the most recent stable ESP board support to the most recent development build. No apparent difference.

The ESP32 will easily connect to a different network running on the same router but with no security/password

The ESP32 sometimes, but not often, will connect to the network, if I press reset enough times. It seems that it will connect roughly one time in 10 attempts. (I’m giving it plenty of time to connect.)

Because it will sometimes manage to connect, I think we can say there’s nothing wrong with the SSID or PW, but it’s notable that it connects easily to the network that has no security.

On one occasion that it did connect, I monitored the signal strength and relocated to a part of the building where it had increased from -59 to about -39. There was no obvious difference in behavior with multiple resets, so it doesn’t seem to simply be signal strength.

What would cause it to struggle to connect, but sometimes manage???

I really want to like this chip/board but…

Ok, another update…

I used the exact same code, built and flashed on a ESP-32S board branded Hiletgo. This uses the ESP32-WROOM-32D module.

This board connects immediately, with absolutely no apparent problems… Interestingly, it reported a lower received signal strength, but nevertheless connected immediately and reliably.

Hmmm.