cheap spi ethernet module with arduino - enc28j60 - pinout

ok, i really tried to find how to connect this cheap module I bought out of chinaland and yet I can't find any details on which pin goes where on the arduino. While i'm a complete rookie on this, i'm sure those of you who builded your own ethernet shield will know what goes where.

pins on the module I can use are:

-vcc
-gnd
-cs
-reset
-si
-sck
-wol
-so
-clkout
-int

I tried looking at the ethernet examples (i.e. web server) but i'm guessing that pins are setup in the ethernet library as I can't find any indication about these.

the picture of what I bought is here:

Imgur

thanks for the help! If someone can tell me what goes where I'll write a quick how to so dummy like me will have a place to go! thanks!

grido:
ok, i really tried to find how to connect this cheap module I bought out of chinaland and yet I can't find any details on which pin goes where on the arduino. While i'm a complete rookie on this, i'm sure those of you who builded your own ethernet shield will know what goes where.

pins on the module I can use are:

-vcc
-gnd
-cs
-reset
-si
-sck
-wol
-so
-clkout
-int

I tried looking at the ethernet examples (i.e. web server) but i'm guessing that pins are setup in the ethernet library as I can't find any indication about these.

the picture of what I bought is here:

IMG_0344 | arduino ethernet module enc28j60 | MethodMath | Flickr

thanks for the help! If someone can tell me what goes where I'll write a quick how to so dummy like me will have a place to go! thanks!

Hello,
I have one of this module and I'm writing an Arduino library to ENC28J60-based Ethernet modules. Please see the library at: GitHub - turicas/Ethernet_ENC28J60: [NOT MAINTAINED, NOT COMPLETED] Implementation of an Arduino-compatible socket layer library that uses Microchip ENC28J60 Ethernet controller.

About the pins, ENC28J60 communicates with Arduino using SPI - and the pins for SPI in Arduino are digital 10-13, where you need to connect: 10 to CS, 11 to SI, 12 to SO and 13 to SCK. Also connect VCC to 3.3V, GND to GND and RESET to GND.

Please tell me if it works.

hi alvaro,

thanks a lot for this. I will try it out over the week-end and report back here.

stay tune!

thank you

hi,

tried the web server example in your library (after downloading it) and im getting this error message about spi library. I tried looking up the spi library on arduino.cc but they are saying its already included in the software. any idea what i`m doing wrong?

thanks

error below:

In file included from C:\Users\mduperre\Desktop\arduino-0022\libraries\Ethernet_old\Client.cpp:1:
C:\Users\mduperre\Desktop\arduino-0022\libraries\Ethernet_old\utility/w5100.h:14:17: error: SPI.h: No such file or directory

As of Arduino 0019, the Ethernet library depends on the SPI library.
You appear to be using it or another library that depends on the SPI library.

oups, I only had to add this in the header of your example:

#include <SPI.h>

still doesn't work though. I'm not getting in output in the serial box even when using web server debug example. lights on the nic are blinking up. i removed the link between reset and the gnd as you suggested since it was causing those lights to not blink at all, and the store where I bought this module finally added some diagram and they are not making this connection either (http://www.geeetech.com/DOCUMENTS/Arduino/arduino%20shield/ENC28J60_Network_Module/ENC28J60.pdf)

i'll keep testing, let me know if you have an idea why it isn't working. thanks for the good work!

Have a look at the nuelectronics ethernet shield. It is enc28j60 based, it comes with schematics and they have example code.

grido:
hi,

tried the web server example in your library (after downloading it) and im getting this error message about spi library. I tried looking up the spi library on arduino.cc but they are saying its already included in the software. any idea what i`m doing wrong?

thanks

error below:

In file included from C:\Users\mduperre\Desktop\arduino-0022\libraries\Ethernet_old\Client.cpp:1:
C:\Users\mduperre\Desktop\arduino-0022\libraries\Ethernet_old\utility/w5100.h:14:17: error: SPI.h: No such file or directory

As of Arduino 0019, the Ethernet library depends on the SPI library.
You appear to be using it or another library that depends on the SPI library.

Please remove (or move to another place) any Ethernet* directories at your "libraries" folder. Arduino IDE has a bug and in your tests it is compiling the library at "Ethernet_old" -- and how I can see in the error, it uses the standard Arduino Ethernet library, because the error occurs at line 14 of file "utility/w5100.h". So, move this folder, put Ethernet_ENC28J60 folder at libraries and try again with File > Examples > Ethernet_ENC28J60 > WebServerSimpleLED or other.

Hi alavaro,

i'm red of shame, I should have noticed it was complaining about my old ethernet library. I removed thse other libraries and it's seems to be working now. I'm able to ping and get a reply from my module (ye!) but the web server ain't working. I'm guessing it's because i'm using firefox. I'll give the pachube a try later today when I have some time. thanks a lot!!! I'll report any bugs.

