Raspberry Pi ENC28J60 Ethernet
If you need to add an ethernet interface to a Raspberry Pi model without onboard Ethernet, the obvious approach is to use a USB-ethernet adapter (NB the RPI model B ethernet just uses a USB-ethernet chip anyway). However, if you're using an Raspberry Pi Zero and the only USB port is used by something else, or you need a lower-cost option, you can try the the low-cost Microchip ENC28j60 ethernet controller, which with a few components easily connects to the SPI port on the RPI. The RPI also handily includes a built-in driver for this chip, making this an easy project.
ENC28j60 Pin | RPI Pin Name | RPI Pin # |
---|---|---|
3v3 | 17 | |
SI | GP10 | 19 |
GND | 20 | |
SO | GP9 | 21 |
INT | GP25 | 22 |
SCK | GP11 | 23 |
CS | GP8 | 24 |
sudo vim /boot/config.txt
Add the following line:
dtoverlay=enc28j60,int_pin=25,speed=12000000
Then reboot.
When the RPi finishes booting, your new ethernet interface should be active!
lsmod | grep enc28j60
enc28j60 18413 0
dmesg | grep enc28j60
[ 3.254954] enc28j60 spi0.0: enc28j60 Ethernet driver 1.02 loaded
[ 3.262417] net eth1: enc28j60 driver registered
And of course, your new interface will be listed when you run ifconfig
.