4 ways to connect your Raspberry Pi 4 to the internet

{}
June 26th, 2019

The just introduced Raspberry Pi 4 has delivered some much wished features: faster internet/network, a gigabit Ethernet connection, and faster USB, 2 USB 3.0 ports. This will open the door to a Raspberry Pi driven NAS solution that will offer high speed in combination with the new USB3 ports.

This post is about exploring the USB OTG  (On The Go) feature of the Raspberry Pi 4. We will find out if it’s possible to power and connect a RPI4 with just a USB cable.

Ethernet is easiest way to connect internet, the second is wireless, using WiFi. The new RPI4 offers dual-band 802.11ac wireless networking. Not as fast as the gigabit Ethernet internet, but it will offer speeds like 100 Mbps, around a 100Mb Ethernet connection. That’s quite speedy too.

The third way is using Bluetooth. Like connecting your laptop to a Bluetooth hot-spot on your phone. That will be a bit slower. Will try that later.

The fourth way is using a trick we know from the smallest Raspberry Pi, the Raspberry Zero. The Raspberry Pi 4 has a USB-C power connector, but that USB-C port is also an USB OTG connector, so the Raspberry Pi can be used as a USB Gadget: the USB port can switch USB states (MASTER/SLAVE or HOST/DEVICE) and be used like a keyboard or mouse, or USB Ethernet modem.

Actually you can power and connect to a Raspberry Pi 4 with just an USB-cable. I tried it with the new Raspbian Buster and it’s working fine. I used the same Samsung cable I used for my Zero (and phone), added an 1 euro micro-USB to USB-C adapter, and it’s just working fine. It seems my laptop is offering enough power for a headless, and armless Pi.

To enable OTG networking, add this to `/boot/config.txt`:

# enable USB OTG
dtoverlay=dwc2

Then add this to `/boot/cmdline.txt` after rootwait:

modules-load=dwc2,g_ether

Reboot your Raspberry pi and convert the new wired connection to `shared` in the connection manager on your laptop (e.g. Ubuntu 18.04), and connect to your new Raspberry Pi 4.

It will have an IP like: 10.42.0.xxx.

If you have added  a empty file `ssh` to the boot sector of your SD card touch /boot/ssh, the Pi will start with SSH enabled.

So you can connect from your laptop with:

ssh pi@raspberrypi.local

For more details, see these posts Connecting to a Raspberry Pi Zero with just an USB cable (I) or Connecting to a Raspberry Pi Zero with just an USB cable (II)

I wonder if it will be possible to boot the Raspberry Pi 4 entirely over USB, without a SD card, like the RPI Zero. Not at the moment though.

Tags:

Leave a Reply