Project lost in connection

Hi everybody,
First of all, I’m totally new in everything linked to automation, Arduino and such things, so please be indulgent.
the only few experience I have is in Pascal programmation.

I ask your support for a project I made to monitore conditions in my greenhouse (moisture, temperature, luminosity).
I use an Arduino Mega, with Ethernet shield W5100 and SD-card 64GB.
I did build the sketch through the Blynk builder, and adapted it to my needs (so for sure, the code is not “state of the Art”).

Everything was working well, reporting values to the Apps on my different mobile devices, with no connection issue at all.

Then, the 15 Feb, the connection was lost, and I had no chance to connect again since this date. Since this, I try to keep back my connection without success. Here are the things I did or check:

  • library updates
  • network updates
  • check connection using other sketches
  • changed Ethernet board
  • reviewed again and again forums for same topics,and tried solutions
  • recreate a Project in my mobile App

I still get the message “[3] Getting IP…”

At this point, as you can imagine, I’m a little bit lost, and the last hypothesis I have is that my card IDE was damaged, for any reason (waiting a new card to check this). It is even more disappointing since everything was perfect, and I have no clue why it stopped suddenly.

This is why I created this topic: do you have any recommandation or idea which can help me?

As I started this project only to learn and satisfy my curiosity, don’t hesitate to ask for more info…

Check your WiFi router. It is failing to get IP from the WiFi router, it seems.

Do you have any other Arduino with Ethernet shields on your network? If so then disconnect them and see if the one in your greenhouse works. You could have an IP or MAC address conflict if you have multiple devices.

If that isn’t the cause then I’d start by running a basic (non Blynk) sketch on your Arduino, where you specify a static IP address and the address of your router, gateway (same as router) and a MAC address for the Ethernet shield.
Then try pinging your Arduino from a PC on your network to make sure you have connectivity.
Then run a sketch on your Arduino that can ping an external website such as and report the results to the serial monitor. If this works then you know that your Arduino, Ethernet shield, network cable to the greenhouse are working fine.

Let us know what you find when you try this, then post the sketch that you’re currently using (correctly formatted).


Yes, even if I use Ethernet, this is one of my biggest question: why not getting IP suddenly? Mega, Ethernet Shield, home network, Blynk?..

Hi Pete, no, I have only one, and is enough actually :joy::joy:

I will try your recommandations asap. Just to precise, the Arduino is on my desk, not yet in the greenhouse (wanted to make everything OK before installing it).

Thanks both for quick insights

These Ethernet shields are quite unreliable. Just because you’ve changed to another doesn’t mean that you have a good one.
If the LEDs on the Ethernet shield are flashing very quickly then keep nigg8ng th Ernest button until you get a clean reset.
Take a look at the main chip on the Ethernet shields and look for solder bridges between the legs - you might be surprised!

Also, these shields won’t work with some Ethernet switches, so if you’ve changed any other hardware then that could be a factor.
See this thread:

In the long term, you might be better going for something like the Wemos D1 Mini instead of the Arduino and put a wireless access point in your greenhouse to give Wi-Fi coverage for the Wemos.


I did check this and obtained this:

Envoi d’une requête ‘Ping’ avec 32 octets de données :
Réponse de : Impossible de joindre l’hôte de destination.
Réponse de : Impossible de joindre l’hôte de destination.
Réponse de : Impossible de joindre l’hôte de destination.
Réponse de : Impossible de joindre l’hôte de destination.

Statistiques Ping pour
Paquets : envoyés = 4, reçus = 4, perdus = 0 (perte 0%), is the fixed IP of Ethernet Shield is the IP of my computer

It seems strange, no?

Yes, seems strange to me.
I’m sure there are some networking gurus who think this makes perfect sense, but it doesn’t make sense to me!

What happens if you restart your router, and try again?
Do you have a ping app on your phone? - If so, try that when you’re connected to your Wi-Fi and see what happens.

Can you post the code you’re using on the Arduino?


Also, according to this:
it’s worth doing a loopback ping from your PC to to check that there are no TCP/IP issue on your PC.


Before sharing the code, I tried to follow the writing rules, but again, please be indulgent with me :roll_eyes:
Also, do not forget, it worked for many days, even if I changed the place of the Arduino in the house for test purpose.

// Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <DHT.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(0x39, 12345);

char auth[] = "xxxxxxxxxxxxxxxxxxxxxx";

#define W5100_CS  10
#define SDCARD_CS 4

#define DHTPIN 2          
#define DHTPIN1 3 

//#define DHTTYPE DHT11     // DHT 11
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

BlynkTimer timer;

void configureSensor(void)
  tsl.enableAutoRange(true);            /* Auto-gain ... switches automatically between 1x and 16x */
  tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS);  /* 16-bit data but slowest conversions */
  Serial.println("Sensor initialized");

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  float h1 = dht1.readHumidity();
  float t1 = dht1.readTemperature();

  sensors_event_t event;
  uint16_t x = event.light;

  Serial.println("Variables initialized");

  if (isnan(h) || isnan(t))
    Serial.println("Failed to read from DHT sensor!");
   if (isnan(h1) || isnan(t1)) 
    Serial.println("Failed to read from DHT1 sensor!");
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
  Blynk.virtualWrite(V7, h1);
  Blynk.virtualWrite(V8, t1);
  Blynk.virtualWrite(V9, x);

  Serial.println("Variables defined for Blynk");

void setup()
  // Debug console

 Serial.println("Light Sensor Test"); Serial.println("");
  /* Initialise the sensor */
  //use tsl.begin() to default to Wire, 
  //tsl.begin(&Wire2) directs api to use Wire2, etc.
    /* There was a problem detecting the TSL2561 ... check your connections */
    Serial.print("Ooops, no TSL2561 detected ... Check your wiring or I2C ADDR!");
  /* Setup the sensor gain and integration time */
  /* We're ready to go! */
  Serial.println("We are ready to go");
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
  Serial.println("Authentification Blynk");
  // You can also specify server:
  //Blynk.begin(auth, "", 8442);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8442);

  Serial.println("Lancement collecte data");


  // Setup a function to be called every second
  timer.setInterval(5000L, sendSensor);

void loop()

Serial monitor displays the following:
LIght Sensor Test

Sensor initialized
We are ready to go
Authentification Blynk
[21] Getting IP…

I catched the App to Ping from my mobile, but will check tomorrow (IP is not fixed now). I will let you know asap.

You need to do the three back-ticks and CPP ate the start of the code and three back-ticks at the end.

Also, as I said before, you need to be running some basic Ethernet connection code (without Blynk) to make sense of the ping tests.


@Larsouille I edited your post for you … like this

Blynk - FTFC

@Gunner thanks a lot, I understand now, and will follow the rule in future.

@PeteKnight, I put here the sketch which was running perfectly before.
I did test a basic connection yesterday, as per your advice. So I will try to integer this code in my final sketch.

Hi all,

Somebody finally found the solution. This people is probably from my Internet supplier since everything was working well Monday evening when I tried to connect from work (showing the App to a colleague).
Until now, no other disconnection.

@PeteKnight: for me this confirms our doubts we had about connectivity

To all, thanks a lot, even if it solved itself, I learnt a lot with all I read and tried, this is the objective.

1 Like

@Larsouille it could have been the release of the new Core that fixed it

@Costas , I was more thinking about an update of my Internet box done by my Internet provider.

This is the only thing which can have occured between the time my sketch was not working and started to work again. I didn’t touched anything, even turned on the computer :rofl:

But, as you have seen, I m not a specialist.