BLYNK
BLYNK.IO       📲 GETTING STARTED       đź“— DOCS       👉 SKETCH BUILDER

Blynk Edgent Wifi Reconnect

Hey there,

so i got the problem, that after like 5-10 minutes my ESP loses connection to wifi opening up it´s AP and not reconnecting again. The Router is right next to the ESP, so that should not be a Problem. The Router is a 4G LTE wifi router. Maybe i could first try to set a static IP but i have no idea of how to do that with Blynk Edgent. Any other ideas of what could possibly cause that?


/*==============================================================================
 * Blynk Parameter
 *============================================================================*/
#define BLYNK_TEMPLATE_ID "xxxxxxxxx"
#define BLYNK_DEVICE_NAME "xxxxxxxxxx"
#define BLYNK_FIRMWARE_VERSION "1.0.4"
#define USE_SHELLY1
#define BLYNK_PRINT Serial

/*==============================================================================
 * Include Section
 *============================================================================*/
#include "Arduino.h"
#include "BlynkEdgent.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <string>


/*==============================================================================
 * Sensor Bus Parameter
 *============================================================================*/
#define ONE_WIRE_BUS 0

// SensorBus Init
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

DeviceAddress sensor1 = {0x28, 0x7D, 0xE3, 0x3, 0xD, 0x0, 0x0, 0xC0};
DeviceAddress sensor2 = {0x28, 0xFF, 0x64, 0x1E, 0x23, 0xAA, 0xA5, 0x82};
DeviceAddress sensor3 = {0x28, 0x44, 0x89, 0x9A, 0x12, 0x21, 0x1, 0x2B};
DeviceAddress sensor4 = {0x28, 0x87, 0xA, 0x14, 0x12, 0x21, 0x1, 0xA4};
DeviceAddress sensor5 = {0x28, 0xC7, 0x79, 0x5B, 0xB5, 0x21, 0x6, 0x87};
DeviceAddress sensor6 = {0x28, 0x64, 0x4C, 0x14, 0x12, 0x21, 0x1, 0xA1};
DeviceAddress sensor7 = {0x28, 0x37, 0xCE, 0x6E, 0xB5, 0x21, 0x6, 0x22};
DeviceAddress sensor8 = {0x28, 0xC2, 0x41, 0x15, 0x12, 0x21, 0x1, 0x2C};
DeviceAddress sensor9 = {0x28, 0x43, 0x50, 0xFC, 0x17, 0x20, 0x6, 0xE8};
DeviceAddress sensor10 = {0x28, 0xFF, 0x64, 0x1E, 0x23, 0x86, 0x7, 0x1D};

// Sensor Variablen
BlynkTimer SensorTimer;
byte resolution = 9; // Sensor Auflösung
float TempSensor1; 
float TempSensor2; 
float TempSensor3; 
float TempSensor4; 
float TempSensor5; 
float TempSensor6; 
float TempSensor7; 
float TempSensor8; 
float TempSensor9; 
float TempSensor10;

/*==============================================================================
 * BUS Abfrage
 *============================================================================*/
void readBusandSend()
{

  sensors.requestTemperatures();
  TempSensor1 = sensors.getTempC(sensor1) - 8,85 ;
  TempSensor2 = sensors.getTempC(sensor2) - 3;
  TempSensor3 = sensors.getTempC(sensor3);
  TempSensor4 = sensors.getTempC(sensor4);
  TempSensor5 = sensors.getTempC(sensor5) - 3;
  TempSensor6 = sensors.getTempC(sensor6) - 8;
  TempSensor7 = sensors.getTempC(sensor7) - 8,5;
  TempSensor8 = sensors.getTempC(sensor8) - 8,1;
  TempSensor9 = sensors.getTempC(sensor9) - 8,2;
  TempSensor10 = sensors.getTempC(sensor10);
  Blynk.virtualWrite(1, TempSensor1);
  Blynk.virtualWrite(2, TempSensor2);
  Blynk.virtualWrite(3, TempSensor3);
  Blynk.virtualWrite(4, TempSensor4);
  Blynk.virtualWrite(5, TempSensor5);
  Blynk.virtualWrite(6, TempSensor6);
  Blynk.virtualWrite(7, TempSensor7);
  Blynk.virtualWrite(8, TempSensor8);
  Blynk.virtualWrite(9, TempSensor9);
  Blynk.virtualWrite(10, TempSensor10);
}

void setup()
{
  // Sensor init
  sensors.begin();
  sensors.setResolution(sensor1, resolution);
  sensors.setResolution(sensor2, resolution);
  sensors.setResolution(sensor3, resolution);
  sensors.setResolution(sensor4, resolution);
  sensors.setResolution(sensor5, resolution);
  sensors.setResolution(sensor6, resolution);
  sensors.setResolution(sensor7, resolution);
  sensors.setResolution(sensor8, resolution);
  sensors.setResolution(sensor9, resolution);
  sensors.setResolution(sensor10, resolution);
  sensors.setWaitForConversion(false);

  // Blynk init
  BlynkEdgent.begin();

  // 1. Bus-Abfrage
  readBusandSend();

  // Timer init
  SensorTimer.setInterval(10000L, readBusandSend);
}

/*==============================================================================
 * Main Loop
 *============================================================================*/

void loop()
{
  // Start Blynk
  BlynkEdgent.run();
  SensorTimer.run();
}

Thanks in advance!

So i think i might have found something. Using GPIO 0 even with Pullup Resistor as DS18B20 data Pin is a bad idea. The Problem now is that my Shelly 1 has only GPIO 0 and RX TX from UART0 exposed. Is there a way to disable Serial Communication in Blynk Edgent, so i can use either RX or TX as my Data pin?

Is it necessary for you to use Edgent?

What board type are you using?

What GPIOs have you defined for your Shely1 board type in your Settings.h file?

Are you using the SW input on your Shelly1 ?

Pete.

No, it´s not necessary to use Edgent but i quite like the OTA functionality.
The Shally 1 is a ESP8266EX board with 2MB Flash

My Settings.h:

#if defined(USE_SHELLY1) || defined(USE_WEMOS_D1_MINI)

  #define BOARD_BUTTON_PIN            5
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN               4
  #define BOARD_LED_INVERSE           true
  #define BOARD_LED_BRIGHTNESS        255 

I am not using the Switch input.

But what board type are you selecting in the IDE?

The SW input is connected to GPIO5, and GPIO4, which you’re using for the LED is connected to the relay.
That doesn’t make much sense to me.

Then why not just use the OTA without the dynamic provisioning…

Pete.

Thank You, I´ll rebuild the Application to use standard blynk without serial and a fixed IP. I Used the relay output with a small led to show the led state, hust to try.