BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Nodemcu connected to the router but app still shows offline

My project has feature to edit the Wi-Fi credentials ‘Over the Air’ for blynk app, along with Auth Token, now when I edit these credential for my “Home Wi-Fi router” and any “smart phone Wi-Fi Hotspot” it works perfectly fine. But when I do the same thing with my University Wi-Fi routers, it does not connect to my Blynk project.!
although I see in the serial monitor all the Wi-Fi credentials do get successfully stored in the EEPROM of Nodemcu’s Esp, and it shows connected to the Wi-Fi but still it shows offline to my Blynk Project. why is it happening only with my University Wi-Fi routers ?

Most likely, you are trying to connect using port 80 which is probably blocked by your university.
You could try port 8080 instead. Exactly how you do this will depend on which method you are using to initiate the Blynk connection, which you haven’t shared with us.

If port 8080 doesn’t work either then you’ll need to talk to the IT guys at the university.

If your university login is via a web portal then I don’t think you’ll be able to do it,

Pete.

AsyncWebServer server(80);
I am using this to create a web server at port 80, should i just replace this with 8080 ?

Impossible to say, based on one line of code.

If this actually means that you’re using code that uses WifiManager or something similar to create a captive portal to allow you to input your credentials then AsyncWebServer server(80) probably relates to the port used to serve-up that captive portal as opposed to anything else.

Are you connecting to Blynk using Blynk.begin, or by using Blynk.config and Blynk.connect?

Pete.

if (Credentials.credentials_get())
{

Blynk.config(auth_token);
connected_to_internet = 1;

}
else
{
Credentials.setupAP(esp_ssid, esp_pass);
connected_to_internet = 0;
}

i don’t know how to change the “Port” from 80 to any other “Port”. or why our University would block port 80?

The syntax for Blynk.config when specifying a connection port is this:

Blynk.config(auth, server, port)

in your case, using the Blynk cloud servers, the command would be:

Blynk.config(auth_token, "blynk-cloud.com", 8080);

It’s a standard corporate network security configuration, and it’s becoming increasingly common for domestic ISPs to do it also. Do a bit of googling and educate yourself about why this is done if you want to learn more.

Pete.

in my code I don’t have Blynk.connect command, it only has Blynk.config, so just by replacing the Blynk.config(auth_token) with Blynk.config(auth_token, “blynk-cloud.com”, 8080) will change the Blynk Port number ?

If you read the documentation you’ll see that the first instance of Blynk.run() will cause Bl6nk.connect to be executed…

Blynk.config()

config() allows you to manage network connection. You can set up your connection type (WiFi, Ethernet, …) by yourself, and then call:

Blynk.config(auth, server, port);

or just

Blynk.config(auth);

NOTE: After Blynk.config(...) is called, your hardware is not yet connected to the server. It will try to connect while until it hits first instance of Blynk.run() or Blynk.connect() routine.
To skip connecting to the server or to disconnect manually, call Blynk.disconnect() after configuration.

Use connectWiFi to conveniently set up WiFi connection:

Blynk.connectWiFi(ssid, pass);

To connect to open WiFi networks, set pass to an empty string ( "" ).

Personally, I like to control when the Blynk connection occurs, so always use Blynk.connect.

Pete.

can I try Blynk.config(auth, “blynk-cloud.com”, 8442); ?

You can try whatever you like, but it won’t work.

How Blynk Works?

When hardware connects to Blynk cloud it opens either keep-alive ssl/tls connection on port 443 (9443 for local servers) or keep-alive plain tcp/ip connection on port 8080. Blynk app opens mutual ssl/tls connection to Blynk Cloud on port 443 (9443 for local servers). Blynk Cloud is responsible for forwarding messages between hardware and app. In both (app and hardware) connections Blynk uses own binary protocol described below.

Pete.

1 Like