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 nuelectronics.com library available from here http://www.nuelectronics.com/download/projects/etherShield.zip  using the following wiring to an Uno.

VCC - 3.3V
GND - GND
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 https://github.com/jcw/ethercard that works with IDE 1.0.  I loaded up the backSoon web server sketch that even uses DHCP to get it's IP addess.
FAIL...

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
GND - GND
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 192.168.1.2
SUCCESS!!!!!

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. http://winkleink.blogspot.co.uk/2012/08/arduino-ethernet-ethercard-xamp-web.html