Рет қаралды 43,846
To buy the ethernet module for your Raspberry Pi Zero, just search for ENC28J60 on Ebay.
Connection-scheme for the ENC28J60 on the Raspberry Pi Zero:
clk = not connected
wol = not connected
si = GPIO10
cs = GPIO8
vcc = +3.3v
gnd = 0v / gnd
rst = not connected
sck = GPIO11
so = GPIO9
nt / int = GPIO25
To configure the Raspberry Pi Zero, do the following on the command line:
$ sudo raspi-config
Go to "9 Advanced Options", select "SPI" and Enable it.
edit /boot/config.txt
Add the line:
dtoverlay=enc28j60
That's it. If you want a static MAC-address so that the IP-address does not change at each startup, do the following:
Create the following file: /lib/systemd/system/setmac.service
Add the following contents:
[Unit]
Description=DSet the MAC address for the ENC28J60 enet adapter at eth0
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-eth0.device
After=sys-subsystem-net-devices-eth0.device
[Service]
Type=oneshot
ExecStart=/sbin/ip link set dev eth0 address 00:00:00:00:00:00
ExecStart=/sbin/ip link set dev eth0 up
[Install]
WantedBy=multi-user.target
Replace the "00:00:00:00:00:00", by a MAC-address of your choice, but keep the first pair of zero's. Then do this:
$ sudo chmod 644 /lib/systemd/system/setmac.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable setmac.service