Ultra-portable Pi Zero setup

I was travelling a lot recently while working on PiCap project.

Normal-sized Raspberry Pi is small, but Pi Zero is even smaller, and with simple initial setup it can be used with just one USB cable.

  1. set up SD card with Raspbian (I’m using the “lite” version)
  2. edit boot/config.txt and add at the end: dtoverlay=dwc2
  3. edit boot/cmdline.txt and add modules-load=dwc2,g_ether after rootwait
  4. put an SD card in Pi Zero, and connect USB to micro-USB cable to Pi Zero (connect with USB port, not the “power” one)

After a short while “RNDIS/Ethernet Gadget” should appear in OSX Network preferences. You should now be able to simply ssh pi@raspberrypi.local to get into the Pi.

One thing worth noting is that it only worked for me with short USB-micro cable.

Development with least amount of hassle

While developing, I write code locally, and have a simple setup using fswatch and rsync - with every save fswatch triggers rsync to upload recent changes to Pi Zero, and I only need to switch tmux pane to actually run the code:

fswatch -o . | xargs -n1 -I{} rsync -azP . pi@raspberrypi.local:~/dev/

This allows me to stay with my local dev environment (vim + tmux), and I can safely format an SD card when needed, as everything is stored on my main machine.

Szymon Kaliski © 2018