50

Since the Pi Zero doesn't come with an Ethernet port, I'm wondering what is the cheapest way to get reasonably fast network connectivity to the device?

UPDATE

By "network connectivity" I mean connecting to a LAN/WLAN, so the devices can talk to each other, talk to other devices, and go to the Internet. E.g., after setup I should be able to wget stackexchange.com. I don't actually care whether it's WiFi or Ethernet, but I'm guessing that Ethernet should be faster and more reliable (just a guess).

Someone just asked whether this could be done with HDMI, so I know other people are looking for a solution to the same (or a similar) problem.

  • By the time you've added an sdcard and a network adapter, not not only has the cost nearly tripled, but you have likely lost your only USB port. – Chris Stratton Nov 28 '15 at 2:36
  • 1
    What's the point, @ChrisStratton? You'd have to add an SD card to any Pi. And there might be use cases that'll require no additional USB port. But anyhow I think we'll live to see a Pi with WiFi on-board ^^ – Ghanima Nov 28 '15 at 15:06

13 Answers 13

33

Two options:

a) Buy Micro USB RJ45 adapter for $2.15

b) USB RJ45 adapter for $1.50 and a Micro USB OTG adapter for $0.23 (total price $1.73)

Some of the articles may be cheaper if you buy them using the mobile app.

  • 1
    Option (a) looks like it will suit my needs the best, but I'll monitor the question for other ideas. I feel like it should be possible to integrate an RJ45, an Ethernet controller chip, and a USB chip in a manner similar to what the bigger Pi's do. I tried going over the Pi 2 model B schematics yesterday, but without the Pi Zero schematics, I'm kinda stuck. – Logical Fallacy Nov 27 '15 at 20:40
  • USD5 for Pi Zero and +- USD2 for Network. A full working 1Ghz 512MB, super small Linux machine.. Im speechless... Great answer – Piotr Kula Nov 28 '15 at 14:54
  • 5
    Please don't buy the b) adapter (JP1082), it won't work with an unpached kernel and you have to recompile the kernel after each update. – gajdipajti Nov 30 '15 at 22:00
  • @neuhaus If I buy the option a, can I use that to supply electricity to the computer too? – Ricardo Jun 7 '16 at 16:54
  • the RD-9700 doesn't seem to work on Raspbian at all. and worst of all apparently its only USB 1.1 – Piotr Kula Jun 11 '16 at 15:59
24

Ethernet over SPI

One of the cheapest ways is to connect an Ethernet controller over the SPI bus. Such a controller could be for example ENC28J60 which is often being used for Ethernet connectivity for Arduino. Latest Linux kernels for Raspberry Pi have a driver with a device tree overlay. See for example https://github.com/raspberrypi/linux/issues/795

The advantage of this solution is that the USB port will remain available. A disadvantage is that the chip (and the speed of SPI) supports 10BASE-T (10 Mbps) Ethernet only.

Complete modules with lowest prices (few USDs) could be probably found on AliExpress: http://www.aliexpress.com/wholesale?SearchText=ENC28J60

  • 1
    This is a very interesting alternative, where you could use the GPIO to have Ethernet connection. OK, its not great for streaming HD media... but if all its doing is a weather station or a CNC router... excellent! – Piotr Kula Nov 28 '15 at 14:56
  • where would u put this chip on the zero? – Patoshi パトシ Nov 30 '15 at 3:33
  • 1
    @duckx: Here is an example of wiring and using the device tree overlay: gajdicookbook.wordpress.com/2015/02/25/… Here are some pictures using the same wiring: elektroda.pl/rtvforum/topic2950919.html (the used pins of the GPIO header are the same from the first version of the Raspberry Pi till the Pi Zero). – pabouk Nov 30 '15 at 8:43
  • 1
    Normally 300Kbyte/sec can be achieved using an ENC28J60 module. I think personally it is the best solution. (I paired it to an A+ which runs munin-node for the DB18B20 sensors.) – gajdipajti Nov 30 '15 at 21:49
  • 1
    @gajdipajti: With increased SPI clock frequency: spi-max-frequency = 20000000 the average bandwidth should be around 540 kB/s: github.com/raspberrypi/linux/issues/795#issuecomment-87255295 Unfortunately if you consider for example 1080p24 video this is not enough for streaming of acceptable quality. ------ As it is mentioned further in the GitHub issue it should be possible in the future to increase the frequency further - closer to the ENC28J60 maximum of 20 MHz. – pabouk Dec 2 '15 at 13:44
9

For me, the cheapest and easiest way to get Ethernet to the Zero was over USB to my host. I found the link here was the easiest and quickest, set a static IP for the USB0 network connection and it works perfectly for SSH to the Zero when plugged into USB on my laptop and desktop. On windows 10 it does come up as a USB serial port, you have to specify the Acer RDNIS driver but after that works great under windows as well. Windows 7 and 8 just saw it without even asking. Hopefully this helps. :)

http://pi.gbaman.info/?p=699

7

If cheapest was the only requirement I would go with an ESP8266-01 WiFi module like this one. Total cost $3.50 US including shipping. There are a few tutorials covering how to use these with the Pi:

