Hi all,
I am fairly new to both Cayenne and the EPS8266, I’ve been getting myself educated on tutorials and figuring out how to do things in this environment. Unfortunately, I’m experiencing difficulties with the most basic function… connecting my device to the internet.
The hardware is an NodeMCU 12-E and the sketch is the ESP8266 example from the Cayenne-MQTT-ESP library. After I compile and upload the sketch I get the a "Connecting to “mywifi” " message in the serial monitor. But that is as far as I can get.
I double checked the ssid, password, and the credentials from cayenne (which I copy-pasted from the site) and they were correct.
In an attempt to diagnose the problem, I checked my router (Netgear R6700v2) to see if it was recognizing the NodeMCU and to my surprise it was. In the list of connected devices, it was calling up the right MAC address, but for some strange reason the IP address and device name were “–” (blank…).
After doing research in the internet, the only similar case I could find was someone mentioning that the NodeMCU uses IPv6 and not IPv4, and so I enabled this feature in my router. Still didn’t work. I am out of options at this point.
I’d really appreciate your help/suggestions.
Thanks in advance.
can you try this code and see if your nodemcu connects to your wifi:
#include <ESP8266WiFi.h> // Include the Wi-Fi library
const char* ssid = "SSID"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "PASSWORD"; // The password of the Wi-Fi network
void setup() {
Serial.begin(115200); // Start the Serial communication to send messages to the computer
delay(10);
Serial.println('\n');
WiFi.begin(ssid, password); // Connect to the network
Serial.print("Connecting to ");
Serial.print(ssid); Serial.println(" ...");
int i = 0;
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(1000);
Serial.print(++i); Serial.print(' ');
}
Serial.println('\n');
Serial.println("Connection established!");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer
}
void loop() { }
Thanks for the suggestion! unfortunately I am still experiencing the same problem. Thought it could be a hardware problem so I tried a new NodeMCU, but I saw no change.
can you try connecting to mydevices using telnet telnet mqtt.mydevices.com 1883
so that you can see port 1883 is open and can connect.
Yes I was able to connect to the server via telnet. But I wonder why I am not even able to get an IP assigned by the router for the ModeMCU.
Thanks for your help again. I tried a number of things and somehow my router seems to not like ESP8266s… So decided to try using my phone as a hotspot and it just worked!
Not sure what the compatibility issue might be there, will try a different router.
Good that you were able to track down the issue.
I think the EPS8266 is a wireless g device. Maybe your router is set only for n devices.