Need help device is always offline

im using w5100 ethernet shield and the notification in the blynk app is “device is offline” i also copied the code in blynk example the w5100 ethernet shield and the blynk blink and still didnt work please help i really need it :cry::cry::cry:

in the serial monitor i always received this message “getting ip” and “dhcp failed” please help:-:cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry:

Do you think a failed DHCP lease is due to

  1. A misconfiguration on your local network, e.g. in your router.
    or
  2. Blynk is crap!

(Hint: it’s no.1 :stuck_out_tongue_closed_eyes:)

1 Like

Or option 3 - the w5100 Ethernet shield is crap!

The shield won’t connect to some routers and switches anyway. They work with Layer 3 switches and routers, but not Layer 2 devices.

If you’re connecting to a Layer 3 device and the LEDs on your shield are flashing rapidly then try resetting your Arduino to See if you can get it connecting correctly.
I’ve found that many of the shields ship with solder bridges across the pins on the main chip. In some cases 5his doesn’t affect the performance, but in others the shield just doesn’t work properly.

I eventually swapped to a NodeMCU device with built-in Wi-Fi instead of the Arduino and Ethernet shield and I’ve never looked back.

Pete.

2 Likes

I might be of a different opinion! :stuck_out_tongue: Compared to the ENC28J60 it’s golden! :smile:

That’s a strange statement :thinking: You kinda need Layer 2 to get to Layer 3… and you need Layer 3 to get to the Internet! The problem with switching might be duplicate MAC-addresses on the network. A stupid and careless person once made the mistake of copying one setup to another without changing the MAC. I afraid can’t tell you who it was without implying myself :rofl:

@Kurt_Tiempo Try using (suitable) static settings for your W5100. Mine look like this:

byte arduino_mac[] = { 0xDE, 0xEA, 0xBA, 0xFE, 0xFE, 0xCC };
IPAddress arduino_ip (192, 168,   0,  20);
IPAddress dns_ip     (192, 168,   0,   1);
IPAddress gateway_ip (192, 168,   0,   1);
IPAddress subnet_mask(255, 255, 255,   0);

i can ping all devices the phone, arduino and the server but still device is offline in the app :cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::sob::sob::sob::sob::sob::sob::sob::sob::sob::sob::sob:

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "42f90c53c83c4*************ef8c97";

IPAddress server_ip (192, 168, 1, 46);

// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 192,   168,   1,  47);
IPAddress dns_ip     (192, 168, 1, 1);
IPAddress gateway_ip (192, 168, 1, 1);
IPAddress subnet_mask(255, 255, 255,   0);

#define W5100_CS  10
#define SDCARD_CS 4

void setup()
{
  // Debug console
  Serial.begin(9600);

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  Blynk.begin(auth, server_ip, 8443, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);

  //Blynk.begin(auth);
  // You can also specify server:
  //Blynk.begin(auth, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, IPAddress(192,168,1,46), 8443);
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

Please format your code:

i already formatted it :blush:

Try port 8442 so your hardware can connect :slight_smile:

Proper way is as shown in the Welcome Topic… NOT using </> as that doesn’t always work

And stop with the emoticon overkill and duplicate posts… just makes us want to ignore your issue even more :wink:

1 Like

still device is offline in the app @distans

Then I don’t know… Could be ports closed on your local server, wrong token or a million other things :frowning_face:

Try a simple sketch without Blynk so you’ll know the ethernet is working. In the Ethernet library there are some examples, like WebClient.ino

Aside from the incorrect port…

It has been a long time since I used an Ethernet adapter… but aren’t you supposed to use something like this to setup the adapter…

Ethernet.begin(arduino_mac, arduino_ip, gateway_ip, subnet_mask);

before attempting the Blynk.begin() or perhaps Blynk.config() at this point, and using only the Blynk required parameters… Not try to cram it all into one line?

what should be the right port @Gunner

I dunno… what do you think? :stuck_out_tongue_winking_eye:

1 Like

<BlynkSimpleEthernet.h> takes care of that :slight_smile:

OK… as stated… looong time since wasting my time on a crappy adapter :stuck_out_tongue: All my past scripts using said adapter with preset config are long gone.

still not working :sob:

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


#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "42f90c53c83c4816b1483b8c18ef8c97";

IPAddress server_ip (192, 168, 1, 46);

// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 192,   168,   1,  47);
IPAddress dns_ip     (192, 168, 1, 1);
IPAddress gateway_ip (192, 168, 1, 1);
IPAddress subnet_mask(255, 255, 255,   0);

#define W5100_CS  10
#define SDCARD_CS 4

void setup()
{
  // Debug console
  Serial.begin(9600);

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
  Ethernet.begin( server_ip, 8442,arduino_mac, arduino_ip, gateway_ip, subnet_mask);
   //Blynk.begin(auth, server_ip, 8443, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);

  Blynk.begin(auth);
  // You can also specify server:
  //Blynk.begin(auth, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, IPAddress(192,168,1,46), 8443);
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}