ESP32 Thing Plus won't connect to WiFi

I’ve tried all my tricks…Code that works on an Adafruit ESP32 won’t connect on this board.

I’ve had the Sparkfun WiFi example running for about an hour and it will not connect, just prints ... while waiting for WL_CONNECTED to be true.

And yes, I am 100% sure the SSID and password are correct.

Ideas?

That’s starnge - Could you provide the code being used? Also, is the LED blinking during this connection attempt?

Perhaps start by resetting everything (router, esp32 firmware/update)…maybe the router is confused about assigning 2 MAC addresses to the same network ID (if the same code was used)…seems like something wonky is going on.

If not, and the board ends up being defective, we’ll get you taken care of :wink:

Which SparkFun ESP32 Thing Plus are you using and do you have an antenna connected?

So, this is the code I’m running:

/*
 *  This sketch sends data via HTTP GET requests to data.sparkfun.com service.
 *
 *  You need to get streamId and privateKey at data.sparkfun.com and paste them
 *  below. Or just customize this script to talk to other HTTP servers.
 *
 */

#include <WiFi.h>

const char* ssid     = "MYSSID";
const char* password = "MYPWD";

const char* host = "data.sparkfun.com";
const char* streamId   = "....................";
const char* privateKey = "....................";

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) {
        Serial.printf("Wifi Status: %d\n", WiFi.status());
        delay(500);
       // Serial.print(".");
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
}

int value = 0;

void loop()
{
    delay(5000);
    ++value;

    Serial.print("connecting to ");
    Serial.println(host);

    // Use WiFiClient class to create TCP connections
    WiFiClient client;
    const int httpPort = 80;
    if (!client.connect(host, httpPort)) {
        Serial.println("connection failed");
        return;
    }

    // We now create a URI for the request
    String url = "/input/";
    url += streamId;
    url += "?private_key=";
    url += privateKey;
    url += "&value=";
    url += value;

    Serial.print("Requesting URL: ");
    Serial.println(url);

    // This will send the request to the server
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "Connection: close\r\n\r\n");
    unsigned long timeout = millis();
    while (client.available() == 0) {
        if (millis() - timeout > 5000) {
            Serial.println(">>> Client Timeout !");
            client.stop();
            return;
        }
    }

    // Read all the lines of the reply from server and print them to Serial
    while(client.available()) {
        String line = client.readStringUntil('\r');
        Serial.print(line);
    }

    Serial.println();
    Serial.println("closing connection");
}

I bought 6 of the WRL-17381 Sparkfun Thing Plus ESP32 WROOM (uFL) boards, and I have so far tried 2 with the same results. I just noticed the antenna connections … I guess I have to now buy some antennas … though, since I’m 2 feet from the AP, and getting an RSSI of -77dB that should be enough

dg

It was the antenna. Problem solved. :roll: