ESP 42 impossible connection to WIFI

Hi, I recently uploaded a program to Scan Wifi and my board ESP 32 did this scan succesfully, showing on the serial monitor several networks. However, when I uploaded a sketch which shows the strenght of the WIFI connection, the serial monitor shows a message which clearly reveals that the board is not conneting for some reason I don't know. I apreciatte any suggestion to solve this. THe board is an ESP 32 DOIT DEVKIT V1.

01:17:02.967 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
01:17:03.015 -> configsip: 0, SPIWP:0xee
01:17:03.015 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
01:17:03.015 -> mode:DIO, clock div:1
01:17:03.015 -> load:0x3fff0018,len:4
01:17:03.015 -> load:0x3fff001c,len:1044
01:17:03.015 -> load:0x40078000,len:10124
01:17:03.015 -> load:0x40080400,len:5856
01:17:03.015 -> entry 0x400806a8
01:17:03.346 -> Connecting to WiFi .............................................................................

Ref.: esp32 arduino wifi auto reconnect - Google Search

Did you update the SSID & password in the sketch?

Please post the code you are using.

@Nestor47, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

Yes, sure. Here's the code

#include <WiFi.h>

// Replace with your network credentials (STATION)
const char* ssid = ".....";
const char* password = " ..... ";

unsigned long previousMillis = 0;
unsigned long interval = 30000;

void initWiFi() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi ..");
while (WiFi.status() != WL_CONNECTED) {
Serial.print('.');
delay(1000);
}
Serial.println(WiFi.localIP());
}

void setup() {
Serial.begin(115200);
initWiFi();
Serial.print("RSSI: ");
Serial.println(WiFi.RSSI());
}

void loop() {
unsigned long currentMillis = millis();
// if WiFi is down, try reconnecting every CHECK_WIFI_TIME seconds
if ((WiFi.status() != WL_CONNECTED) && (currentMillis - previousMillis >=interval)) {
Serial.print(millis());
Serial.println("Reconnecting to WiFi...");
WiFi.disconnect();
WiFi.reconnect();
previousMillis = currentMillis;
}
}

In "const chart" SSID I introduced my SSID name or numbers of my WIFI Network and then, obviously, the password.

:grinning: Sure ...

Yes, rtek1000, I tried the sketch you suggested me in the previous answer. However, the monitor serial goes on sending something like this:

Disconnected from WiFi access point
WiFi lost connection. Reason: 201
Trying to Reconnect

You are losing a lot of potential help because your title is incorrect.

Viz: ESP42 imp.....

I'm assuming this is your "new" code. You omitted the header which is a no-no. (I've corrected a typo RRSI )

/*
  Complete details at https://RandomNerdTutorials.com/esp32-useful-wi-fi-functions-arduino/
*/

#include <WiFi.h>

// Replace with your network credentials (STATION)
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";

void initWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WiFi ..");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print('.');
    delay(1000);
  }
  Serial.println(WiFi.localIP());
}

void setup() {
  Serial.begin(115200);
  initWiFi();
  Serial.print("RSSI: ");
  Serial.println(WiFi.RSSI());
}

void loop() {
  // put your main code here, to run repeatedly:
}

As its worked before I can only guess you have made an error in entering your WiFi credentials.
Perhaps you have omitted the quote marks, or incorrect capitalisation.

This is what my credentials LOOK LIKE. (I've edited them but yours should look like this.)

const char* ssid = "TALKTALKABC345";
const char* pass = "MVZAK834";

2 Likes

Thank you very much John! It worked!!. The serial monitor now showed the IP Adress of the board and a RSSI -37.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.