ENC28J60 Ethernet Module


Ethernet modules are a whole lot of fun! You can use it to connect your Arduino (and Annikken Andee) to a network (both Internet and Intranet).

With an Ethernet module, you can transform your Arduino into a simple mini web server to display information, or control the Arduino from your browser!

At the same time, you can also use it to upload information to a server or cloud for easy access of information anytime, anywhere.

There are a few types of Ethernet modules that are compatible with the Arduino. The ENC28J60 is one of them! Here's how it looks:

2013-12-19 13.02.21.jpg


Wire Connections

If you got the ENC28J60 ethernet module from our Christmas Development Kit, we have included a ribbon cable to convert the module pins from male to female so that you can use jumper wires to easily connect the module to the Annikken Andee x Arduino.

2013-12-19 13.05.59.jpg

Here's a diagram of the pin connections to the Andee x Arduino:


If you got your ENC28J60 Ethernet Module from somewhere else, here's a photo of the pin connections just for your reference (please note that pin layouts may differ from module to module):

2013-12-19 13.03.41.jpg

Here's the pin layout in text:

  • SO goes to Pin 12
  • SCK goes to Pin 13
  • SI goes to Pin 11
  • CS goes to Pin 10
  • GND goes to GND Pin
  • Vcc goes to +3.3V Pin

In earlier examples/tutorials/lessons, we emphasized strongly that you should not use Pins 11, 12, 13. That's because these pins are used for SPI (Serial Peripheral Interface) Communication. This time, it's perfectly fine to use these pins as the Ethernet module also uses SPI to communicate with the Arduino.

Ethernet Library for Arduino IDE

The library that we recommend is UIPEthernet. It is compatible with both the Arduino and Annikken Andee.

You can download the UIPEthernet library from

Installation Instructions

1. Unzip the zip file. You will see a folder called, UIPEthernet

2. If you are using Windows, copy the UIPEthernet folder to: C:\Users\<username>\Documents\Arduino\Libraries\

If you are using Mac OS X, copy the UIPEthernet folder to: ~\Documents\Arduino\Libraries\

3. Restart Arduino IDE and you're done!

You may have heard of EtherCard or EtherShield. Do not use them as they are incompatible with the Annikken Andee. Do not use Arduino's built-in Ethernet library as it is not designed for the ENC28J60 Ethernet Module.

Understanding the Basics of How Ethernet Code Works in Arduino

Here is a sample basic code to demonstrate how the Ethernet code works in Arduino. The code below will make Arduino run as a simple web server. Give it a try!

#include <SPI.h>
#include <UIPEthernet.h>

// Set your own MAC address for the Ethernet module here:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Set your own IP address for the Ethernet module here:
IPAddress ip(192,168,0,36);
EthernetServer server(80);
// You can access your Arduino server at

void setup()
  // Start Ethernet connection and web server
  Ethernet.begin(mac, ip);

void loop() 
  // Listen for incoming connections
  EthernetClient client = server.available();
  long time = millis();
  if (client) // If a user is connected
    // An HTTP request from the client ends with two end
    // of line characters (\n x2). We'll need code to check
    // for that.
    boolean currentLineIsBlank = true;
    // This flag is used to check if the first end of line character
    // was sent by the client.
    while (client.connected()) // While web client is connected
      if (client.available())
        char c = client.read();

        // Received two end of line characters (\n). Client has finished
        // sending the request. 
        if (c == '\n' && currentLineIsBlank) 
          // Send a standard HTTP response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // Close the connection once the page is fully loaded
	  client.println("Refresh: 2");  // Refresh the page automatically every 2 seconds
          client.println(); // End of HTTP Response header
          // Send HTML page
          client.println("<!DOCTYPE HTML>"); // Start of HTML document
          client.println("<html>"); // Start of HTML code
          client.println("<head><title>Hello World!</title></head>"); // Set page title
          client.println("<body>"); // Start of HTML body
          client.println("<h1>Hello World!</h1>"); // Set header

          // Output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) 
            int sensorReading = analogRead(analogChannel);
            client.print("Analog Input ");
            client.print(": ");
            client.println("<br />");       

          // Display server uptime
          client.println("<p>Server has been running for ");
          client.println(" ms.</p>");
          client.println("</body></html>"); // End of body and HTML page
          break; // End of transmission
        // If client sent one end of line character (\n),
        // raise the flag and see if the next character is another
        // end of line character
        if (c == '\n')
          currentLineIsBlank = true;
        // If client sends a character that isn't an end of line character,
        // reset the flag and wait for the end of line character.
        else if (c != '\r')
          currentLineIsBlank = false;
    // Give the web browser time to receive the data
    // Close the connection

Annikken Andee x Ethernet Tutorials

Please be patient. Andee x Ethernet lessons will be uploaded shortly.

More lessons to come!

comments powered by Disqus