You may want to spend a few more dollars and go with one of the higher end ESP8266 models. These higher end modules have a couple of additional benefits, while still costing less than $10, they contain an ADC something the Pi does not, they also breakout all of the pins from the ESP chip.

  • Is there a similar strategy that can be used for Ethernet? There's a similar Instructable for Arduino. – Logical Fallacy Nov 27 '15 at 6:11
  • That same part mentioned (a serial to Ethernet adapter will work with the Pi as well) Check this thread raspberrypi.org/forums/viewtopic.php?f=44&t=18397. Note your question does not mention that you want an Ethernet solution. – Steve Robillard Nov 27 '15 at 6:16
  • I see a Pi Zero+ on the horizon! Well, I sure understand the rationale behind the minimalist and cost down approach the Foundation took with the Zero. But there should be a Pi with WiFi on-board any time soon. Think Internet-of-things. – Ghanima Nov 27 '15 at 6:49
  • I think anything connected via UART serial fails the "reasonablly fast" part of the requirements list. – Peter Green Nov 27 '15 at 8:35
  • 1
    @neuhaus, of course it is slower if you are using the UART. But ~40Mb/s has been reported using SDIO mode. See my answer – John La Rooy Aug 24 '16 at 1:36
6

A better ESP8266 solution is to connect it as a SDIO device on the GPIO port.
This is inexpensive and can get you ~40Mb/s over wifi

http://oshlab.com/esp8266-raspberry-pi-gpio-wifi/

A little history. The ESP8266 IC (if you haven’t heard of it) is an extremely popular Wifi microcontroller with many cheap modules on the market. It was originally used as a UART serial interface for microcontrollers, but has since been ported over to work as a standalone microcontroller using LUA or Arduino. It is a very fast microcontroller that runs at 80mhz. This is one of my favorite microcontrollers to use for projects because it is fast, cheap, and has wifi.

A few versions of the module have come out including the ESP-12E and ESP-12F (both around $2-$3) that break out the SDIO interface. This was largely pointless, because the SDIO interface is used for the flash memory.

However, it turns out that the ESP8266 is actually a ESP8089 IC just rebranded. The ESP8089 is a SDIO wifi chip for small tablets. If you do not pull down GPIO 15 on boot, as you would when running it as a microcontroller, it runs in SDIO mode and is basically an ESP8089 IC at that point.

This project is based on Hackaday.io RPi WiFi project. I have made some modifications to work with the new linux kernel in the new Raspbian and I have written a script to completely automate the process. To use this, you need an ESP-12E or ESP-12F module. The ESP-12F is recommended.

First, wire up the ESP-12F like this.

enter image description here

The 33 ohm resistors are necessary to achieve the SDIO speeds required, so please to not leave them out. It is also better to pull from the 5v rail and have a separate LDO for the ESP8266 module, but pulling directly from a 3.3v rail on the Raspberry pi should work fine.

SSH into your Raspberry Pi and enter the following commands. You might want to expand the filesystem first using raspi-config.

cd ~
git clone https://github.com/oshlab/esp8089.git
cd esp8089
sudo sh install

This is going to take a while. So just sit and wait, or go grab a coffee.

When that is done, reboot your Pi.

sudo reboot

After reboot, the ESP8266 module should activate. You can do a quick scan to make sure it is working.

sudo iwlist scan

It should scan for wireless networks and show you what is available.

Now it will work just like any other WIFI module. Cheers.

4

Checkout HubPiWi - an add on board for Pi Zero with 3 USB Ports and an integrated Wifi with on board Antenna. The board has a PCB Antenna and does not require and Cable or Connector.

enter image description here

A typical use of HubPiWi will be to add a Keyboard, a Mouse and a Camera on the three USB ports. This is in addition to Wifi, of course.

  • 1
    Interesting, however at $13 hardly "the cheapest way to get network connectivity" which was the original question. – neuhaus Sep 30 '16 at 9:34
3

A (now) somewhat obvious answer is to get the Raspberry Zero W (Wireless), which on currently seems to retail for about £5 more than a normal Zero (£9 to £10 currently on most UK retailers - w/o header pins and other accessories)

This has various benefits over other solutions, including:

  • Is on-board, so is available out of the box easily
  • Is very compact, and may be more power efficient than other solutions
  • Includes Bluetooth.
  • Does not use up GPIO, USB or other connectors on the Pi
2

I'm answering my own question with two ideas that I have, but both solutions are tacky (IMO) and not that cheap ($10-30). I'm hoping there's a better way.

Connect a micro-USB-to-USB adapter, then either:

  1. Chain a with a USB-to-Ethernet adapter, or

  2. Stick in a cheap USB WiFi dongle.

The first will likely be the most reliable; I have had bad luck with WiFi dongles.

  • If you need a list of WiFi adapters that should work try here – Wilf Nov 27 '15 at 11:34
  • I don't see how sticking in a cheap USB WiFi dongle will add Ethernet :-P – neuhaus Nov 27 '15 at 12:10
2

