0

members

Easy Basics: Project 042a ENC28J60 ethernet module or shield

of Lex C in UNO

Basics: Project 042a

Project name: ENC28J60 ethernet module or shield

Tags: Arduino, ENC28J60 ethernet module, shield, How to Connect the ENC28J60 to an Arduino, Web-Enable your Arduino, Add Ethernet to Any Arduino Project

Attachments: library1, library2 and sketch1, sketch2

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables

4. ENC28J60 module/shield (there are different models) 1 pc

General

We will learn how to connect ENC28J60 to Arduino board and use it.

With this Ethernet module your Arduino can be used to connect to internet capable adapting TCP/IP protocol stacks true Arduino Ethernet library, and web client application to access distributed network sensors. Can adapt EtherCard / EtherShield code library to perform low-level interfacing with network interfaces, a high level routine are provided to allow variety of purposes including simple data transfer though HTTP.

When looking for ENC28J60 ethernet module/shield, you’ll find that there are numerous variations available, and they pretty much all work the same, just the board and pins look different for specific purposes. The only thing that can be tricky is finding the right pins for the right library. If we speak about the ENC28J60 ethernet shield used with Nano combined  are very compact: including the Arduino Nano the setup would be approx. 6.7 cm (~2.6″) long, 1.7 cm (~0.7″) wide, and 1.7 cm (~0.7″) tall – depending on how you use the pins at the bottom and how you mount your Arduino Nano of course. You can choose the top connectors or bottom pins (breadboard) while experimenting, but you could consider cutting off the bottom pins for your final product.

Understanding the ENC28J60

 The number “ENC28J60” actually only refers to a chip developed by Microchip.  This chip has 28 pins and contains a complete stand alone Ethernet controller for a 10BASE-T network connection with an SPI interface so microcontrollers like the Arduino can “talk” to it.

10BASE-T is the same connector you’ll find on your computer (if it has one) to connect with a wire to a network, where “10” indicates a maximum speed of 10 Mbit/sec. That might sound slow, but if you consider that it’s being used by devices like the Arduino, then you can’t really expect massive data loads anyway.

The number “ENC28J60” actually only refers to a chip developed by Microchip.  This chip has 28 pins and contains a complete stand alone Ethernet controller for a 10BASE-T network connection with an SPI interface so microcontrollers like the Arduino can “talk” to it. 10BASE-T is the same connector you’ll find on your computer (if it has one) to connect with a wire to a network, where “10” indicates a maximum speed of 10 Mbit/sec. That might sound slow, but if you consider that it’s being used by devices like the Arduino, then you can’t really expect massive data loads anyway. 10BASE-T uses RJ45 Connectors.

The ENC28J60 is a stand-alone Ethernet controller with an industry standard Serial Peripheral Interface (SPI). The Ethernet Controller (ENC28J60) uses the SPI pins (10, 11, 12, 13) of your Arduino Uno/Due. It is designed to serve as an Ethernet network interface for any controller equipped with SPI. The ENC28J60 meets all of the IEEE 802.3 specifications. It incorporates a number of packet filtering schemes to limit incoming packets. It also provides an internal DMA module for fast data throughput and hardware assisted checksum calculation, which is used in various network protocols. Communication with the host controller is implemented via an interrupt pin and the SPI, with clock rates of up to 20 MHz. Two dedicated pins are used for LED link and network activity indication.

With the ENC28J60, two pulse transformers and a few passive components are all that is required to connect a microcontroller to an Ethernet network.

The ENC28J60 consists of seven major functional blocks:

  1. An SPI interface that serves as a communication channel between the host controller and the ENC28J60.
  2. Control Registers which are used to control and monitor the ENC28J60.
  3. A dual port RAM buffer for received and transmitted data packets.
  4. An arbiter to control the access to the RAM buffer when requests are made from DMA, transmit and receive blocks.
  5. The bus interface that interprets data and commands received via the SPI interface.
  6. The MAC (Medium Access Control) module that implements IEEE 802.3 compliant MAC logic.
  7. The PHY (Physical Layer) module that encodes and decodes the analog data that is present on the twisted pair interface.

The device also contains other support blocks, such as the oscillator, on-chip voltage regulator, level translators to provide 5V tolerant I/Os and system control logic.

