I can't connect to my home Wi-Fi with ESP8266

Hello,

I have a problem that I don’t know how to solve.

I compile and install a very simple code that only tries to connect to my home Wi-Fi.

I have an ESP12-E and a nodemcuv2 that I am doing tests on.

Case 1: Once the code is installed on ESP12-E:

  • If the power comes from the computer via USB, it connects perfectly to the Wi-Fi
  • If the power is through electric current then it cannot connect

This behavior seems very strange to me and I have done many tests with the same result.

Case 2: Code installed on nodemcuv2

  • I can’t get it to connect to the power from the computer.

this is the device with ESP12-E

I have verified with a multimeter that the voltage that ESP12-E receives is 3.3v whether the power comes from the computer or from alternating current.

— My router —
two Asus RT-AC86U routers configured as aimesh
main: configured as wireless router
Secondary: configured as node

— Platformio version from about dialog ----
Version: 1.92.1
Date: 2024-08-07
Electron: 30.1.2
Electonbuildid: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

— platformio.ini for esp12e and nodemcuv2 —

platform = espressif8266@4.2.1
framework = arduino
upload_speed = 115200
monitor_speed = 115200
upload_resetmethod = nodemcu

— execution information ----
When the connection fails, the following is constantly repeated:

Mode: STA
PHY mode: N
Channel: 9
AP id: 0
Status: 1
Auto connect: 1
SSID (13): my_ssid
Passphrase (9): my_pass
BSSID set: 0

--- code ----

#include <Arduino.h>
#include <ESP8266WiFi.h>

String s_ssid ="my_ssid";
String s_pass = "my_pass";

IPAddress ip(192, 168, 1, 254);
IPAddress dns1(192, 168, 1, 1);
IPAddress dns2(8, 8, 8, 8);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);

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

  
  Serial.println("\nConnecting...");

  WiFi.mode(WIFI_STA);
  WiFi.config(ip, gateway, subnet, dns1, dns2);
  WiFi.begin(s_ssid, s_pass);
 
  while (WiFi.status() != WL_CONNECTED) {
      Serial.println("");
      WiFi.printDiag(Serial); 
      Serial.println("");
      delay(500);
  }

  Serial.println("\nConnected Ok.");

  WiFi.printDiag(Serial); 

}

unsigned long modulo = 0;

void loop() {
  unsigned long tiempo_funcionando = millis();

  modulo = tiempo_funcionando % 5000;

  if (modulo == 0)
  {
    Serial.println("Working...");
    delay(3000);
  }

  yield();
}


For the ESP12-E: Is this a custom PCB you’ve designed? Can you share the schematics for it? There might be a few things to enhance, e.g., more capacitance on the 5V and 3.3V supply lines, or placing the antenna further away from any switching elements (your AC → DC switch-mode power supply!).

For the NodeMCUv2: These predesigned dev boards should work fine. Have you tried different USB cables (shorter) or a different USB port?

Good morning,
Yes, I designed this PCB, and I am convinced that it is not a design problem, I have had these devices working for 6 years and I have never had this problem, I have tried other different devices in case it was damaged and the problem is also reproduced. As I mentioned before, I have checked the voltage that reaches the ESP12-E with a multimeter and it is correct, as expected.

On the other hand, in the case of NodeMCUv2 I will do the test that you mentioned.

Thank you very much for your prompt response
Greetings.

Coincidences do exist…
The two devices I was testing had faulty power supplies, when I measured the voltages with the multimeter they were correct but something was not right in the power supply, I changed it for a new one and everything worked correctly again.

The nodemcuv2 seems to have a faulty esp8266, it is quite old now, I tested the equivalent with an ESP32 and it also worked fine.

Greetings.