[SOLVED] ESP32 WROOM 32U WiFi unstable
Posted: Fri May 24, 2024 8:55 pm
Hi everyone!
I've made a multi-channel temperature measuring device with an ESP32-WROOM-32E (4MB) microcontroller. The measurements work fine, but the connection to the WiFi AP is very unreliable. Sometimes it connects almost immediately after powering on, sometimes it takes several minutes, and sometimes it doesn't connect at all. I've tried everything and can't figure out the solution to this problem.
(I also received information that the C8-C9 capacitors should be placed as close to the MCU as possible. I did that, but it didn't change anything...)
Here's a very simple program in Platform.IO (Arduino framework) that I use to test the WiFi, and the described phenomenon occurs.
What I've observed is that if the device is plugged into the computer's USB port and hasn't connected to the AP, it connects when I open its serial port (e.g., Putty, RealTerm, ...).
Has anyone encountered something like this?
Here's the schematic: https://drive.google.com/file/d/1BQ6gUQ ... SfbdxAHpRZ
And a detail of how the ESP32 is on the PCB: https://imgur.com/a/r0Vq9S1
I've already soldered a 33uF capacitor very close to pin 2, but C9 is still relatively far (40mm).
What am I missing?
Thank you! (My English is poor...)
I've made a multi-channel temperature measuring device with an ESP32-WROOM-32E (4MB) microcontroller. The measurements work fine, but the connection to the WiFi AP is very unreliable. Sometimes it connects almost immediately after powering on, sometimes it takes several minutes, and sometimes it doesn't connect at all. I've tried everything and can't figure out the solution to this problem.
(I also received information that the C8-C9 capacitors should be placed as close to the MCU as possible. I did that, but it didn't change anything...)
Here's a very simple program in Platform.IO (Arduino framework) that I use to test the WiFi, and the described phenomenon occurs.
What I've observed is that if the device is plugged into the computer's USB port and hasn't connected to the AP, it connects when I open its serial port (e.g., Putty, RealTerm, ...).
Has anyone encountered something like this?
Code: Select all
#include <Arduino.h>
#include <WiFi.h>
#include <driver/adc_common.h>
const char *ssid = "xxx";
const char *password = "xxx";
uint32_t ind = 0;
void setup() {
setCpuFrequencyMhz(240);
adc_power_off();
btStop();
Serial.begin(115200);
delay(3000);
pinMode(LED_BUILTIN, OUTPUT);
WiFi.mode(WIFI_STA);
WiFi.setTxPower(WIFI_POWER_19_5dBm);
WiFi.disconnect(true, true);
delay(100);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi ..");
while (WiFi.status() != WL_CONNECTED) {
Serial.println(ind);
delay(1000);
if (ind > 20) {
WiFi.disconnect();
digitalWrite(LED_BUILTIN, HIGH);
delay(300);
digitalWrite(LED_BUILTIN, LOW);
ESP.restart();
//WiFi.disconnect(true, true);
//WiFi.begin(ssid, password);
//ind = 0;
}
ind++;
}
Serial.println(WiFi.localIP());
Serial.println("WiFi connected");
}
void loop() {
if ( WiFi.isConnected() ) digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(2000);
Serial.println("LED");
}
And a detail of how the ESP32 is on the PCB: https://imgur.com/a/r0Vq9S1
I've already soldered a 33uF capacitor very close to pin 2, but C9 is still relatively far (40mm).
What am I missing?
Thank you! (My English is poor...)