59

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.

Logical Fallacy
  • 713
  • 1
  • 6
  • 7

14 Answers14

40

Two options:

a) Buy Micro USB RJ45 adapter for $2.74 including shipping

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.

EDIT: The Micro USB OTG adapter in option "b" is no longer available at the linked location.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
neuhaus
  • 624
  • 1
  • 6
  • 10
29

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

10

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

10

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.

John La Rooy
  • 12,005
  • 9
  • 48
  • 77
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.

Steve Robillard
  • 34,988
  • 18
  • 106
  • 110
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.

4

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
Wilf
  • 2,533
  • 3
  • 23
  • 39
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.

Logical Fallacy
  • 713
  • 1
  • 6
  • 7
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!

MarcelH
  • 13
  • 3
mah
  • 29
  • 1
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.

Mark Smith
  • 1,293
  • 8
  • 9
2

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!

Shmarkus
  • 21
  • 3
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.

ThetaSinner
  • 121
  • 2
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!

MarcelH
  • 13
  • 3
0

If you happen to be in Germany, something like this seems to be the best working option that I have tested: https://www.ebay.de/itm/353490964493

I payed 3,38€ without any fee.

As it is not branded, I will just present an image in case the link expires: enter image description here

tbrodbeck
  • 101
  • 1