ESP8266 is not connecting to my router WiFi but...

Hi everyone
In order to make a Google assistant box, I just got a new esp8266 nodemcu v2 from Ali. The first thing was scanning all the available networks. Then copy and paste mine and with its password in a script to turn on and off a LED. The serial monitor will give me information about the status of the module and its address. The problem here is that the module is not connecting to my home wifi network, so I tried connecting to my phone wifi hotspot and it connected and works properly. I don’t know what is going on with my wifi.
Thanks.


WMM is on.


From a youtube video, it works even on my lapto´s hotspot.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>

const char* ssid = “…”;
const char* password = “…”;

WiFiServer server(80);

int PinLED = 16;
int estado = LOW;

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

pinMode(PinLED,OUTPUT);
digitalWrite(PinLED,LOW);

WiFi.mode(WIFI_STA);
WiFi.begin(ssid,password);
Serial.printf("\n\nConectado a la red: %s\n", WiFi.SSID().c_str());
while (WiFi.status()!=WL_CONNECTED){
delay(500);
Serial.printf(".");
}
Serial.println(".");
Serial.println(“WiFi conectada”);

server.begin();
Serial.println(“Servidor incializado”);

Serial.printf("\n\nUtiliza esta URL para conectar: http://%s/\n", WiFi.localIP().toString().c_str());
}

void loop() {

WiFiClient client = server.available();
if(!client){
return;
}

Serial.println(“nuevo cliente”);
while(!client.available()){
delay(1);
}

String peticion = client.readStringUntil(’\r’);
Serial.println(peticion);
client.flush();

if (peticion.indexOf(’/LED=ON’) !=-1)
{estado = LOW;}
if (peticion.indexOf(’/LED=OFF’) !=-1)
{estado = HIGH;}

digitalWrite(PinLED, estado);

client.println(“HTTP/1.1 200 OK”);
client.println("");
client.println("");
client.println("");
client.println("");
client.println("CONTROL LED ");

if(estado == HIGH)
{client.print("<input type=‘image’ src=‘https://i.imgur.com/00i0BdB.jpg’ style=‘display:block; margin:auto’ width=‘30%’ onClick=location.href=’/LED=ON’>");}
else
{client.print("<input type=‘image’ src=‘https://i.imgur.com/uQxhFE5.jpg’ style=‘display:block; margin:auto’ width=‘30%’ onClick=location.href=’/LED=OFF’>");}

client.println("");
delay(1);
Serial.println(“Peticion finalizada”); // Se finaliza la petición al cliente. Se inicializa la espera de una nueva petición.
Serial.println("");

What frequency is your home WiFi working on? I would not expect the ESP8266 to see anything but the 2.4GHz band but maybe your Wifi needs different credentials for different bands.

Do you have MAC address filtering turned on on your router.
Are you using a static IP or DHCP to connect.

madnegrete:
Hi everyone
. . . The problem here is that the module is not connecting to my home wifi network, so I tried connecting to my phone wifi hotspot and it connected and works properly. I don't know what is going on with my wifi.
Thanks.

We don't know what is going on with your program since you didn't provide a copy. It's pretty hard to keep an ESP8266 from connecting to a router once you have provided it with the SSID and password.

Don

Riva:
What frequency is your home WiFi working on? I would not expect the ESP8266 to see anything but the 2.4GHz band but maybe your Wifi needs different credentials for different bands.

Do you have MAC address filtering turned on on your router.
Are you using a static IP or DHCP to connect.

My wifi is working at 2.4Ghz on chanel 9, not MAC address filtering and using a DHCP.

madnegrete:
My wifi is working at 2.4Ghz on chanel 9, not MAC address filtering and using a DHCP.

What encryption system is it using and is it using IPv4 and not IPv6, as floresta says it's difficult to have the ESP chips not be able to connect to a WiFi AP.
You have not provided the code your trying (or a cut down version of it) so people can look for potential problems.

Riva:
What encryption system is it using and is it using IPv4 and not IPv6, as floresta says it's difficult to have the ESP chips not be able to connect to a WiFi AP.
You have not provided the code your trying (or a cut down version of it) so people can look for potential problems.

i just edited the post with the full code.

floresta:
We don’t know what is going on with your program since you didn’t provide a copy. It’s pretty hard to keep an ESP8266 from connecting to a router once you have provided it with the SSID and password.

Don

Now you can look at my full code.

You really need to put your code in code tags </>
What do you get on the serial console output what you run the code?