My device is offline

i just used my Blynk app some minutes ago and everything was working fine. my Esp01 is connected to Wi-Fi but my device is still offline on the app.



#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[] = "6sn0NXi7s5iTUVEgCZ-klLNPHPLP-4qr";


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

// 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);
BlynkTimer timer;
/*
DC Voltmeter 
An Arduino DVM based on voltage divider concept
T.K.Hareendran
*/
int value = 0;
int adcValue = 0;
int sensitivity = 66;
int offsetVoltage = 2500;
double adcVoltage = 0;
double currentValue = 0;
double currentValueB = 0;
double power_solar = 0;
double power_Battery = 0;
int analogV = A3;
int analogI = A6;
int analogV_1 = A5;
int analogI_1 = A4;
float iout = 0.0;
float iin = 0.0;
float vout = 0.0;
float vin = 0.0;
float vin2 = 0.0;
float R1 = 10000.0; // resistance of R1 (100K) -see text!
float R2 = 3300.0; // resistance of R2 (10K) - see text!
float R3 = 10000.0; // resistance of R1 (100K) -see text!
float R4 = 4700.0; // resistance of R2 (10K) - see text!
int trigPin = 11;    // Trigger
int echoPin = 12;    // Echo
long duration, cm;
int relay_pump1 = 8;
int relay_pump2 = 9;
int relay_pump3 = 7;
int relay_reserve = 6;
void setup(){
  Serial.begin(9600);

  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  pinMode(analogV, INPUT );
  pinMode(analogI, INPUT );
  pinMode(analogV_1, INPUT );
  pinMode(analogI_1, INPUT );
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  timer.setInterval(10000, sendSensors);
}
void sendSensors(){
   //This sedtions deals of voltage sensor of solar
   value = analogRead(A1);
   vout = (value * 4.96) / 1023.0; // see text
   vin = vout / (R2/(R1+R2)); // Applying voltage divider rule
   
   // This section deals with the current sensor of solar
   adcValue=analogRead(A2);
   adcVoltage = (adcValue / 1023.0) * 5000;// read the value at analog input
   currentValue = - ((adcVoltage - offsetVoltage) / sensitivity); 
   power_solar = ( vin * currentValue); // For the power coming from the solar panel
   if (vin<0.09) { vin=0.0;  } //statement to quash undesired reading !

  // This section deals with battery voltage sensor
   value = analogRead(A3);
   vout = (value * 4.96) / 1023.0; // see text
   vin2 = vout / (R4/(R3+R4)); // Applying voltage divider rule
   
 //This section deals with battery current voltage 
   adcValue=analogRead(A4);
   adcVoltage = (adcValue / 1023.0) * 5000;// read the value at analog input
   currentValueB = - ((adcVoltage - offsetVoltage) / sensitivity); 
   power_Battery = ( vin2 * currentValueB); // For the power coming from the solar panel
   if (vin<0.09) { vin=0.0;  }         //statement to quash undesired reading !
    Serial.print("Output V = ");
    Serial.println(vin);
    
    Serial.print("Current A = ");
    Serial.println(currentValue);
    
    
    Serial.print("solar power W = ");
    Serial.println(power_solar);
    
    Serial.print("Output V = ");
    Serial.println(vin2);
    
    Serial.print("Current A = ");
    Serial.println(currentValueB);
    
    
    Serial.print("Battery power W = ");
    Serial.println(power_Battery);
    //Serial.println();

    digitalWrite(trigPin, LOW);
  delayMicroseconds(5);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
 
  // Read the signal from the sensor: a HIGH pulse whose
  // duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
 
  // Convert the time into a distance
  cm = (duration/2) / 29.1;     // Divide by 29.1 or multiply by 0.0343
  Serial.print("Depth: ");
  Serial.print(cm);
  Serial.print("cm to max capacity.");
  Serial.println();
  Serial.println();
  Blynk.virtualWrite(V5, power_solar);
  Blynk.virtualWrite(V6, power_Battery);
  Blynk.virtualWrite(V0, currentValue);
  Blynk.virtualWrite(V1, currentValueB);
  Blynk.virtualWrite(V2, vin);
  Blynk.virtualWrite(V3, vin2); 
  Blynk.virtualWrite(V7, cm); 
  delay(3000);
}
void loop(){
  Blynk.run();
  timer.run();
  }

The screenshots tell us nothing useful.

Please post your full code, correctly formatted with triple backticks at the beginning and end. Triple backticks look like this:
```

Pete.

@PeteKnight done

In one of your recent topics you had a connection issue, which you said was solved. Now you appear to have a connection issue again. If it’s the same issue then you should ally be updating your previous topic. If it’s not the same issue then maybe whatever you did to fix the connection issue before ought to be what you do to fix this.

The “redirecting to…” message in your serial monitor is happening because your project sits on the 45.55.96.146 Blynk cloud server in New York, rather than whichever server is most local to you. Your ISP’s DNS is resolving Blynk-cloud.com to the IP address of the physically closest Blynk cloud server, and that is then redirecting you to the New York server.

Changing your connection command to:

Blynk.begin(auth, wifi, ssid, pass, IPAddress(45,55,96,146), 8080);

may help.

Pete.

1 Like

Noted. Thank you.