I'm late to the party, and you already have some very cheap options, but I reckon you may be able to do it for less - just a couple of resistors - if you have a PC with a spare serial port nearby. The hardware side is a little hacky, and the connection will be SLOW and you do say you want reasonably fast, but I thought it was worth a mention anyway.

Premise: You can do network over serial using PPP (what modems use to connect to the ISP). So if we can get the Pi's Tx and RX to talk to a PC serial port, we can network over that.

How can we connect the Pi's Tx/Rx to an RS232 port? The voltages are different, so you could either

  1. Use a level shifter such as a MAX3232, which will probably cost you as much as the network adapter, or...
  2. Go directly from the Pi's Tx line to the PC's Rx line; the PC should be fine with the lower voltage. Measure the voltage the PC generates on its RS232 Tx line, and use a resistor divider to get it to 3.3v, and connect that to the Pi's Rx line. The RS232 spec allows a wide range of voltages, so you wouldn't want to rely on this being the same between PCs.

There's a tutorial here which explains how to do the software part.

  • Why not use a USB port and do networking via USB? It's faster than serial and available everywhere. – neuhaus Oct 11 '16 at 15:02
  • 2. Don't think it'll fly - RS232 levels are equally spaced around ground voltage and there is hysteresis so an input voltage switching between a positive level and ground is really out of specification: a receiver of such a signal is entirely within the specs. to ignore it (and RS232 is an inverted polarity IIRC - i.e. voltage more negative than -3.0V = mark; voltage more positive than 3.0V = space). As it happens that is why there was a -12V supply requirement for older PCs - purely for the serial ports, though nowadays that is met by charge pump circuits like those in the MAX series ICs. – SlySven Jun 20 '18 at 16:15
2

I've been trying to get internet on my RPi zero and found this list of adapters for usb http://elinux.org/RPi_USB_Ethernet_adapters one of the adapters is made by Plugable http://plugable.com/2015/12/10/ethernet-for-the-raspberry-pi-zero/

I set up the sd card on a raspberry pi 1 because it was simpler to setup that way (I gave it a static ip by editing /etc/dhcpcd.conf) Then the Plugable adapter works with no extra work, you just plug it and the power in and everything works.

Can't comment on whether this is a good solution but I'm able to SSH in and work on the command line with no noticeable performance problems.

2

One another option would be this: https://www.kickstarter.com/projects/755102253/pijack-add-ethernet-to-raspberry-pi-zero

Not the cheapest way, but guaranteed to work and be supported - like any other ENC28J60 based module.

THis has not been funded but is available here: http://www.pijack.net

I am part of the development team so I might be biased!

  • 1
    This isn't a particularly helpful answer. That's a kickstarter link that hasn't even been fully funded yet. It may as well not even exist as far as this question is concerned. – Jacobm001 Feb 1 '16 at 21:02
  • 1
    It is a feasible project though, design EXISTS and prototypes seem functional - the add-on board connects to a GPIO40 header and provides a 10Mbps ONLY (Not 100 Mbps, not Gigabit!) wired Ethernet connection. Given the timescale at the time of writing this (2 months after the Pi Zero's release) the kick-start target of around £4.5K by 20160302 could be met - but the pledge for a fully built board (£17 for Jul 2016, other pledges are available) less 40 Pin header may be more than some would go for. OTOH if this is what you would want, I thank the poster for bringing it to our attention... – SlySven Feb 1 '16 at 21:58
  • Update: they didn't get all the funding from kickstarter but with other sources they managed to get it off the ground and it is now available manufactured from them PiJack which is an EU (NOT Far Eastern) based company for £11.49 apparently...! – SlySven Nov 3 '16 at 2:52
  • It does mean, of course that you could also use it as a second Ethernet connection and theoretically use a RPi B+ or 2/3B model as a wired Hardware Firewall - though the throughput would NOT be that high as far as I can see. – SlySven Nov 3 '16 at 2:55
1

What I do is I use port forwarding. I have the Pi connected to my laptop as a network device and I access it via SSH.

ssh -R 1234:182.254.218.141:80 pi@raspberrypi.local

This creates a remote port forward to a proxy server (find one on http://proxylist.hidemyass.com/ or similar site) on the port 1234. The next step is to add APT proxy to file /etc/apt/apt.conf (create if not found) and write the following line:

Acquire::http::Proxy "http://localhost:1234";

Profit!

  • I like this suggestion. A laptop isn't cheap, but many people have them lying around. – Logical Fallacy Jul 10 '16 at 3:26
  • how did you connect the Pi to the laptop as a network device (they are various ways!!) – Wilf Mar 31 '18 at 0:00
  • I Used an USB cable – Shmarkus Apr 1 '18 at 5:53
1

Certainly not the cheap version, but definitely the most elegant - especially if you need to add additional shields via GPIO header. And includes 2 port USB HUB.

I may be a bit biased since this is probably my product that I am selling, but it is a potentially valid solution:

https://www.tindie.com/products/marcel/raspberry-pi-zero-ethernet-rj45-and-usb-hub-shield/

This is my product so I might be competely biased!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.