Hello, I'm at my wits' end. I can not figure out how to get an ESP8266 device to connect to my WIFI network.
My router is from Xfinity, my network "jonas" is broadcast both in stunning 2.4Ghz and 5Ghz.
I have verified the SSID and passphrase are correct. And able to connect to my WIFI network using an UNO R4 WIFI with no issues. I also have a number of ESP8266 consumer electronic devices that are happily connected to my WIFI network (pet feeder, smart plugs)
I have run the WIFIScan.ino sketch and my network (jonas) is found.
01: [CH 01] [9A:9D:5D:88:CE:BA] -27dBm * H 802.11g/n
02: [CH 01] [9A:9D:5D:88:CE:BD] -27dBm * V 802.11g/n jonas
03: [CH 01] [72:5B:F0:BC:7E:1B] -86dBm H 802.11g/n WPS
04: [CH 01] [8C:5B:F0:BC:7E:1E] -85dBm * V 802.11g/n WPS XFSETUP-7E23
05: [CH 01] [6E:3C:7C:07:F2:61] -65dBm * V 802.11g/n WPS DIRECT-iU61-TR4700series
My sketch is very basic.
#include <ESP8266WiFi.h>
#ifndef STASSID
#define STASSID "jonas"
#define STAPSK "*******"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
// WiFi.enableInsecureWEP(true); // tried with true and false
WiFi.mode(WIFI_STA);
WiFi.setPhyMode(WIFI_PHY_MODE_11G); // tried both WIFI_PHY_MODE_11G and WIFI_PHY_MODE_11N
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
digitalWrite(LED_BUILTIN, HIGH);
delay(250);
digitalWrite(LED_BUILTIN, LOW);
delay(250);
Serial.println("nope");
Serial.println(WiFi.status());
WiFi.printDiag(Serial);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(2000);
digitalWrite(LED_BUILTIN, LOW);
delay(2000);
Serial.println("connected");
WiFi.printDiag(Serial);
}
The following is output repeatedly from the loop.
nope
7
Mode: STA
PHY mode: G
Channel: 1
AP id: 0
Status: 1
Auto connect: 1
SSID (5): jonas
Passphrase (10): *******
BSSID set: 0
The 7, I believe, represents WL_DISCONNECTED
. The correct channel seems to be found but no connection is made.
This is a cheap device I got off AliExpress so it could just be broken, but the fact my wifi network is found gives me hope.
I have followed the suggestions in this post:
I thought this might be a power issue and have tried powering the device from a wall wart and my computer. No luck.
Any help/ideas/thoughts would be appreciated. Thank you for your time.