ENC28J60 stand-alone Ethernet controller features:

  • IEEE 802.3. Compatible Ethernet Controller
  • Fully Compatible with 10/100/1000Base-T Networks
  • Integrated MAC and 10Base-T PHY
  • Supports One 10Base-T Port with Automatic Polarity Detection and Correction
  • Supports Full and Half-Duplex modes
  • Programmable Automatic Retransmit on Collision
  • Programmable Padding and CRC Generation
  • Programmable Automatic Rejection of Erroneous Packets
  • SPI Interface with Clock Speeds Up to 20 MHz

ENC28J60 schematic is here.

You can find specifications here and here.

Signals and connections of the ENC28J60

As you can see the ENC28J60 ethernet shield (picture above) has similar layout of the pins as Arduino Nano. It is recommended to use it with that Arduino Board. For ENC28J60 ethernet shield (picture above) use the +5V (it has a voltage regulator onboard to handle that), as the 3.3V pin will to work.

CLKOUT -Programmable clock output pin (Not used).

WCL - Not used

MOSI (SI) - MOSI stands for Master Output Slave Input, or in other words: Arduino OUTPUT (data from Arduino to Ethernet Controller).

CS (SS) - SS stands for Slave Select, used to enable or disable the slave device (the Ethernet module in this case).

VCC - connect to 3.3V or 5V (if the ethernet controller has voltage regulator) pin of Arduino

 3.3V - Connect to 3.3V pin of Arduino

INT -  Interrupt output pin. It is only useful if you plan to write your own interrupt driven stack or use a 3rd party stack that requires this interrupt signal (Not used).

MISO (SO) - MISO stands for the opposite, Master Input Slave Output, or: Arduino INPUT (data from Ethernet Controller to Arduino).

SCK - SCK is the clock used for SPI timing.

RESET - RESET 

GND - Connect to GND pin of Arduino

Build the circuit

The following picture shows the needed connections with the Arduino Uno 

Step by Step instruction

  1. Open Arduino IDE.
  2. Plug your Adruino Uno board into your PC and select the correct board and com port
  3. Open up serial monitor and set your baud to 9600 baud
  4. Modify the sketch. Define MAC address and IP address - both should be unique in your network.
  5. Verify and upload the the sketch to your Adruino Uno board.

Summary

We have learnt how to connect ENC28J60 to Arduino board and use it.

Getting the Right Library

UIPEthernet is great for projects that require “print” to be fully implemented and need to be a drop-in replacement for the standard “Ethernet” library. This library is a fully compatible drop-in replacement for the standard Ethernet Library found in your Arduino IDE, which makes it easy to adapt existing examples for use with either the Arduino Ethernet shield for use with the ENC28J60 Ethernet shield. One simply changes the two include lines (“#include ” and “#include “) in standard Ethernet examples to just one include line “#include “.This library has a complete implementation of the “print” function that works the same as the “print” function for “Serial”, keeping code simple and very easy to use.

This library uses the same API as the official Arduino Ethernet. It’s useful to integrate ENC28J60 in project on the same way you integrate Arduino Shield

It is compliant with DHCP, DNS, UDP, TCP, ARP, ICMP.

NB: As it is compliant with classical Arduino Ethernet Lib. you can use Webduino on top of it. Webduino is an Arduino-based Web Server library, originally developed for a class at NYC Resistor. It’s called Webduino, and it’s an extensible web server library for the Arduino using the Wiznet-based Ethernet shields. It’s released under the MIT license allowing all sorts of reuse.

Ethercard seems best for very advanced users. It is commonly used by Arduino users. It has the lack of a simple to use “print” function to sent data.

It is compliant with DHCP, DNS, UDP.

Ethershield (development has stopped). Does not want to compile with latest version of Arduino IDE

ETHER_28J60 (development has stopped). Does not want to compile with latest version of Arduino IDE

Library:

  • See attachments on the begining of this project description. 
  • EtherCardUIPEthernet libraries required for this project - we attached them. Download, unzip them and add to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries or C:\Program Files (x86)\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.

Sketch:

  • See attachments on the begining of this project description. 


Other projects of Lex C
Easy Basics: Project 057a ACR122U NFC Reader of Lex C, Not selected 17-01-2018

Published at 06-11-2017
Viewed: 4454 times