Need help device is always offline

Disregard my guess at using Ethernet.begin() and try again as you had it, but with proper port 8442 this time…

Blynk.begin(auth, server_ip, 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
#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, 8442, 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!
}

still didnt work @Gunner :cry:

   [0] Using static IP
    [1300] IP:192.168.1.47
    [1300] 
        ___  __          __
       / _ )/ /_ _____  / /__
      / _  / / // / _ \/  '_/
     /____/_/\_, /_//_/_/\_\
            /___/ v0.4.8 on Arduino Uno

    [5001] Connecting to 192.168.1.46
    [10002] Connecting to 192.168.1.46

So it looks like you are using a Local Server… is that the correct address for sure? Have you ever connected to it with this or any other device?

Try a similar sketch, but using a Blynk cloud account and server.

yeah im using local server. i can ping all the devices my server, arduino and ip of my phone. i already tried the blynk server but still getting worst serial monitor says ip dhcp error. thanks for answering my questions @Gunner

Hi @distans, More on this issue in this thread:

It’s along time since I used the w5100 shield, but my issue wasn’t caused by duplicate MAC addresses. The shield would work when plugged directly into the router, but not when plugged into a L2 switch that was then connected to the router.

It doesn’t seem that this is the issue in this case, but worth bearing in mind for the future is you’re using these Ethernet shields.

Pete.

thanks @Gunner & @PeteKnight its working

How did you solve it? Could be a good reference for others :slight_smile:

Should I post my comment in the “W5100” thread you linked to? @Gunner isn’t always happy when old threads get bumped, but it would be more related there :smile: Or do nothing since it’s almost an obsolete hardware :slight_smile:

1 Like

I think posting in old threads makes sense if it’s relevant to the topic and not superseded by changes to Blynk or the libraries. That way, when (okay, IF) someone searches for that issue then have all the info in one place.
You could always start with "I know this is an old thread, but…), that way you’re less likely to incur the wrath of the mighty and worshipful @Gunner :grinning:

As you say, it’s not exactly cutting edge hardware anymore, and most people that used Ethernet shields seem to have made the dubious transition to connecting an ESP to an Arduino instead, but it takes all sorts to make the world go Blink.

Pete.

1 Like

And therein lies the problem… it is rarely relevant and more often just an unrelated “Me Toos” leading to a very long and twisting topic full of contradictions and confusion. :wink:

One day I am going to retire from this high paying, low effort ‘job’, then you will all be free :stuck_out_tongue_winking_eye:

I originally started off with USB, then transitioned to Ethernet, then back to USB (which I still use for some devices as it seems rock solid now) and on to a mixture of ESP shields and standalones. But I do not miss the hassle of that flaky Ethernet shield :face_vomiting:

1 Like

i only change the port to 8442 and suddenly it work :heart_eyes:

  /*************************************************************
    Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

    Blynk is a platform with iOS and Android apps to control
    Arduino, Raspberry Pi and the likes over the Internet.
    You can easily build graphic interfaces for all your
    projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                  http://twitter.com/blynk_app

    Blynk library is licensed under MIT license
    This example code is in public domain.

   *************************************************************

    You’ll need:
     - Blynk App (download from AppStore or Google Play)
     - Arduino Uno board
     - Decide how to connect to Blynk
     (USB, Ethernet, Wi-Fi, Bluetooth, ...)

    There is a bunch of great example sketches included to show you how to get
    started. Think of them as LEGO bricks  and combine them as you wish.
    For example, take the Ethernet Shield sketch and combine it with the
    Servo example, or choose a USB sketch and add a code from SendData
    example.
   *************************************************************/

  /* 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, 47);

  // 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,  55);
  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, 8442, 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);
    
  }
  BLYNK_WRITE(V16) // V5 is the number of Virtual Pin  
  {
    int pinValue = param.asInt();
  }
  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!
  }

Wasn’t that like the first thing I told you to correct in your settings? :wink:

1 Like