Ethernet LAN Module ENC28J60 ethernet connection

Hello

For my graduation project, I am making a model of a house with domotics integrated.
I want to control my model with my laptop or phone. For that, i bought tis ethernet module.

https://nl.aliexpress.com/item/Ethernet-LAN-Module-ENC28J60-Network-RJ45-SPI-for-Arduino-UNO-2560-AVR-ARM-PIC-USA/32650727120.html?spm=a2g0s.9042311.0.0.27424c4diuFNsJ

I use an Arduino Mega 2560.
Those are the connections I made:

Arduino | Ethernet module
5V | 5V
GND | GND
RESET | LNTCLK
50 | SO
51 | ST(=SI)
52 | SCK
53 | CS

I connected the ethernet gate with my router. Normally the leds from the ethernet gate should blink but the don't. What do i do wrong?

the ENC28J60 handles only the physical layer. everything else does the library. so without the sketch with initialized library (EtherCar or UIPEthernet) the ENC28J60 does nothing

Hi
Even with an example code it doesn't work...
I used this example code from the library"EtherCard.h". The code is called backSoon

// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 <jc@wippler.nl>
//
// License: GPLv2

#include <EtherCard.h>

#define STATIC 1  // set to 1 to disable DHCP (adjust myip/gwip values below)

#if STATIC
// ethernet interface ip address
static byte myip[] = { 192,168,1,180 };
// gateway ip address
static byte gwip[] = { 192,168,1,254 };
#endif

// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[500]; // tcp/ip send and receive buffer

const char page[] PROGMEM =
"HTTP/1.0 503 Service Unavailable\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
"\r\n"
"<html>"
  "<head><title>"
    "Service Temporarily Unavailable"
  "</title></head>"
  "<body>"
    "<h3>This service is currently unavailable</h3>"
    "<p><em>"
      "The main server is currently off-line.
"
      "Please try again later."
    "</em></p>"
  "</body>"
"</html>"
;

void setup(){
  Serial.begin(57600);
  Serial.println("\n[backSoon]");

  // Change 'SS' to your Slave Select pin, if you arn't using the default pin
  if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
    Serial.println( "Failed to access Ethernet controller");
#if STATIC
  ether.staticSetup(myip, gwip);
#else
  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");
#endif

  ether.printIp("IP:  ", ether.myip);
  ether.printIp("GW:  ", ether.gwip);
  ether.printIp("DNS: ", ether.dnsip);
}

void loop(){
  // wait for an incoming TCP packet, but ignore its contents
  if (ether.packetLoop(ether.packetReceive())) {
    memcpy_P(ether.tcpOffset(), page, sizeof page);
    ether.httpServerReply(sizeof page - 1);
  }
}

My serial monitor says only this:

"
[backSoon]"

I have read on the internet that he should print this AND 3 ip adresses...

1 Like

Hi,
I am having this similar issue which Renaut has.
Can someone please help me to resolve this issue as I need to get this result very soon so?

Thank you

Are you sure you have the pin numbers correct - normally:
Arduino Mega: Pin: 52 - SCK Pin: 50 - MISO Pin: 51 - MOSI Pin: 53 - SS for Ethernet Controller

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.