Continous Disconnection from server

Elegoo Uno (Arduino equivalent)
Ethernet Shield
Blynk Android app

This is my first post here so firstly I would like to say hello and would appreciate any help and suggestions offered to me.

I’m Having trouble staying connected to my Blynk app on my android device (Galaxy S5 Neo)
Fact of the matter is that I was having less of a problem when I had a “Dirty Loop” so to speak but was having trouble none the less.
Now I have followed the standard process and seem to loose connection almost immediately

#include <BlynkSimpleEthernet.h>         //include Blynk Library
#include <Adafruit_Sensor.h>             //Include sensor Library
#include <DHT.h>                         //Include dht sensor library
#include <LiquidCrystal.h>               //Include LCD Library
#include <SPI.h>                         //Include Serial Peripheral Interface (SPI) 
#include <Ethernet.h>                    //Include Ethernet Library
// 29/10/2019
// Authors: ##########################
/*  The LCD circuit:
 * LCD RS pin to digital pin 7
 * LCD Enable pin to digital pin 6
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * LCD VO pin (pin 3)to potentiometer 
// initialize the LCD interface pins
int RS = 7;                               //Register Select Pin
int E = 6;                                //LCD Enable Pin
int D4 = 5;                               //Data Pin 1
int D5 = 4;                               //Data Pin 2
int D6 = 3;                               //Data Pin 3
int D7 = 2;                               //Data Pin 4
LiquidCrystal lcd(RS, E, D4, D5, D6, D7); //Initialize LCD
#define ENABLE 8                          //Enable pin for L293D Microcontroller
#define FanOn 10                           //Direction Pin for fan on Microcontroller 
#define DHT_TYPE DHT11            //Sensor Type
#define DHT_PIN 9                        //Sensor Pin
float temperature;                        //hold temperature
float humidity;                              //hold humidity
DHT dht = DHT(DHT_PIN, DHT_TYPE);         //Initialize Sensor
BlynkTimer timer;
char auth[] = "##############"; //Authentication Key to speak to blink server( Our Project )
bool sendMail = true;                             //Boolean to control when a mail is sent

void setup() {
   * A setup function to initialize pin states
   * Write initial values to Lcd
  EthernetClient client;
  byte mac[] = { 0xA8, 0x61, 0x0A, 0xAE, 0x13, 0x66 };
  Blynk.begin(auth);              //Connect with blynk server , passed ( auth ) our authentication key
  pinMode(ENABLE,OUTPUT);         //Set enable pin as output pin
  pinMode(FanOn,OUTPUT);          //Set FanOn pin as output 
  dht.begin();                    //Begin reading from sensor
  lcd.begin(16, 2);               //set up the LCD's number of columns ( 16 ) and rows ( 2 )
  lcd.print("#########");     //Print first Autor to the LCD
  lcd.setCursor(0,1);             //Move LCD input to next row
  lcd.print("########");       //Print second Author to LCD
  lcd.noBlink();                  //Stop the LCDcursor from blinking
  Blynk.virtualWrite(V3, Ethernet.localIP());
  timer.setInterval(1000L, printBlynkLCD);


void loop() {
   *   This is the main Loop, this function runs continuously


void printBlynkLCD()
   * Function to print to VIRTUAL lcd ( Blynk Server )
   * V0 is the first row on the virtual LCD
   * V1 is the second row on the virtual LCD
    Blynk.virtualWrite(V0, temperature);
    Blynk.virtualWrite(V1, humidity);

Other functions in the Program.
Same results even if these are commented out

void mainChecks()
   * This function will compare the temperature
   * If above 75 -
   * Will write to Virtual Interface
   * Will send warning email ( if applicable ) depends on boolean
   * Will activate the fan ( if applicable ) depends on boolean
   * Will check Humidity levels
   * More functionality to come base on humidity levels
   if(temperature > 75)  //Temperature is too hot
     *Ambient server room temperature is between 18-27*C OR 64-80*F
     *We check if it is above 75F 
     *Humidity is minimum 20% and maximum 80%
      Blynk.virtualWrite(V2, "TO HOT");   //Write to blynk application "To Hot"
      if(sendMail)                        //If sendmail is True , SEND email and set sendmail to False ( prevents sucessive mails )
      {"########", "Temperature Alert","The temperature is "+String(temperature)+". The humidity is "+String(humidity)+".");
        sendMail = false;
      fan(true); //Call the fan function and pass boolean True as a parameter
    else            //Temperature is cool
      Blynk.virtualWrite(V2, "COOL NOW"); //Write to blynk application "Cool Now"
      fan(false);                         //Call fan function and pass boolean False
      sendMail = true;                    // Set send mail back to true

    if(humidity > 75 || humidity < 25)
      // do something

void printToLCD()
   * Function to print to HARDWARE lcd
    lcd.setCursor(0, 0);                                //Set the cursor to COLUMN 1 ROW 1
    lcd.print("Temp     " +String(temperature)+" f");   //Print the temperature
    lcd.setCursor(0,1);                                 //Set the cursor to COLUMN 1 ROW 2
    lcd.print("Humidity " +String(humidity)+" %");      //Print the humidity

void checkTempSensor()
    temperature = dht.readTemperature(true);    //Read the temperature( true returns fahrenheit value ) store in GLOBAL variable temperature
    humidity = dht.readHumidity();              //Get humidity value and store in GLOBAL variable humidity
    if( isnan(temperature) || isnan(humidity))  //Check if return values are not numbers
      Serial.println("Failed to read from sensor! ");

void fan(bool willRun)
   * A Function to operate the Fan
   * Will run if boolean True is passed as parameter
   * Otherwise the fan is deactivated
    analogWrite(ENABLE,255);  //ENABLE ON
    digitalWrite(FanOn,HIGH); //FAN ON
    digitalWrite(FanOn,LOW);  //FAN OFF
    analogWrite(ENABLE,0);    //ENABLE OFF


How long you been running the Ethernet shield? Someone else on here was complaining of similar problems after a while of running the shield. Do you have another device to try the code on?

So how do you know it connects? What’s the serial monitor output?

If you’re using the type of Ethernet shield that has an onboard SD card as well as an Ethernet port then pins 4 and 10 have a special function.
If you’re not using this type of shield then these pins (pin 10 in particular) may still have the function of disabling the Ethernet shield.

My guess is that this wis why you are getting disconnections, because you’re disabling your Ethernet shield so the device can’t talk to the Blynk server.


1 Like

Hi Dave ,
I have had serial print statements in the code for debugging purposes and I also output the Ip to the LCD. I have watched the app every time I have re-uploaded and restarted the board . It immediately connects then disconnects

Hi Peter,

Yes unfortunately I am using the board with the sd card slot aswell and pins 4 and pins 10 in the code, so I guess im going to need a work around . I will try this without the use of both them pins and let you know .

This was the actual problem Peter thank you for taking the time to comment :+1:

No problem!, glad it’s sorted.
These Ethernet shields tend to be a bit unreliable at times. If you’re lucky you have a good one, but if not then you may have a few struggles ahead.
When you finally feel like tying it to the bench and ripping its pins out one at a time, take a read of this:


That’s an Idea Pete but the shield is borrowed from college :slight_smile: . I’m reluctant to buy the LCD attachment to reduce the amount of pins its using so I may just remove the LCD all together, considering the Blynk app can visualise all the information I need.

I have one more problem maybe you can help with.

When I send this ip to be displayed on the server(my app LCD) I’m getting gibberish
1811982528 to be exact.
I’m aware of little endian and big endian but not sure if that’s the cause or if my ip is just interpreted as numbers.

have u any suggestions that can help me

As you’ve stared a new thread about this issue I’ve locked this one.