Тёмный

Adding ethernet to a Raspberry Pi Zero using the GPIO pins (and not the USB port) 

Bas van der Sluis
Подписаться 3,9 тыс.
Просмотров 44 тыс.
50% 1

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

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@georgekj6vu889
@georgekj6vu889 7 лет назад
Thank you thank you thank you. This is excellent and works 100% perfect with a Raspberry Pi Zero W. I found the INT signal necessary to make it work. Thanks also for explaining how to set the mac address.
@GBlanco_Chofo7
@GBlanco_Chofo7 7 лет назад
Thank you very much, my friend, it really helped me. Very well explained.
@sveinarsandvin6418
@sveinarsandvin6418 4 года назад
This video is very helpful. Thank you. Works well with compute module.
@JibunnoKage-cj2kz
@JibunnoKage-cj2kz 11 месяцев назад
The ethernet module uses the SPI interface/bus, he never explains this. Also, be sure to add an AS1117 (3.3v to 5v booster breakout board) so that the board can draw a bit more micro-amps, it really needs about 200 micro-amps to work consistently at load. Will it work at 3.3v, yes, but if you push the module, it will error out. The AS1117 uses 5v in, GND, and out is 3.3v... but the 3.3v it returns has a higher micro-amp capacity then the 3.3v direct from the Pi GPIO 3.3v pin.
@sokoloft3
@sokoloft3 2 года назад
I ordered one. Only 4$ shipped. Need it to run mtr traces to a server from my network. Hopefully this device doesn't introduce any latency or off numbers.
@dj1encore
@dj1encore 3 года назад
Have you tried Ethernet on the pi pico RP2040 ?
@davecc0000
@davecc0000 8 лет назад
Excellent Bas. Thank you! I've been wanting to do this and your vid makes it easy to do. Cheers.
@basvandersluis5662
@basvandersluis5662 8 лет назад
You're welcome!
@ronaldronald8819
@ronaldronald8819 3 года назад
Hi Bas, any change of getting this done on a pi pico?
@sokoloft3
@sokoloft3 2 года назад
Not the fastest thing. Unfortunately it doesn't work for my use case. Interesting nonetheless. I get my full network speed over usb. This ethernet adapter I only get 4Mbps max. Running cat on my trace log file takes a good 20 seconds over ethernet, on usb its maybe 5 seconds max.
@Ed19601
@Ed19601 5 лет назад
The enc28j60 is not so difficult to connect with the available module to load. Supposedly also possible to use W5500, but a lot harder
@jinis2011
@jinis2011 5 лет назад
Hi, do you happen to have instructions for W5200? not working for me. I have dtoverlay=W5200 in /boot/config.txt.
@mahabirshaw5976
@mahabirshaw5976 2 года назад
Thank you sir your information helped a lot .... I was making a server and didn't wanted to waste the only usb port .... I did tried usb splitters but it dosen't work
@cbhargava
@cbhargava 7 лет назад
MAC address is permanent to the device. IP address can change. Also you can configure your router to assign a specific IP address to your Raspberry Pi (or adapter) using the MAC address of our device.
@basvandersluis5662
@basvandersluis5662 7 лет назад
Indeed. But this device gets a random MAC address every time the Pi boots, if you don't create one yourself. Normally a MAC address is a manufacturer + device ID, but this device just does not have one.
@cbhargava
@cbhargava 7 лет назад
For ENC28J60 the software has to provide a MAC so if you don't provide one, it will get random MAC address.
@jonnyc2.047
@jonnyc2.047 6 лет назад
True true why not just add a USB? Hub. But USB hub with power supply include it with the hub so it has extra power because you're well aware USB for connected us BS you just get one with its own power supply, there are about 15 dollars for a nice win 5 to 10 of them. Cause they all have their own power supply can still use your ethernet that you want to use thats faster and still have mouse and all that
@dylancruz1131
@dylancruz1131 5 лет назад
Is it possible to connect two of these to a RPI3? I am designing some Telephone equipment that will run TDM over Ethernet interface, So 10mbps is not an issue. I am wondering if I should invest any time with this solution or just use a USB Ethernet Adapter?
@henry55430
@henry55430 2 года назад
Hey! Lots of great info and thanks for the video! I'm trying to recycle an extra Pi zero I have lying around the house as an LTE modem. I'm thinking it's possible with a USB LTE dongle and an installation of OpenWRT. I was hoping to use this device to give the pi zero Ethernet without impeding on the existing USB port. Is a Mac address necessary to connect this directly to an Android device with a USB to Ethernet adapter? Would config of the pi be any different with OpenWRT installed?
@andigenous9101
@andigenous9101 2 года назад
thank you!
@jonnyc2.047
@jonnyc2.047 6 лет назад
Why not you could if you use the USB hub? Gigabit Ethernet. Because I have no available USB ports, but you would.
@keesservaas898
@keesservaas898 6 лет назад
Super, toen ik dit zag heb ik een Raspberry Pi Zero gekocht en ENC28J60 had ik nog liggen. MQTT draait, thanx!!!
@Sebastian-wm5es
@Sebastian-wm5es 2 года назад
Can I use 2 of these modules with the pi zero?
@darthwater999
@darthwater999 Год назад
people like you enrich the internet, thank you
@python360
@python360 4 года назад
Nice guide man, Is it still running? Just curious as to how reliable the hardware is!
@basvandersluis5662
@basvandersluis5662 4 года назад
Actually yes. It is currently being used as a temperature sensor and it's pushing the temperatures to an api every minute.
@ibrahimaltaha3186
@ibrahimaltaha3186 7 лет назад
i would like to ask, can we build HSR/PRP,,, or industrial standard using GPIO of the raspberry pi?
@basvandersluis5662
@basvandersluis5662 7 лет назад
Interesting question. I don't see why it would not be possible. Do you have a specific project in mind? Because I think in most cases it is probably easier and cheaper to just add a few more Raspberry Pi's to your project for redundancy instead of creating (only) ethernet redundancy.
@ibrahimaltaha3186
@ibrahimaltaha3186 7 лет назад
Bas van der Sluis if you would like to help me. we can break the industrial market with such revolutionary idea. about zero redundant links. instead of using those 10000$ fpga dev kits
@ibrahimaltaha3186
@ibrahimaltaha3186 7 лет назад
yes i do have project in mind, (raspberry pi3 + (2 Eth interfaces using gpio) to make (HSR or PRP). But .. i don't know how it is possible to be achieved, is it possible to go down to the frame level with Raspberry PI?
@yigitkadir3649
@yigitkadir3649 5 лет назад
good video thanks :D
@Fatjuice
@Fatjuice 6 лет назад
Hi, I’m kinda new to RPI’s, I have that same module for LAN, and I got a mini buck converter. Could you do a video on how to make it PoE? Great video!
@dr.caitlinsnow459
@dr.caitlinsnow459 4 года назад
Do you think it would be possible to desolder the RJ45 on that? I know its crazy but what I really need is access to the ethernet output, not the jack itself.
@basvandersluis5662
@basvandersluis5662 4 года назад
It is possible. The metal frame is soldered with two pins on the side, and the 8 pins are soldered though the board. So, no SMD-connections.
@tubeDude48
@tubeDude48 6 лет назад
Add this program to your computer: nirsoft.net/utils/wireless_network_watcher.html And look for Raspberry Pi Foundation. So there is NO need to hookup to HDMI as mentioned at 12:48
@basvandersluis5662
@basvandersluis5662 6 лет назад
Thanks for the tip!
@tubeDude48
@tubeDude48 6 лет назад
Glad to help!
@cyberstar251
@cyberstar251 6 лет назад
Can this be done for the raspberry pi 3b and 3b+?
@AdditiveAvery
@AdditiveAvery 7 лет назад
Could you elaborate on the 10bit vs 110bit differences? If I want to boot VIA ethernet, would the other be better?
@11wwwwwww
@11wwwwwww 4 года назад
Thank You Sooooooooo much you made my Day. very Clear Demonstration
@tuxberlin
@tuxberlin 7 лет назад
Would this work with a normal Pi3 as well ?
@basvandersluis5662
@basvandersluis5662 7 лет назад
Yes, but the Pi3 has an ethernet-adapter on board, so it's only useful for cases which require multiple ethernet adapters. Keep in mind that this ENC28J60 is a 10mbit adapter (and even half-duplex in this case), so it's fairly low speed. If your project needs multiple adapters, you would probably be better off with a usb ethernet adapter, since the Pi3 has 4 usb-sockets.
@MaciekJackowski
@MaciekJackowski 5 лет назад
@@basvandersluis5662 Is it faster than wifi for Rpi0W
@ovi_4
@ovi_4 6 лет назад
U can buy and micro USB Ethernet adaptor that already has 3 additional USB ports attached to it for about 4 to 9 US dollars
@braselectron
@braselectron 5 лет назад
Thank you for sharing this information.
@JuanSanchez-rb4qu
@JuanSanchez-rb4qu 5 лет назад
Could the zero support 2 ports with gigabit ethernet? or thats beyond its specs?
@basvandersluis5662
@basvandersluis5662 5 лет назад
No. 10 mbps is max. when using the gpio-ports. If you want multiple fast ports, you could try two USB ethernet adapters. The PI has USB2-ports, so the theoretical maximum would then be 480 mbps.
@JuanSanchez-rb4qu
@JuanSanchez-rb4qu 5 лет назад
@@basvandersluis5662 but afaik usb2 bandwidth is way behind gigabit ethernet. I know the rpi3 (both A and B) have shields to add two ethernet ports but dont know if those would be gigabit or just 10/100
@basvandersluis5662
@basvandersluis5662 5 лет назад
Correct. USB 2 is max. 480 mbps where gigabit is 1000 mbps (or should it be 1024mbps ;). afaik the ethernet of the rpi 2 and 3 use the same controller as the usb ports, so the theoretical max. speed is still 480 mbps. I don't know about the shields, but the shields are using the gpio-pins...
@JuanSanchez-rb4qu
@JuanSanchez-rb4qu 5 лет назад
@@basvandersluis5662 oh dang, got lied on the gigabit...
@linuxamrit
@linuxamrit 6 лет назад
Greetings from India, Thank you soo much for showing a wonderful teaching stuff, Can you please tell me can we attach 10/100/1000Gbits Ethernet Module, if yes, and you know about that device name please mention here ...
@basvandersluis5662
@basvandersluis5662 6 лет назад
Thanks. I don't think that the GPIO ports are fast enough for 100 or even 1000 Mbit ethernet. If you want faster, you can go for a USB Ethernet module, but that is theoretically limited to 480 Mbit (max USB2.0 speed), but the Pi is probably not fast enough to reach that. Anyway, it's faster than the 10Mbit half duplex module of this video. :)
@linuxamrit
@linuxamrit 6 лет назад
in GPIO pins can we attach USB3.0 ?
@nicopatico
@nicopatico 4 года назад
hi, you're using a pi0 or a pi0W?
@basvandersluis5662
@basvandersluis5662 4 года назад
It doesn't really matter, but the Pi I used in the video was a non-W version.
@nicopatico
@nicopatico 4 года назад
@@basvandersluis5662 thanks
@jwuethrich8385
@jwuethrich8385 7 лет назад
u can set the micro usb port to apear as an ethernet adapter to any system that is a usb host. If you are running a linux router (ddwrt or openwrt...possibly some normal router firmware) or windows pc you can just plug it in and it and share ethernet. I connection mine to my router and told the router to bridge the interface to lan main when connected. Main advantage I can see for spi ethernet would be on like a pi 2 or 3 that one is using to run cameras they stream over ethernet. pi ethernet shares usb bus so you quickly run out of bandwidth. on a single core pi I think u will max the cpu before you run into shared usb bandwidth issues
@pahtriac
@pahtriac 4 года назад
Werkt dit ook op de Pi 4?
@basvandersluis5662
@basvandersluis5662 4 года назад
Ja, dat denk ik wel. De Pi4 heeft echter genoeg USB-poorten en ethernet aan boord om het zonder deze oplossing te fixen. Een USB-ethernet dongle is veel sneller dan dit ding.
@pahtriac
@pahtriac 4 года назад
@@basvandersluis5662 Sorry voor de late reactie (werk) Dongles zijn mijn ding niet en er is geen dual Gb-Eth aansluiting is als addon verkrijgbaar voor de Pi4 en wil er heel graag een FW/router van maken. Dus zat er aan te denken om een HAT te maken voor de Pi4 met een 1Gb RJ45 met behulp van jouw bouw wijze, ik weet dat de bus van de USB gedeeld word met de onboard RJ45 doch weet niet of dat dit ook van toepassing is op de GPIO. Als je enig advies heb of inspiratie heb gekregen om dit zelf te doen ik zou je zeer erkentelijk zijn voor bouw advies.
@basvandersluis5662
@basvandersluis5662 4 года назад
@@pahtriac Pfoe.. Ik weet niet of de GPIO-poorten voldoende snel zijn om een beetje knappe snelheid te halen. Het ding wat ik gebruikt heb haalde max. 10 mbit. Heb je een specifieke reden om zelf een router te bouwen? Ik heb hier zelf een relatief goedkope router in gebruik die Gigabit haalt op z'n WAN-poort en heb de DNS en DHCP-functies uitgeschakeld welke ik laat doen door een Raspberry Pi 2 met Pihole. Het enige wat mijn router nu nog doet is routen en meer niet. Losse acces-points in huis verzorgen de wifi.
@pahtriac
@pahtriac 4 года назад
@@basvandersluis5662 ik had een oud dual cpu moederbord met 2 100Mb netwerk kaarten aan de muur op zolder geschroeft. W2K + Sambar server en een FW dit werk deden. Doch jaar geleden is die overleden. dus ben weer overgestapt naar de Ziggo router :( De vrouw was er niet happy mee dat ik een ander slachtoffer (^^) aan de muur wilde gaan schroeven. dus keek ik naar andere opties, ik hoorde dat Ubuntu 64 SE voor de Pi4 uit was gekomen dus wilde ik daar mee gaan experimenteren. doch een dual Eth voor de Pi4 is blijkbaar een struikelblokje als je niet van dongles houd
@solaceonline
@solaceonline 7 лет назад
Are you Cptn Duck?
@basvandersluis5662
@basvandersluis5662 7 лет назад
Nope.
@avigdonable
@avigdonable 4 года назад
Cptn Dutch more likely.
@Delorean29
@Delorean29 6 лет назад
Can I use on micro SD card USB 2.0 to SATA DVD player without operative system? Only programs that start up dvdn find usb etc???
@AdditiveAvery
@AdditiveAvery 7 лет назад
is it reliable?
@basvandersluis5662
@basvandersluis5662 7 лет назад
Yes, I have found it very reliable. I've had open connections for days, using this unit. Never have I had any network issues because of this unit. The only thing which caused the Raspberry to hang was drawing to much power from other GPIO pins.
@AdditiveAvery
@AdditiveAvery 7 лет назад
Thank you for the reply. Where did you end up purchasing yours from? I need a couple hundred of these, and I have found Alibaba to be the cheapest, but the boards may look slightly different. How do I pick the best one? Average price on Alibaba is $2.25 USD when bought in bulk.
@basvandersluis5662
@basvandersluis5662 7 лет назад
I bought mine from eBay. If you need that much, I would buy a couple of these units from different sites and sellers and see which one is best and then order the large amount.
@AdditiveAvery
@AdditiveAvery 7 лет назад
Bas van der Sluis what would be the best way to setup a test to check reliability?
@basvandersluis5662
@basvandersluis5662 7 лет назад
I am not a systems administrator, but my guess would be setting up a ping to a server in the local network. Let it run for a couple of days (or hours) and check the amount of packet loss. Also, I think that stressing the CPU a couple of times while doing this ping is a good idea, because the CPU is mainly responsible for the GPIO pins.
@matzmatz4148
@matzmatz4148 6 лет назад
Nice Video, a lot of stuff explained ,but also a bit too long.
@Renodox
@Renodox 6 лет назад
Could you add this to a pi 3 to get a secondary Ethernet port?
@basvandersluis5662
@basvandersluis5662 6 лет назад
Yes, but a cheap usb ethernet adapter is the best choice for the Pi 3, if you want a secondary adapter.
@vanhau2994
@vanhau2994 3 года назад
Fantastic.
Далее
Raspberry Pi Zero: GPIO Pins
14:46
Просмотров 200 тыс.
$7 LAN Tap - Raspberry Pi Zero Build
7:33
Просмотров 234 тыс.
Вопрос Ребром - Серго
43:16
Просмотров 1,7 млн
V16 из БЕНЗОПИЛ - ПЕРВЫЙ ЗАПУСК
13:57
DON'T Use Raspberry Pis for Servers! (Use THIS)
16:23
Raspberry Pi Zero USB/Ethernet Gadget Tutorial
12:47
Просмотров 159 тыс.
Control ANY COMPUTER with these Pi KVMs!
17:46
Просмотров 830 тыс.
Pi Zero Ethernet Over USB | SSH Into Pi
6:28
Просмотров 69 тыс.
Вопрос Ребром - Серго
43:16
Просмотров 1,7 млн