Esp 8266 failing to connect

I’ve connected my esp8266 through wifi just fine with the quick start, but it doesn’t work if connecting a device from template.

Sketch (sensitive info redacted), is the same when working and when not working, except BLYNK_TEMPLATE_ID, BLYNK_DEVICE_NAME, BLYNK_AUTH_TOKEN, who I copied from the device page when creating new device from template (not working) and from creating new device from quick start (working):

#define BLYNK_TEMPLATE_ID REDACTED
#define BLYNK_DEVICE_NAME REDACTED
#define BLYNK_AUTH_TOKEN REDACTED



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


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

char auth[] = BLYNK_AUTH_TOKEN;

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

BlynkTimer timer;


// 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(9600);

  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run();
}

Output:

[4307] Connected to WiFi
[4307] IP: 192.168.0.101
[4307] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP8266

[4384] Connecting to blynk.cloud:80
[4831] Redirecting to fra1.blynk.cloud:80
[4833] Connecting to fra1.blynk.cloud:80
⸮⸮⸮Ԝ[71] Connecting to REDACTED

When not working it repeats every 30 seconds, and on the device page it shows “online” “offline”. When working, the last line is replaced with

[5052] Ready (ping: 85ms).

Your post is a bit confusing… Although there seems little wrong with your sketch, try a plain sketch which only connects to the esp and see if there’s any difference in connection…

Is the esp well enough in reach to your router?

yes, and it works and connects, but only when I put the values corresponding to the quick stark device (or when I connect to wifi without blynk). the only difference between working and not working is if I do the quick start device or I try to create a device myself.

Can you post the serial output that you see when using the QuickStart Device and getting a working connection.

Pete.

corrected the last line in my original post (accidentally wrote not working twice :no_mouth:), It has the output

I’ve connected my esp8266 through wifi just fine using the quick start, but it doesn’t work if connecting a device created from template. when it doesn’t work it alternating between online and offline in the device page, and repeat trying to connect in the serial monitor.

Sketch (sensitive info redacted), is the same when working and when not working, except BLYNK_TEMPLATE_ID, BLYNK_DEVICE_NAME, BLYNK_AUTH_TOKEN, who I copied from the device page when creating new device from template (that’s not working) and from creating new device from quick start (working):

#define BLYNK_TEMPLATE_ID REDACTED
#define BLYNK_DEVICE_NAME REDACTED
#define BLYNK_AUTH_TOKEN REDACTED



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


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

char auth[] = BLYNK_AUTH_TOKEN;

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

BlynkTimer timer;


// 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(9600);

  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run();
}

Output when not working, repeats every 30 seconds:

[4307] Connected to WiFi
[4307] IP: 192.168.0.101
[4307] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP8266

[4384] Connecting to blynk.cloud:80
[4831] Redirecting to fra1.blynk.cloud:80
[4833] Connecting to fra1.blynk.cloud:80
⸮⸮⸮Ԝ[71] Connecting to REDACTED

output when working:

[4307] Connected to WiFi
[4307] IP: 192.168.0.101
[4307] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP8266

[4384] Connecting to blynk.cloud:80
[4831] Redirecting to fra1.blynk.cloud:80
[4833] Connecting to fra1.blynk.cloud:80
[5052] Ready (ping: 85ms).

@gh456 I’ve merged your new topic into this existing one.
Please don’t just abandon an existing topic and start a new one about the same issue.

Pete.

ok, I think I’ll just stop using Blynk as it just doesn’t work, and I can’t find anywhere support to fix errors

I asked you to provide the two serial outputs on 23rd August, and you’ve just provided them today (29th August). Then, within 5 hours of doing that you’re complaining that you’re not getting any support.

If you think that a user community support forum works that way then you’re mistaken.

I’d be happy to donate my time to try to help you resolve this issue, but not if it takes you almost a week to respond then you expect a solution within a few hours. And, not if you’re going to create moderator admin work for me by making me merge multiple posts on the same subject back into the correct topic.

Pete.

1 Like

I don’t care to get into internet arguments, but saying " the output is exactly the same except the last line" and then giving the changed line seems to me like providing the serial output, which I did from the start, I might have some grammar errors here and there, but nitpicking it doesn’t help. I know it’s a community support so nobody owes me anything, that’s why I’m not mad at anybody for not trying to help, I’m just leaving it or trying to use Blynk. At first it seemed like more of a hassle, and much uglier, but using the native ESP8266WiFi library alone to create my own server is better, because it actually works

You didn’t actually say…

What you said was…

Which is potentially very different. I was interested in information about whether the redirection was taking place in both situations, and why there was a need to redact information from the first serial output.
However, that takes a two-way conversation and for me they don’t work when the responses take a week to come through.

I’ve marked this as solved, as it seems that no further input is needed from community members because you’re using a different solution.

Pete.

1 Like