NodeMCU-32s cannot detect WiFi

I had previous issues with a project that my board did not connect to my wifi, after a little while i thought it was corruption due to the connection of my board to my computer using a hub. It turned out it was not the case since i’m now connected directly to my computer. I ran this code:

/*
 *  This sketch demonstrates how to scan WiFi networks.
 *  The API is almost the same as with the WiFi Shield library,
 *  the most obvious difference being the different file you need to include:
 */
#include "WiFi.h"

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

    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
}

and this is the output i get:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
Setup done

At this point i’m not sure what is the problem, could it be my board that is broken and doesn’t detect the WiFi? I’m living in an appartement building so there should be at least 1 listed below.

But you still have the loop code missing?


void loop()
{
    Serial.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");

    // Wait a bit before scanning again
    delay(5000);
}

Man I’m such a piece of work ahah, I never realized in the first place that you included a loop() to the initial post! It now prints out some network but not mine, so i guess that a router problem then.

1 Like

Very good that you can scan some networks now. You can usually see your network on your computer or on the phone, right? (No hidden SSID configured). There are also TX power settings in the router (max TX power limited by law per country).

Try to stand the ESP32 upright or at a higher place, to try to get different radiation pattern and antenna directions, or better, close to the router. That should confirm the source of problem as “signal too weak”.

Note that there also dev boards (e.g. the ESP32-WROOM-32U) which have no on-board antenna but a u.FL connector for an external antenna. With a good omnidirectional antenna with a few dBi gain, or a slightly directional antenna, you might get much better results.

I think it really is my router that is messed up, i tried to connect my printer to it once and it doesn’t see it either! i figured out a way using an app on my phone and it seems to work! but now my problem is that i can’t navigate to the IP adress it gives me on my last post: https://community.platformio.org/t/nodemcu-32s-not-connecting-to-wifi/13037

Is the IP you get from the same subnet your computer is in? Do you see the device in the router’s DHCP leases / devices? (E.g., if your PC is on 192.168.1.180 and your ESP32 is on 192.168.1.185, that should be fine. If it’s a on a completely different subnet like 10.10.51.125 then there’s a problem.).

You can also try to see if you can ping <ip> your ESP in the commandline.

2 Likes

Yeah thats what i figured out afterward! I connected to the same network and it worked fine ! I can finally play around with the project now!! Thank you for your time !

1 Like