[Solved] Failing to connect to blynk cloud

Hi, everybody,

I am using an ESP8266 to connect the Arduino Nano to my WiFi.

I managed to get it all working this afternoon. Then all of a sudden, the serial monitor started spitting out errors which appear to show the module having trouble connecting to the cloud.

  ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.7 on Arduino Nano

[604] Connecting to Riley_2.4GHz
ATE0
AT+GMR
[3866] AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co., Ltd.
Integrated AiCloud 2.0 v0.0.0.3
Build:1.5.4.1 Jan 10 2017 18:32:04
OK
AT+CIPMUX=1
[5006] Failed to enable MUX
AT+CWMODE?
AT+CWJAP="Riley_2.4GHz","Riley"
AT+CIFSR
[10227] +CIFSR:STAIP,"10.0.0.76"
+CIFSR:STAMAC,"5c:cf:7f:3c:d0:6d"
[10232] Connected to WiFi
AT+CIPCLOSE=1
AT+CIPCLOSE=1
AT+CIPSTART=1,"TCP","blynk-cloud.com",8442
AT+CIPSEND=1,37
 4e687629e1ce48d68ae6a68266+CIPCLOSE=1
AT+CIPCLOSE=1
AT+CIPSTART=1,"TCP","blynk-cloud.com",8442
AT+CIPSEND=1,37
 4e687629e1ce48d68ae6a68266+CIPCLOSE=1
AT+CIPCLOSE=1

I do not understand why it stopped working suddenly. I didn’t change a thing, update any libraries or sketches.

FYI, here is the full sketch I am using:

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  This example shows how to use ESP8266 Shield (with AT commands)
  to connect your project to Blynk.

  WARNING!
    It's rather tricky to get it working, please read this article:
    https://github.com/blynkkk/blynk-library/wiki/ESP8266-with-AT-firmware

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

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


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "auth";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Riley_2.4GHz";
char pass[] = "Riley";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//softwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

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

  delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
}

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

the same thing happened with me. what i would suggest is to use a proper power supply. i was powering the whole setup through usb. i just flashed the arduino with a fresh bootloader and the esp8266 with a stable firmware. just try this method

That’s why I moved away from Arduino’s using ESP’s for internet access.

Are you using a breadboard or are all the components fully soldered up, if the former maybe loose connection.

Notice it fails MUX but then moves passed it.

i have the same setup but it works perfectly as long as esp8266 has a stabkle firmware on it. do not use usb for powering things

I think I will be moving away from them after this project. What do you use?

All of the components are fully soldered, I will double check the connections and make sure.

The MUX was failing before when the connection was working but it moves past it still.

The ESP has working firmware on it. I am too scared to reflash it, that is how I managed to brick the last lot of them.

I have used almost all Blynk connection methods over the last 18 months.

The easiest, most reliable and most useful for me are the ESP’s with USB connectors.

So the Blynk board, WeMos, NodeMCU and WioLink type devices.

i have never bricked an esp8266. yep they do get crazy on the serial output and throw garbage. but by pulling gpio 0 to gnd, it always goes into flash mode. you must try flashing. i can connect with you via teamviewer and can flash it for you. if your are comfortable with it

Thank you for the offer. I may need to take you up on that if I continue to have difficulty. I am using a Mac which is why I had issues reflashing last time, I do not own a PC.

As @Costas said, save yourself loads of headache and grab a WeMos style dev board. You just program via the IDE and you’re away laughing!

Wow that sucks. Try boot camp or atleast go for virtual machine. But having windows is a must.

He said that he might go that route if he continues to face the problem.

I have a virtual machine, the problem is still there. I think I would like to try and reflash

I am ready to help. Just let me know if you are comfortable with stranger sharing you pc’s screen

guys please stop kidding:

#define BLYNK_PRINT Serial
...
#define EspSerial Serial

How do you think it’s going to work, if you send both serial prints AND data to the same port?

4 Likes

How is it meant to be written then?

I had it written as
#define EspSerial Serial
and the IDE just spat out errors about it not being declared in the scope.

@Riley_Boon comment out these lines:

#define BLYNK_PRINT Serial

Serial.begin(9600); 

Keep Serial Monitor closed and work in the dark as far as debugging goes.

@Costas thank you for that. Commenting out both those lines fixes up the problem occasionally, however, sometimes it still fails to connect and I have to restart the system a number of times before it starts working

That’s the joy of Nano / Uno with ESP.

1 Like

When I finally get a hold of an ESP, I will ONLY use it with my Arduinos, just to show @Costas that it can be successfully done… I anticipate many years of suffering just to prove my case :stuck_out_tongue:

In all seriousness @Riley_Boon get a proper ESP Dev Board with built in USB… the whole merge boards via serial is an issue, even outside of Blynk.

1 Like