Hardware connecting to blynk server takes long time

Hello, my hardware took too long to connect to blynk server.

im using two VL53L0X sensor and one lcd i2c using esp32S2

when i connect three of them all together, the blynk took too long to connect sometimes forever.

however, when i connect just the sensors (no LCD), the blynk connected, took around 1-2s to connect.
same goes to when i just connect the lcd I2C (no sensors), the blynk took only 1-2s to connect.

Im wondering wheres the problem

LCD and sensors using the same SDA, SDL, GND and VCC pins. is this the reason why?

#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "*************"
#define BLYNK_DEVICE_NAME "ESP32 Fertilizer Mixer"
#define BLYNK_AUTH_TOKEN "*******************"
#define M1A 5
#define M2A 6

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include "Adafruit_VL53L0X.h"


// address we will assign if dual sensor is present
#define LOX1_ADDRESS 0x30
#define LOX2_ADDRESS 0x31

// set the pins to shutdown
#define SHT_LOX1 7
#define SHT_LOX2 6

char auth[] = "jcwJkQMGZ3A181****************";
char ssid[] = "N**************";
char pass[] = "n**********";

Adafruit_VL53L0X lox1 = Adafruit_VL53L0X();
Adafruit_VL53L0X lox2 = Adafruit_VL53L0X();
LiquidCrystal_I2C lcd(0x27,16,2);
BlynkTimer timer;

VL53L0X_RangingMeasurementData_t measure1;
VL53L0X_RangingMeasurementData_t measure2;

void setID() {
  // all reset
  digitalWrite(SHT_LOX1, LOW);    
  digitalWrite(SHT_LOX2, LOW);
  delay(10);
  // all unreset
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);

  // activating LOX1 and resetting LOX2
  digitalWrite(SHT_LOX1, HIGH);
  digitalWrite(SHT_LOX2, LOW);

  // initing LOX1
  if(!lox1.begin(LOX1_ADDRESS)) {
    Serial.println(F("Failed to boot first VL53L0X"));
    while(1);
  }
  delay(10);

  // activating LOX2
  digitalWrite(SHT_LOX2, HIGH);
  delay(10);

  //initing LOX2
  if(!lox2.begin(LOX2_ADDRESS)) {
    Serial.println(F("Failed to boot second VL53L0X"));
    while(1);
  }
}

void read_dual_sensors() 
{
  
  lox1.rangingTest(&measure1, false); // pass in 'true' to get debug data printout!
  lox2.rangingTest(&measure2, false); // pass in 'true' to get debug data printout!

  // print sensor one reading
  Serial.print(F("pump A: "));
  if(measure1.RangeStatus != 4) {     // if not out of range
    Serial.print(measure1.RangeMilliMeter);
  } else {
    Serial.print(F("Out of range"));
  }
  
  Serial.print(F(" "));

  // print sensor two reading
  Serial.print(F("Pump B: "));
  if(measure2.RangeStatus != 4) {
    Serial.print(measure2.RangeMilliMeter);
  } else {
    Serial.print(F("Out of range"));
  }
  
  Serial.println();
}

void sensorpinsetup()
{
  digitalWrite(SHT_LOX1, LOW);
  digitalWrite(SHT_LOX2, LOW);

  Serial.println(F("Both in reset mode...(pins are low)"));
  
  Serial.println(F("Starting..."));
}

void lcddisplay()
{
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Hello, fikhriyah!");
  lcd.setCursor(1,1);
  lcd.print("Hello, Fathul!");
  delay(2000);
  lcd.clear();
}

void setup() 
{
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // wait until serial port opens for native USB devices
  
  

  pinMode(M1A, OUTPUT);
  pinMode(M2A, OUTPUT);
  
  while (! Serial) { delay(1); }

  pinMode(SHT_LOX1, OUTPUT);
  pinMode(SHT_LOX2, OUTPUT);

  //offpumpA();    //default state
  //offpumpB();
  lcddisplay();
  sensorpinsetup();
  setID();
  
  timer.setInterval(1000L, read_dual_sensors);
}
 
void loop() 
{
  Blynk.run();
  timer.run(); 
}

Power issues?

Pete.

what do you mean by power issue?

I mean that whatever strategy you’ve adopted for powering your ESP32, LCD Display and Sensors may not be providing sufficient current at the required voltage to enable all the devices to function correctly.

Pete.

2 Likes

@mcflurrehh A common issue when using the ESP32 is the power supply, the requirement on average is about 120mA without the Wi-Fi switched on. When the Wi-Fi is powered on and a scan is initiated, this current spikes to about 320mA and then settles around 280 to 300mA from there. When peripherals are added i.e. sensors and OLED (or LCD) this can spike to around 400mA, and in rare cases just on 500mA. So if you powering via the USB then this can sometimes be the issue and a BOR happens resulting in an endless loop of restarting.

If possible, add an external power supply or make sure the USB is capable of the 500mA surge current draw.

1 Like

I’d try a basic connection first with no sensors connected. If it works, go on by adding one sensor/widget at a time.

define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "*************"
#define BLYNK_DEVICE_NAME "ESP32 Fertilizer Mixer"
#define BLYNK_AUTH_TOKEN "*******************"

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = "jcwJkQMGZ3A181****************";
char ssid[] = "N**************";
char pass[] = "n**********";

BlynkTimer timer;

void setup() 
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}
 
void loop() 
{
  Blynk.run();
  timer.run(); 
}
2 Likes

yepp blynk is connected. without any sensor or lcd. it took long when i started connected both lcd and sensors

notedd. will try it again

understood! i connect sensor at the lcd at different vcc.sensors at 3.3V and lcd at 5V. and it works! thank you so muchh!!

i connect sensor at the lcd at different vcc.sensors at 3.3V and lcd at 5V. and it works! thank you so muchh!!