BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

BlynkSimpleEsp8266 going online - offline

NodeMCU Esp8266 with two ds18b20 sending temps to virtual pins on Blynk. The system goes offline hundreds of times a day but only a day or so after being working.

I have eliminated events that would exceed the limits, the sensor readings are more stable. Would this issue be on my network ? It runs on a dedicated network by itself, provided by an Aruba 570 Series Outdoor Access Point 35 feet away from it.

Only data streams shown below

#define BLYNK_TEMPLATE_ID "TXXXXXX"
#define BLYNK_DEVICE_NAME "Tray Washer"
#define BLYNK_AUTH_TOKEN "XXXXXXXXXXXXXXXX"
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "XXXXXXXXXX";
char pass[] = "XXXXXXXXXX";

//#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <LiquidCrystal_I2C.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire oneWireA(D6);
OneWire oneWireB(D7);




DallasTemperature sensorsA(&oneWireA);
DallasTemperature sensorsB(&oneWireB);
BlynkTimer timer;
int lcdColumns = 16;
int lcdRows = 2;
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);

float temp1, temp2;


void setup()

{

  lcd.init();
  // turn on LCD backlight
  lcd.backlight();
  pinMode(D5, INPUT);  // this is the pin that reads if machine is running.
  Serial.begin(115200);
  sensorsA.begin();
  sensorsB.begin();
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(600000L, sendTemps);
  timer.setInterval(30000L, sendalert);
  timer.setInterval(30000L, state);
}


void sendTemps() {

  sensorsA.requestTemperatures();
  sensorsB.requestTemperatures();
  temp1 = sensorsA.getTempFByIndex(0);
  temp2 = sensorsB.getTempFByIndex(0);
  Serial.println(temp1);
  Serial.println(temp2);
  Blynk.virtualWrite(V1, temp1);
  Blynk.virtualWrite(V2, temp2);
  lcd.setCursor(0, 0);
  lcd.print("Dirty ");
  lcd.print(temp1);
  lcd.print((char)223);
  lcd.print("F");
  lcd.setCursor(0, 1);
  lcd.print("Clean ");
  lcd.print(temp2);
  lcd.print((char)223);
  lcd.print("F");
}

void sendalert() {


  if (digitalRead(D0) == HIGH && temp1 < 120) {

    Blynk.logEvent("low_temp", String("Water Temperature Under Threshold Tº: ") + temp1);
    Serial.println("alarm");
  }
}
void state()


{
  if (digitalRead(D5) == HIGH)

  {
   
    Blynk.virtualWrite(V0, HIGH);  // this keeps track of when the machine is running

  }

  else if (digitalRead(D5) == LOW) {

    Blynk.virtualWrite(V0, LOW);
  }
}



void loop() {

  Blynk.run();
  timer.run();
}

I’d put this line back in and see what your serial monitor shows when it goes offline.
I’d probably print the RSSI and free memory to the serial monitor and Blynk to check that you aren’t getting any issues there.

Is your power supply up to the task?

Pete.

1 Like

Would something like this work for that ?

  printWiFiState();

  static int previousQuality = -1;
  int quality = getQuality();
  if (quality != previousQuality) {  // If the quality changed since last print, print new quality and RSSI
    if (quality != -1)
      Serial.printf("WiFi Quality:\t%d\%\tRSSI:\t%d dBm\r\n", quality, WiFi.RSSI());
    previousQuality = quality;
  }
}

I’m not familiar with this command.

Personally I just use a timer to print ‘WiFi.RSSI() and ESP.getFreeHeap()

Pete.