My blynk device goes online for 10 seconds and proceeds to go offline

I’m currently working on an IOT project, using a flow sensor and an Arduino 1 and an ESP-01. My problem is that I am able to connect to Wi-Fi and my device appears online, but after 10 seconds it goes offline. I’m currently using the basic blynk example (thats why my flow sensor is not on the program yet) and the uptime does not update while it’s online.


/*************************************************************
  WARNING!
    It's very tricky to get it working. Please read this article:
    http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

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

// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID           "TMPLxxxxxx"
#define BLYNK_DEVICE_NAME           "Device"
#define BLYNK_AUTH_TOKEN            "YourAuthToken"


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


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

char auth[] = BLYNK_AUTH_TOKEN;

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

// 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 38400

ESP8266 wifi(&EspSerial);

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);

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

  Blynk.begin(auth, wifi, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(auth, wifi, 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 probably caused by the SoftwareSerial port being unable to emulate this baud rate. The Uno simply doesn’t have enough processing power for this.

You should read this for more info on the subject…

Pete.

I did read that and tried 9600 baud rate and it was able to stay online for longer but Im still having the same issue.

Is the uptime updating now?
If not, how is your V2 datastream configured (min/max values, data type etc)?

What does your serial monitor show when the device goes offline?

How is your ESP-01 wired and powered?

Pete.

No, the uptime is still not updating. The virtual pin configuration is the default one, Ive checked multiple times and it should work but it doesn’t.

The serial monitor shows that the connection is up, and I am able yo check on my router and I can see that it’s connected. Once it prints that its ready to ping it goes online on my blynk console. After a couple seconds it goes offline and as long as my serial monitor is open it keeps recconecting, it keeps printing that its ready to ping.

My ESP-01 is wired:
Vin — 3.3 V
EN — 3.3 V (The enable pin, Ive seen its also called CH_PD)
TX — RX
RX — TX
GND — GND

I have tried connecting TX — TX and RX — RX but with that configuration my ESP wouldn’t respond.

Have you tried an external power source ?

Do you mean with a min value of 0 and a max value of 1 ?
If so, then this will never respond to values higher than 1, so won’t display your uptime.

What exactly does it show?

That’s not what your sketch is expecting.

I’ve asked quite a few specific questions and you’ve provided quite a few non-specific answers.
If you need help then you need to get better at providing the information that is requested.

Pete.

1 Like

Yes but it didn`t solve the issue.