Library with example code for the nuelectronics Arduino EtherShield (ethernet shield)
C Processing C++
Latest commit f1e9c7e Mar 30, 2014 @jonoxer Merge pull request #3 from PRO2XY/patch-1
Update enc28j60.c


etherShield Library for Arduino
This library provides Arduino support for the EtherShield from
nuelectronics as well as other boards based on the same design.

Compatible boards include:

 * nuelectronics Ethernet Shield

 * Seeed Studios Ethernet Adaptor

The etherShield library can be downloaded from:

Updated versions of the library can also be obtained from github:

Unzip the library in your Arduino IDE library directory inside the
hardware directory of your Arduino installation. For example:


There are six examples in the etherShield library. You may need to
change the IP address in the example sketch (.pde) files to an
available address within your network range. Each example sketch begins
with network configuration values similar to:

  static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
  static uint8_t myip[4]  = {192,168,1,15};
  static char baseurl[]   = "";

You may also like to change the webpage contents in the print_webpage
function. Note that webpage contents are stored in the PROGMEM (using
the PSTR declaration) to save precious SRAM space.

Library Structure
The library is based on's TCP/IP stack for the Atmega88
and ENC28J60. The main files in the library are:

 etherShield.cpp   Wrapper cpp file, as an Arduino library interface
                   for tuxgraphic's code

 ip_arp_udp_tcp.c  Simplified TCP/IP stack implementation

 enc28j60.c        ENC28J60 SPI routines

 net.h             Network protocol definitions

TCP/IP Implementation
The TCP standard is a protocol to establish a connection. To do this, a
number of packets needs to be exchaged between two sides first to
establish the connection; then data packets can be exchanged. Usually a
complicated state-machine is needed to implement the full TCP protocol.

For Arduino's ATMEGA168, an 8-bit AVR microcontroller with only 1K SRAM,
it is impossible to implement the full TCP stack. However, a webpage
to control a relay or read a temperature sensor etc, is very simple.
Therefore, instead of implementing the full TCP protocol a single data
packet TCP protocol is used. Your webpage contents, including all HTML
tags, must fit within a single packet. The length of packet is limited
by the SRAM size. Currently half of the RAM space (500 bytes) is used
for the network packet buffer which is sufficient for simple webpages as
shown in the included examples.