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.
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:
|+5V||5V||5V supply, this might be 3.3V on some modules|
|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|
|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 labeled 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.
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.
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 your 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)
How to use an EEPROM
How to use the ESP8266 for wireless communication
[Figure 1] ethernet module, amazon.de
6 thoughts on “How to connect your Arduino to the Internet with the ENC28J60”
I‘m glad it helped! 😀