Ethernet Shield W5100 does not connect to the Blynk server via Switch, only with router

I can not connect an Ethernet Shield W5100 to the Blynk server via Switch, only with router.

Switch Manufacturer: TP-Link
Model: DES-1008A

Wiring diagram:

Code:

 #define BLYNK_PRINT Serial


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

// Token obtidos na Blynk App.
char auth[] = "71............................bc8";

#define W5100_CS  10
#define SDCARD_CS 4

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

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Desmarque o cartĂŁo SD
  Blynk.begin(auth);
  
   /************************************************************* 
   Você também pode especificar servidor local:
   Blynk.begin(auth, "blynk-cloud.com", 8442);
   Blynk.begin(auth, IPAddress (192,168,1,100), 8442);
   *************************************************************/
}

void loop()
{
  Blynk.run();
  
}

When I connect the Ethernet Shield W5100 directly to the router, it works normally
When I connect a PC to the Switch, it works normally.
When I connect the Ethernet Shield W5100 to the Switch, I get the error code from the image above.

I have already configured the static IP, MAC, but the result is the same.
Any help will be appreciated!

This is NOT a Blynk related issue in the slightest… You probably have a bad cable or connection.

The error says it all… start with a NON static IP or MAC configuration (i.e DHCP setup on the shield), and as you mentioned, start from the router… if it works from there but not through the switch, then the issue is in your additional cabling or connections, perhaps even a bad port on the switch.

Only once you have it working via DHCP, all the way through, should you start mucking around with static settings.

1 Like

I think you’re right that question has nothing to do with blynk, sorry!

FWIW, I use a switch between my ethernet shield and router, works just fine. As Gunner said, swap out cables, if you still can’t connect, get a new switch. Also use DHCP, so much easier.

And what is that? Only one should be active (the second overrides the first probably, anyway)

I had a similar problem with a WS5100 Ethernet shield for Arduino. It works fine plugged into the router or a Netgear 5/8 port switch, but if I connect it to a D-link 24 port switch it doesn’t work.
If you google the problem you’ll see that lots of people have reported similar issues with different makes of switches. It seems that many flavours of Arduino Ethernet are very fussy in this way.
You should probably look at an ESP8266 or NodeMCU with built-in Wi-Fi and ditch the Arduino altogether.

Pete.

1 Like

Both are commented on

Yes, see this now :slight_smile: … the formatting…
Still for some reason no connection, as it cannot get an IP from DHCP… is it a passive switch?

I remember reading that many of these these clone or older ethernet adapters don’t actually have an embedded MAC… thus one of the “fixes” was to assign a MAC in the sketch. I wonder if MAC issues will cause data loss when passing data through a switch? @Jurandir if you can find one, try just a simple old school hub.

@Gunner: seems to be already on check list :wink: I would try another switch (but I do have few of them lying around :stuck_out_tongue_winking_eye: )

@marvin7 When I was still fighting with my W5100, I had limited success (even through a switch) by changing around the MAC… sometimes grabbing one from another device, sometimes making one up.

But alas… the stability was sooo bad that I finally just “fixed it” :hammer: and switched to USB-link, since the Arduinos rarely left the workbench anyhow.

Now everything has a super stable Blynk.config() followed by Blynk.connect() communication link :wink:

@Gunner Have you resolved the DHCP error while connecting to network switch?

I didn’t use DHCP much, most of my network is Static. But when I did use the bleeping shield, it sometimes worked, sometimes didn’t (but always over a switch as my router is further away from my workbench).

It finally failed more often then not, so I scrapped it and am now a firm holdout in the USB-Link camp :slight_smile:

If you want to fix it please refer to my post response link below.

I meant that literally… I desoldered anything useful and tossed the rest. Even your posted solution will not be able to bring it back :wink:

Researching here on my problem, I came to suspect that the L2 switches do not work with the Ethernet Shield W5100 because of their characteristics of doing frame switching only via hardware, which happens differently in L3 type routers and switches, which in addition To do frame switching, can also do packet switching, and also via hardware.

Maybe that’s the explanation!
If anyone can complement my reasoning, I will be grateful!

I decided to buy an 8-port router and complete my project, but the question is why a W5100 Ethernet Shield does not work with a switch, but it works with a router (remembering that I bought 02 and none of them worked)

I do not know, what the problem is in your case, but I never had an issue with W5100. Had it connected on top of Uno to a couple of different locations, ALWAYS through some switch, and it always worked. Now it is not used, but still useable (I think… :P) :confused: Some bad “clones” or what? My is a clone too, it’s just the “good one”

Yours was made on a Tuesday afternoon, right after a restful three day weekend :stuck_out_tongue_winking_eye:

he, he… It’s not “signed”, but it must be the case!