Pages: [1]   Go Down
Author Topic: problem with ethernet module  (Read 522 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys, I am having trouble, hoping someone here can shed some light.

I have several different types of ethernet modules that I cant get to work with ANY of my arduinos.

they are all ENC28J60 Based modules, I have attached pictures of the three kinds I have.

I can get this to work just fine when using an ethernet shield, but when I substitute any of my ENC28J60 based modules, nothing at all. the link light comes on, but nothing else.

I am using this code to momentarily push a button on a garage door opener to allow wifi control over the garage door.

This is the module I have connected atm, it is not working, but I want it to work.http://www.elecfreaks.com/store/enc28j60-mini-ethernet-module-33v5v-p-449.html
Can someone help me out?
I have a sketch here
Code:
//ARDUINO 1.0+ ONLY
//ARDUINO 1.0+ ONLY


#include <Ethernet.h>
#include <SPI.h>
boolean reading = false;

////////////////////////////////////////////////////////////////////////
//CONFIGURE
////////////////////////////////////////////////////////////////////////
  //byte ip[] = { 192, 168, 0, 199 };   //Manual setup only
  //byte gateway[] = { 192, 168, 0, 1 }; //Manual setup only
  //byte subnet[] = { 255, 255, 255, 0 }; //Manual setup only

  // if need to change the MAC address (Very Rare)
  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

  EthernetServer server = EthernetServer(80); //port 80
////////////////////////////////////////////////////////////////////////

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

  //Pins 10,11,12 & 13 are used by the ethernet shield

  pinMode(2, OUTPUT);

  Ethernet.begin(mac);
  //Ethernet.begin(mac, ip, gateway, subnet); //for manual setup

  server.begin();
  Serial.println(Ethernet.localIP());

}

void loop(){

  // listen for incoming clients, and process qequest.
  checkForClient();

}

void checkForClient(){

  EthernetClient client = server.available();

  if (client) {

    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    boolean sentHeader = false;

    while (client.connected()) {
      if (client.available()) {

        if(!sentHeader){
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          sentHeader = true;
        }

        char c = client.read();

        if(reading && c == ' ') reading = false;
        if(c == '?') reading = true; //found the ?, begin reading the info

        if(reading){
          Serial.print(c);

           switch (c) {
            case 'door':
              //add code here to trigger on 2
              triggerPin(2, client);
              break;
                      }
                   }

        if (c == '\n' && currentLineIsBlank)  break;

        if (c == '\n') {
          currentLineIsBlank = true;
        }else if (c != '\r') {
          currentLineIsBlank = false;
        }

      }
    }

    delay(1); // give the web browser time to receive the data
    client.stop(); // close the connection:

  }

}

void triggerPin(int pin, EthernetClient client){
//blink a pin - Client needed just for HTML output purposes. 
  client.print("Pushing Door Button for 1 second now... ");
  client.print("<br>");
  client.print("Refresh or Reload to push again. ");
  client.print("<br>");

  digitalWrite(pin, HIGH);
  delay(1000);
  digitalWrite(pin, LOW);
  delay(250);
}


* 1.jpg (25.9 KB, 500x325 - viewed 5 times.)

* bbb832fc-2732-4c96-9e8e-eb5076226829.jpg (62.71 KB, 600x600 - viewed 5 times.)

* BK_ENC28J60_01.jpg (304.25 KB, 760x550 - viewed 6 times.)
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5837
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You must use an ethernet library for the ENC28J60. The standard ethernet library included with the IDE is for the Wiznet w5100 module.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried that. Could you show me? Show me a sample sketch?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what would REALLY help me, is if someone could post a link to a KNOWN WORKING library for the ENC28J60 and a pin for pin schematic, as I am not even positive that I am wiring it correctly being that it is not a snap on shield but rather a separate daughter board.

Also, a simple sketch so I can confirm my enc28j60 is working, and then I should be able to do my projects.
I posted pictures of the three kinds of enc28j60 modules I have already, so if anyone has one of these working in their project, I would really appreciate a hand here.

Thanks so much in advance, I appreciate your time.
Logged

Pages: [1]   Go Up
Jump to: