Simple Blynk and Arduino Examples - Login Timeout Error D1 Mini(s)

Using the off the shelf examples provided by both Arduino IDE and Blynk so not posting code as the only thing changed is user/pass for internet connection.

I have checked multiple times that the template id, name and token are correct (copied and pasted from blynk dashboard).

Spent over 12 hours trying to get this first connect attempt to work, read all the “solved” about login timeout errors, changed baud, etc but nothing actually works :frowning:

I get the following from the serial monitor:

6402] Connected to WiFi
[6402] IP: 192.168.1.137
[6402]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v1.2.0 on ESP8266

#StandWithUkraine https://bit.ly/swua

[6528] Connecting to blynk.cloud:80
[13578] Login timeout
[13879] Connecting to blynk.cloud:80

It repeats endlessly…

Ran a script to test connection to blynk.cloud on port 80 to ensure not blocked by ISP and it shows the following:

WiFi connected
D1 mini IP address: 192.168.1.137
Connecting to blynk.cloud…connected

So it seems I have a route to blynk.cloud without an issue but with no other error showing than “Login Timeout” it’s hard to see what the issue is.

I have tested connectivity to other sites without issue also and I have tried three brand new D1 Minis from AZ Delivery and all connect elsewhere but won’t get past whatever is blocking login at blynk.cloud

Any ideas what’s going wrong?

What exactly do you mean by this? Baud rate issues only really relate to situations where you’re using an Ono/Mega + ESP-01

It’s always useful to post the actual code you are using.
When you do, and when you post serial output, you need to use triple backticks at the beginning and end.
Triple backticks look like this:


When you post the code replace sensitive info with “REDACTED”

What version of the ESP8266 code are you using?

What board type are you choosing in the IDE?

Pete.

Hi Pete

Thanks for your response.

In one of the “solved” login timeout posts ([solved] "login time out" problem) someone suggested reducing the baud rate to 9600 and the OP claimed it “solved” his issue.

I am fully up to date on libraries and boards in the Arduino IDE and am using version 3.1.1 of the ESP8266, for example.

For board type I am using “generic esp8266 module” as recommended by the supplier although I have also tried others including D1 mini clone, nodemcu, wemos, lolin etc just in case!

The example script I am using from Blynk is:


  This is a simple demo of sending and receiving some data.
  Be sure to check out other examples!
 *************************************************************/

/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID           "REDACTED"
#define BLYNK_TEMPLATE_NAME         "Quickstart Device"
#define BLYNK_AUTH_TOKEN            "REDACTED"

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "REDACTED";
char pass[] = "REDACTED";

BlynkTimer timer;

// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0)
{
  // Set incoming value from pin V0 to a variable
  int value = param.asInt();

  // Update state
  Blynk.virtualWrite(V1, value);
}

// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
  // Change Web Link Button message to "Congratulations!"
  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}

// This function sends Arduino's uptime every second to Virtual Pin 2.
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V2, millis() / 1000);
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  // You can also specify server:
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

It’s cut and pasted with only the “REDACTED” data changed to what they should be.

My simple test sketch to see if the D1 can connect to blynk.cloud at all is as follows:

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

const char* ssid = "REDACTED";
const char* password = "REDACTED";

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

  // Connect to Wi-Fi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");

  // Print the IP address
  Serial.print("D1 mini IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  WiFiClient client;

  // Connect to domain blynk.cloud
  Serial.print("Connecting to blynk.cloud...");
  if (client.connect("blynk.cloud", 80)) {
    Serial.println("\n successfuly connected");

  } else {
    Serial.println("connection failed");
  }

  delay(5000);
}

Hope those backticks work! :wink:

The result in the monitor shows:


WiFi connected
D1 mini IP address: 192.168.1.137
Connecting to blynk.cloud…
successfuly connected

That won’t prove anything, it doesn’t contain the necessarily code to create a connection to the Blynk server using the auth token and the Blynk communication protocol.
So, it is possible that your ISP is blockythe Blynk protocol or port 80.

You could try one of the SSL examples.

Personally, I’m not a fan of the QuickStart evamples. Actually I’d go further and say that I really dislike them.

You should choose the Lolin Wemos D1 Mini board in the IDE.

Pete.

You need to include Blynk.begin() in setup() and Blynk.run() in loop() . . .

billd

Only one of these (preferably the first one) should be used. The other should be commented-out.

Pete.

Thanks for the assistance guys, in the end it turned out to be simply that for it to connect it needs to go secure.

As soon as I changed the connect to SSL it connected just fine but the default in the examples seems to be non SSL so maybe they are just out of date?

image

The solution was to add this to the sketch if anyone else is suffering the same frustration:

#include <BlynkSimpleEsp8266_SSL.h>

1 Like

You can choose either on the sketch builder, and TBH port 80 will work for the majority of people.

Pete.