How to connect your Arduino to the Internet with the ENC28J60

I’m currently working at a custom messaging system, which will users to exchange encrypted messages. To achieve this I bought an ENC28J60 powered ethernet module, which can be used to connect an Arduino to the Internet (or any other microcontroller that supports SPI). In this short article I want to show you how to connect this module and get it up and running in no time!

The module can be bought on amazon or you can order it from banggood, ali-express, eBay and other cheaper sources, if you can wait for 1-3 weeks.

81kcl03x6sl-_sl1500_.jpg
Figure 1: The ethernet module

However, let’s take a look at the module now. If you want to learn more about the chip itself, take a look at the datasheet. This particular module has the following I/O-Pins, but keep in mind that this might vary, depending on the module you get. But after taking a look at the datasheet, these seem to be the minimum I/O-Pins needed to operate the chip:

 Label Arduino Pin  Description
+5V 5V 5V supply, this might be 3.3V on some modules
GND GND Ground pin
INT/LNT * NC Interrupt output
CLK NC Clock output from ethernet controller
SO MISO (12) SPI output
WOL NC NC; reserved pin, see datasheet.
SCK SCK (13) SPI clock
ST/SI ** MOSI (11) SPI Input
RST NC Reset
CS SS (8/10) *** Chip select
Q3 NC The datasheet says, that this is the RX 3.3V supply

NC = no connection

The numbers in parentheses refer to the Arduino Uno.
* Some boards (like mine) are mislabeled and this pin is labelled LNT instead of INT.
** Some boards seem to have a typo here, so some say SI instead of ST.
*** The official documentation for the used library states that this pin needs to connect to the Arduino’s pin 8, but with my Arduino it’s pin 10, which other users have reported as well.

Arduino Library

For this controller I used the EtherCard library, which works like a charm. It can be downloaded here and the official documentation can be viewed here.

The installation is simple: Download it and then import it to the Arduino IDE. That’s it.

Test

As a quick test, you can load up any of the examples. However I think the “backsoon” example is the best of the available ones. This will run a web server on you Arduino and display a “service unavailable” message, when you visit the site.

I’ll take a closer look at the code later, when I present the project that I’m working on right now, which will use this chip.

Table of contents

How to use a relay module
How to use an ethernet module (You are here)

Image sources

[Figure 1] ethernet module, amazon.de

comment-banner

Advertisements

3 thoughts on “How to connect your Arduino to the Internet with the ENC28J60

Leave your two cents, comment here!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.