ESP32 Not connecting to wifi if serial monitor is not running on IDE
Posted: Thu Jan 20, 2022 8:19 pm
I have an strange problem. I created a program in wich i use several libraries like FasLED, Led 7 segments drivers, time.h and it worked perfectly until i disconnected the board from the computer and connected to an standard USB power supply.
After many tests what I have found is that if the ESP32 is not connected to the computer USB and Serial Monitor is not running in the Arduino IDE the program does not connect to the WiFi. I started to eliminate parts of the program in order to find what could cause that.
Now I am in a very simple bare bones program and it is still the same, if the board is not connected to the computer and the serial monitor is not running the prograam does not connect to wifi.
I am using an ESPDUINO32 it has an ESP-WROOM-32 and I use a Mac. Have tried Arduino IDE 1.8.15 as well as 2.0.0 Beta 9
I have two boards and both have the same behaviour, this is not a power supply problem as I have tried with several power bricks and also tested the consumption being really below the capability of the bricks, neither a cabling one as I only have a LED and it flashes correctly and stays on after connecting to wifi, if that is succesful.
Also the board does not resets and stay on the loop forever, i have tried to put a counter on the loop and send it via serial and it send a continuous count, so no reset.
I am completely clueless.
So, this is probably something really strange or more probably really stupid on my side.
p.d. Excuse me if something is not clear as english is not my main language. Just for the records, I have been designing electronics and programming, mainly in assembler, for hobby or professionally for nearly 40 years but fairly new to ESP32 and C.
https://pastebin.com/TAkXW4Zx
After many tests what I have found is that if the ESP32 is not connected to the computer USB and Serial Monitor is not running in the Arduino IDE the program does not connect to the WiFi. I started to eliminate parts of the program in order to find what could cause that.
Now I am in a very simple bare bones program and it is still the same, if the board is not connected to the computer and the serial monitor is not running the prograam does not connect to wifi.
I am using an ESPDUINO32 it has an ESP-WROOM-32 and I use a Mac. Have tried Arduino IDE 1.8.15 as well as 2.0.0 Beta 9
I have two boards and both have the same behaviour, this is not a power supply problem as I have tried with several power bricks and also tested the consumption being really below the capability of the bricks, neither a cabling one as I only have a LED and it flashes correctly and stays on after connecting to wifi, if that is succesful.
Also the board does not resets and stay on the loop forever, i have tried to put a counter on the loop and send it via serial and it send a continuous count, so no reset.
I am completely clueless.
So, this is probably something really strange or more probably really stupid on my side.
p.d. Excuse me if something is not clear as english is not my main language. Just for the records, I have been designing electronics and programming, mainly in assembler, for hobby or professionally for nearly 40 years but fairly new to ESP32 and C.
Code: Select all
#include <Arduino.h>
/* ------------------------------------------ */
#include "WiFi.h"
const char* ssid = "Yourssid";
const char* password = "yourpass";
bool flashFlag = false;
#define CONNECTING_LED 18 // 27
/* ------------------------------------------ */
void setup() {
delay(3000); // 3 second delay for recovery just in case
pinMode(CONNECTING_LED, OUTPUT);
digitalWrite(CONNECTING_LED, HIGH);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
flashFlag = !flashFlag;
if (flashFlag == true) {
digitalWrite(CONNECTING_LED, HIGH);
} else {
digitalWrite(CONNECTING_LED, LOW);
}
}
digitalWrite(CONNECTING_LED, HIGH);
}
/* ------------------------------------------ */
void loop() {
}
https://pastebin.com/TAkXW4Zx