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

Connection problem - unknown model of Arduino + ESP-01

#1

Hello, can someone help ?

05:48:17.294 -> [527] Connecting to abc
05:48:20.370 -> [3572] AT version:1.3.0.0(Jul 14 2016 18:54:01)
05:48:20.370 -> SDK version:2.0.0(656edbf)
05:48:20.370 -> compile time:Jul 19 2016 18:44:44
05:48:20.370 -> OK
05:48:25.415 -> [8629] +CIFSR:STAIP,"192.144.x.x"
05:48:25.415 -> +CIFSR:STAMAC,"ec:s:f:x:3c:78"
05:48:25.415 -> [8630] Connected to WiFi
05:48:38.509 -> [21702] Login timeout
05:48:52.530 -> [35714] Login timeout
05:49:06.556 -> [49724] Login timeout
05:49:20.567 -> [63734] Login timeout
05:49:34.588 -> [77744] Login timeout
05:49:48.609 -> [91754] Login timeout

-----CODE-----

#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[] = "942d5f6a16024bff98bsadase6761";

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

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

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

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

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

  delay(10);

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

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

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

Esp8266+Arduino will not connect
#2

I’ve moved your post to a new thread, and fixed your code formatting by adding triple backticks at the beginning and end of the code.
Please format your code correctly in future otherwise it will be deleted.

115200 is far too fast for Software Serial. I’d recommend 9600, but you must configure your ESP-01 to use the same baud rate using an AT command.

There are dozens of posts on this forum about how to do that, so do a little searching.

Pete.

1 Like

#3

As long as you are using an Arduino Mega (and a few other models)… then Serial1 is a specific hardware serial port that will run fine at 115200… But you need to confirm all the other usual suspects as well.

Searching this forum for keywords like Arduino and ESP-01 holds ALL the answers for using Arduino with ESP-01…

Serial Crossover

ESP-01 Power

Arduino Code

Debug Diagnostics

Etc.

For example, I use this method for my Mega & ESP-01

//#define BLYNK_DEBUG   // Advanced diagnostic data... also drastically slows entire sketch
#define BLYNK_PRINT Serial  // This prints to Serial Monitor
#define BLYNK_USE_128_VPINS
#include <ESP8266_Lib.h>  // ESP-01 Link
#include <BlynkSimpleShieldEsp8266.h>  // ESP-01 Link

ESP8266 wifi(&Serial1);  // Pins 18 & 19 on MEGA - For ESP-01 link
BlynkTimer timer;

#define HTB 45  // Set HeartBeat LED pin.

char auth[] = "xxxxxxxxxx";
char ssid[] = "xxxxxxxxxx";
char pass[] = "xxxxxxxxxx";
char server[] = "blynk-cloud.com"; 
// or for local server - char server[] = "xxx.xxx.xxx.xxx"; 
int port = 8080;



void setup() {
  Serial.begin(115200);  // BLYNK_PRINT data - For Serial Monitor
  Serial1.begin(115200);  // Set baud rate - For ESP-01 link
  wifi.setDHCP(1, 1, 1); //Enable dhcp in station mode and save in flash of esp8266
  Blynk.config(wifi, auth, server, port);
  if (Blynk.connectWiFi(ssid, pass)) {
    Blynk.connect();
  }

  // Timed Lambda Function - UpTime counter
  timer.setInterval(1000L, []() {  // Run every second
    Blynk.virtualWrite(V0, millis() / 1000);  // Display the UpTime in Seconds to Widget on V0
  });  // END Lambda Function
}



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

0 Likes

#4

Thankyou for advice and visiting, sorry for my ignorance too sir
now i found the problem, that is my WIFI router is not stable, im trying to connect my esp to MIFI and boooomm, [22473] Ready (ping: 51ms). with no more login timeout

1 Like