grido:
i'm red of shame, I should have noticed it was complaining about my old ethernet library. I removed thse other libraries and it's seems to be working now. I'm able to ping and get a reply from my module (ye!) but the web server ain't working. I'm guessing it's because i'm using firefox. I'll give the pachube a try later today when I have some time. thanks a lot!!! I'll report any bugs.

Very nice! Please test WebServerSimpleLED example using a light browser like wget or curl (for now the library have some memory issues with the size of the request).

Hi !
WebServerSimpleLED runs on my side .... whis some greater buffer
utility/socket.c : #define BUFFER_SIZE 650

webled.jpg

al1fch:
Hi !
WebServerSimpleLED runs on my side .... whis some greater buffer
utility/socket.c : #define BUFFER_SIZE 650

Very nice! Thanks for testing - wait for new versions of the library. :wink:

:slight_smile:

Very Very Nice Library ! ! !

Now the code it is clear and you can print only the code you need :slight_smile:

Well Done ! ! !

I would like to ask you for an example because i have stuck.

I want to put a text box in the web form to get time for example how much sec. the pin 4 stay on, so my question is how to the value ? the number it is not standard e.g. 10 Sec, 250 Sec ....

for to get the box it is the easy, but ...

client.println("<form METHOD=get action="http://192.168.2.20">");
client.println("
Set time On<input type="text" name="timehold">");
client.println("");
client.println("<input type=submit value="Stay on" >

");

How can i read the values from timehold ?

Do i have any error on above code ?

Thank you in advance.

and that

client.println("<form Action = "/" Method ="GET" >");
client.println("

Enter Time On:

");
client.println("<input type ="text" name ="timetext" size = "4" value ="1"> ");
client.println("<input type = "submit" value ="OK" > ");
client.println("");

but i don't know how to hold the the timetext :frowning:

Hello,

Can some one tell me how i will get the last numbers in a variable after the cmd ?

http://127.0.0.1:90/?cmd=133
http://127.0.0.1:90/?cmd=1
http://127.0.0.1:90/?cmd=1335
http://127.0.0.1:90/?cmd=A1
e.t.c.

Thank you in advance.

Code for that sort of thing is part of...

... and yes, it is code for the Ethernet controller chip you have, not the more widely used (and more expensive!) W5100

But... it uses a different library, I think. Details there, though.

Thank you for the reply.

What i need from the bellow is :

char *datahold;

http://127.0.0.1:90/?cmd=133 -> here i want the datahold = 133
http://127.0.0.1:90/?cmd=1 -> here i want the datahold = 1
http://127.0.0.1:90/?cmd=1335 -> here i want the datahold = 1335
http://127.0.0.1:90/?cmd=A1 -> here i want the datahold = A1

What i have make so far is:

#include <Ethernet.h>

byte mac[] = { (byte)0xDE, (byte) 0xAD, (byte) 0xBE, (byte) 0xEF, (byte)0xFE, (byte) 0xED };
byte ip[] = { 10, 0, 0, (byte) 177 };
Server server(90);

void setup(){
Ethernet.begin(mac, ip);
server.begin();
Serial.begin(9600);

pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
}

void loop(){
String readString="";

Client client = server.available();
if ( client ) {
boolean current_line_is_blank = true;
while (client.connected()) {
if ( client.available() ) {
char c = (char)client.read();

//read char by char HTTP request
if (readString.length() < 100) {

readString += c;
//Serial.print(c);
}

if (c == '\n' && current_line_is_blank) {
//Serial.println(readString);

///////////////////////////////

/////////////////////
if(readString.indexOf("123") > 0)
{
digitalWrite(4, HIGH);
}
if(readString.indexOf("133") > 0)
{
digitalWrite(4, LOW);
}
//clearing string for next read
readString = "";

//////////////////////////////

// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

client.print("

Test Web Server

"); client.print(""); client.print("");

// output the value of each analog input pin
for (int i = 0; i < 6; i++) {
client.print("


");
}

// give the web browser time to receive the data

client.print("");
////////////////////////////////

client.print("

");
client.print("\r\n");
client.print("Enter value (0..255):\r\n");
client.print(" ");
client.print("\r\n");
client.print("");
client.print("
");

///////////////////////////////

break;
}
if (c == '\n') {
// we're starting a new line
current_line_is_blank = true;
} else if (c != '\r') {
// we've gotten a character on the current line
current_line_is_blank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
client.stop();
}
}

If i type 123 then the led turn on, if i will type 133 then the led it is turn off so far so good, but there i compare numbers that i know, me i would like put a random number e.g. 10 and this it will hold the pin 4 for 10Sec on, if i will type 60 then it will hold the pin 4 on for 1 minute.
I don't know how to read the correct length of number, can some one please help me ?

Thank you in advance.

Analog Pin Value
");
client.print(i);
client.print("
");
client.print(analogRead(i));
client.println("

:roll_eyes:

No one know or you don't understand my question ?

I've tried using your library with pachube example and it's not working. I'm not reaching the area of the code where I talk to pachube server.

only thing that works is the web server example where I can ping my arduino. that's about it.