Tether Raspberry Pi to iPad Pro via Ethernet over USB-C
The new USB-C connector on the 2018 iPad Pro’s opens a new way to communicate with RPi’s: Ethernet over USB, including powering a Pi Zero. The procedure to success was pretty straightforward and documented here for my own reference (so I won’t forget to enable ssh before booting up the new flash card) using a Raspberry Pi Zero W.
Download Raspian Stretch lite
Download the latest minimal image, which is Debian Stretch at the time of writing this post from https://www.raspberrypi.org/downloads/raspbian/:
Write image to flash card
I’m using balenaEtcher on OS/X to write the image to the memory card, then mount it on OS/X to get access to the cards /boot folder.
Enable Ethernet over USB
With the memory mounted, append the line
config.txt and add
modules-load=dwc2,g_ether to the kernel argument list in
$ cd /Volumes/boot $ echo 'dtoverlay=dwc2' > config.txt $ sed -i '' 's/quiet/quiet modules-load=dwc2,g_ether/' cmdline.txt
$ cd /Volumes/boot $ touch ssh
That’s it! Unmount/eject the memory card and place it into the Pi Zero.
Wire it up
Connect the Pi Zero via the micro USB port next to the mini HDMI port and the other end to the iPad Pro, either directly via a micro-USB to USB-C cable or using one of the USB-C dongles and its USB port.
The Pi Zero will power on and boot up, indicating by the flashing green LED. It will go thru an automatic reboot after expanding the filesystem.
Go to the Settings on the iPad and wait for the Ethernet to appear, click on it and then on the ‘RNDIS/Ethernet Gadget’ adapter’ on the right and you’ll see shortly self assigned IPv4 address showing up (there is also a link local IPv6 address, but it isn’t shown):
BTW I set the iPad to Airplane Mode to make sure, there is no cheating going on here 😉
Connect via ssh
Use your favorite ssh client on the iPad and connect to the Pi Zero using its hostname
pi and password
While logged in, check
ifconfig usb0 and
wo am i to verify how the ssh connection is made: via IPv6 using link local !
Unfortunately I didn’t manage to use the iPad’s Personal Hotspot to share its 4G/LTE connection with the RPi, but one can use the RPi’s wlan0 interface to connect itself to a Wifi network, e.g. via ‘sudo raspi-config’.
These simple steps I described above enable Ethernet over USB on the Raspberry Pi and allow it to communicate over USB with the iPad Pro, thanks to its new USB-C connector.
Some of the use cases I have in mind include some programming “on the go”, when offline. I successfully ran some Go programs. Other use cases I have in mind is to use this as a protable serial terminal server, all self powered from the iPad. Maybe even a VPN/Wifi router or .. or … or ..
I’m sure you’ll come up with much cooler use cases. Let me know in the comments section.
Update Dec 3rd, 2018
@gp_config shared his AirPiConsole use case, which is very interesting: https://www.ifconfig.it/hugo/tags/airpiconsole/ . Definitely on my todo list, hopefully before I’m in need of a serial console in a remote location …