Saturday, January 14, 2012

Arduino + ENC28J60 Ethernet Module - Part 2

So at the end of my last adventure with the ENC28J60 and my Arduino Uno I got it working with the 0021 IDE  (so I expect it will work with 0022 and 0023 but I have not tested) and the library available from here  using the following wiring to an Uno.

VCC - 3.3V
SCK - Pin 13
SO - Pin 12
SI - Pin 11
CS - Pin 10

After my success with this I thought I'd try it with IDE 1.0 and it failed.  The nuelectronics library for the ENC28J60 does not work (as of writing) with IDE 1.0.

After a little more hunting I found the ethercard library that works with IDE 1.0.  I loaded up the backSoon web server sketch that even uses DHCP to get it's IP addess.

I was beaten and abandoned the effort until today.
Well, not really today as between Thursday and today I have been trawling the web to find anything that would help me and I found it.  Not any official update or guide but a post in the forum for the ethercard with the statement:
a new optional 3rd arg to EtherCard.begin() lets you specify the chip select pin (8..10, default is 8)
Wait a second the EtherCard library uses Pin 8 by default for CS.

So, today I setup up the Arduino and ENC28J60 with the following wiring

VCC - 3.3V
SCK - Pin 13
SO - Pin 12
SI - Pin 11
CS - Pin 8

Started IDE 1.0, loaded the backSoon Sketch.
Compiled and ran it.
Checked my routers list of DHCP clients and there was 1 for Arduino-DB witn an IP of 192.168..1.2
Well an IP address has been assigned
Fired up Firefox and went to

Now it's all about figuring out all the technical gubbins on the library so I can do my own stuff.
I want to be able to send data to a webserver and also read data from a webserver and do something based on the data.

Not asking too much but at the moment I have no idea how to make the most of the EtherCard library so a bit of Googling and testing required.  This will keep me entertained through the cold winter months...

UPDATE August 2012: OK, maybe the cold winter  months passed before I got back to this.  A bit more fun with the ENC28J60 and using a web server coded in PHP to control it.


  1. I'm trying without success to get this library to connect to a simple telnet server and send commands

  2. Hey, just wanted to thank you... this post made me realize about the cspin change... What I do not understand is, why on earth would they change it to 8? the board is not easy to rewire!
    Either way, instead of playing with the hardware side of it, you can just go to the EtherCard.h file in the library and change the csPin variable back to 10 on line 134. Hope this helps someone else!

    1. Hi Mariano,
      Glad to be of use.
      Rather than changing the library which may cause problems when it's updated you can add the pin to the EtherCard.begin() command which means your code will be compatible with newer versions of the library without any fiddling.

  3. Hi,
    I just tried to post on Twitter account using the same library and was successful once. But I cant made it once more. What may be happening? Any idea?

  4. night
    I want to ask.
    how to include libraries that you give to my arduino software?
    please help

  5. Hi,

    Thank you, just got my one woke up too with the library you pointed to!



  6. Hi

    THaaaaaaaaaaaaaaankkks you man really you saved my day :D

    Best regards

  7. It worked!!! thanks a ton :)

  8. Has anyone got this working on the Mega 2560? What pins do you connect up?


Note: Only a member of this blog may post a comment.