With the following post, I’m going to start a tutorial about how to use enc28j60 Ethernet controller with Arduino.
A widely used Ethernet controller is Microchip’s enc28j60: in Internet you can find shields or breakout boards for that chip, usually cheaper than the official one.
Testato correctly suggested me to add a note about the differences between the two controller: the main differece, that surely was the reason why Arduino team chose W5100 chip, is that this controller implements in hardware all the TCP/IP stack, saving MCU resources.
Some companies and hobbists developed Arduino libraries for Microchip’s controller; I’m going to use for these tutorials the EtherCard library by JeeLabs Café.
JeeLabs published its library on GitHub; first download the latest version in a ZIP file:
Open the main folder where Arduino’s IDE is installed (usually C:\arduino-1.0) and decompress the downloaded file into libraries subfolder. In ZIP archive, all the library files are in a folder named “jcw-ethercard-xxx“: rename that folder EtherCard:
Run IDE and check if the library is available:
Before connecting Ethernet shield to the net, you need some parameters:
- MAC address, is a 48bit number that univocally identify each device in the net. Every company that produces network devices owns a code (OUI) that rappresents the address’ first 24bits;
- IP address, is a 32bit number (IPv4) that identify the device in the local network;
- Subnet mask is a 32bit number that allows devices to know if another device belongs to the same local network;
- (usually) gateway is the IP address assigned to a device (router…) that allows to reach devices in different networks.
You need to choose a MAC address not alredy used in your network… in the examples we usually choose MAC addresses with a not already assigned organization code (es. DD-DD-DD).
IP parameters (address, subnet, gateway) have to be consistent with the ones configured to other devices in your local network: an unique IP address and the same subnet mask and gateway.
Sometimes a DHCP server is available, that automatically configures new devices in the network: in a next example I’m going to show how to use this with Arduino.
In the netxt page, you’ll write your first network sketch…
Pages: 1 2