ENC28J60 DHCP error

Hi Blynkers,
I have this issue

But I can see connected device in router admin panel. Any ideas?
Arduino UNO, pins:
8/10 → CS
11->SI
12 ->SO
13 ->SCK
3.3V → VCC
GND->GND

@asci

There could be limit on your router for number of active devices. Please try to disconnect something.

already tried — nothing. Tested with examples from library https://github.com/jcw/ethercard — they work

Ok than it could be library bug, @vshymanskyy please have a look.

i can’t eavan compile this scatch
i tried allso the ethercard example and it works
i’ve allso installed the arduino uip so that isnt the problem
arduino ide sais:
In file included from C:\Program Files (x86)\Arduino\libraries\blynk-library-0.2.1/BlynkSimpleUIPEthernet.h:15:0,
from ENC28J60.ino:29:
C:\Program Files (x86)\Arduino\libraries\blynk-library-0.2.1/Adapters/BlynkEthernet.h:21:22: fatal error: Ethernet.h: No such file or directory
#include <Ethernet.h>
^
compilation terminated.
Fehler beim Kompilieren.

i hope you can help
could you make a wiringdiagram please

now i tried the beta and it works but i have the same dhcp error

I also have same issue with DHCP and ENC28J6, I’m using arduino nano. DHCP server is up and have enough free IPs in pool. Also when I tried to use static IP it was failed to connect to server also, with timeout error.

Someone does it work? with ENC28J60? Me DHCP error or not work static ip… any idea? :slight_smile:

adding @vshymanskyy here - he should take a look

Please try if it works with original library without Blynk.

Hmmm… upload to Uno : Arduino_softwareSerial example.
This is the console:

[0] Blynk v0.3.0
[5001] Connecting…
[7041] Login timeout
[10041] Connecting.

OR

Upload to Uno:Arduino_serial_usb
and run “.bat” file … hmmm it’s work but yesterday not work :smile:

So, what to do?

If you have ENC28J60, you should use a different example.
Or maybe I don’t understand your situation…

I tried : arduino_ethernet , arduino_ethernet_manual but not work. Maybe user error? :grin:

Please link different example.-what you think

Why use everything else but not the particular example that is named like your hardware?

https://github.com/blynkkk/blynk-library/tree/master/examples/BoardsAndShields/ENC28J60

Same error here …
@Pavel link is not working.

@Utza sketch is in the Arduino IDE and available at https://github.com/blynkkk/blynk-library/blob/master/examples/Boards_Ethernet/ENC28J60/ENC28J60.ino

I found but not work.
i have a warn:
WARNING: Category ‘’ in library UIPEthernet is not valid. Setting to ‘Uncategorized’

in serial monitor i have:

[0] Getting IP…
[60180] DHCP Failed!
[1] Getting IP…

@Costas the ethernet cable is in router not into a ethernet card. It matter?

1 Like

@Utza ethernet cable to router is fine and so is the warning about UIPEthernet.

I’ll dig out my ENC28J60 sketch as I think I had to do a minor mod to the Blynk one.

Take a look at the following. Ensure you enter the relevant IP’s for your router and the Blynk token etc.
I haven’t used it for months so let me know if it fails.

/**************************************************************
 * ENC28J60BlynkTest.ino by Costas   Arduino Ethernet
 **************************************************************
 *
 * This example shows how to use ENC28J60 (UIPEthernet library)
 * to connect your project to Blynk.
 * For this example you need UIPEthernet library:
 *   https://github.com/ntruchsess/arduino_uip
 *
 * Typical wiring would be:
 *  VCC -- 5V
 *  GND -- GND
 *  CS  -- D10  D53 Mega
 *  SI  -- D11  D51 Mega
 *  SCK -- D13  D52 Mega
 *  SO  -- D12  D50 Mega
 *  INT -- D2
 *
 * Button in switch mode connected to D13 (on board LED), Green LED V3, Red LED V4
 * Seconds of up time displayed on V0 and ON / OFF on V1
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
#include <SimpleTimer.h> // here is the SimpleTimer library

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "token goes here"; // Mega Ethernet
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };    //DE:ED:BA:FE:FE:ED
IPAddress arduino_ip ( 192,   168,   10,  120);
IPAddress dns_ip     (  192,   168,   10,   90);
IPAddress gateway_ip ( 192,   168,   10,   90);
IPAddress subnet_mask(255, 255, 255,   0);

bool buttonstatus = true;

SimpleTimer timer; // Create a Timer object called "timer"! 

void setup()
{
  Serial.begin(115200);

  Blynk.begin(auth, "blynk-cloud.com", 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
 
  // check if connected here
  int mytimeout = millis() / 1000;
  bool didweconnect = true;  // assume we connected ok
  while (Blynk.connect(13333) == false) {  // try for 40s to connect, standard is 10s with Blynk.connect()
    // Wait until connected
    if((millis() / 1000) >= mytimeout + 39){ // try for less than 39 seconds, then continue with sketch
      didweconnect = false; // failed to connect 
      break;
    }
  }
  if(didweconnect == false){
    Serial.println("Failed to connect, check Ethernet connections.");   
  }
  else{
    Serial.println("Connected OK");  
  }
  
  
  timer.setInterval(1000L, sendUptime); // send up time in seconds, update display widgets and LED's
  digitalWrite(13, HIGH);  // turn on onboard LED at start up
}

void sendUptime()
{
  Blynk.virtualWrite(V0, millis() / 1000);
  int ledstatus = digitalRead(13);
  if(ledstatus == 1){
    //Serial.println("Onboard LED is now ON ");
    Blynk.virtualWrite(V1, "ON ");
    Blynk.virtualWrite(V4, 0);
    Blynk.virtualWrite(V3, 255);  
  }
  else{
    //Serial.println("Onboard LED is now OFF");
    Blynk.virtualWrite(V1, "        OFF");
    Blynk.virtualWrite(V4, 255);
    Blynk.virtualWrite(V3, 0);  
  }
}

void loop()
{
  if(Blynk.connected()){  // this ensures it doesn't just loop trying to reconnect
    Blynk.run();
  }
  timer.run();
}
1 Like