Skip to content

Instantly share code, notes, and snippets.

@jottr
Last active February 13, 2019 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jottr/428a7f53e30c24f7790f0bf413e97609 to your computer and use it in GitHub Desktop.
Save jottr/428a7f53e30c24f7790f0bf413e97609 to your computer and use it in GitHub Desktop.

How to set up the Raspberry Pi Zero W with SSH and Wifi

Download Raspbian

Use etcher to flash the image to SD.

Prepare the SD Card

  • Mount the SD and $ cd /Volumes/boot/
  • $ touch ssh to enable ssh server on the PI
  • Edit cmdline.txt, add modules-load=dwc2,g_ether after rootwait
  • Add the following to config.txt:
# Enable OTG
dtoverlay=dwc2
  • Safely eject the sd card. On Mac: $ diskutil eject /Volumes/boot

  • Connect the innermost USB port to the USB on your host.

  • Wait ~90 sec

  • Connect via $ ssh pi@raspberrypi.local. Password is raspberry

Setup Wifi

Note that the Zero W only supports 2.4 Ghz networks.

# cat /etc/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

# AES
network={
 ssid="<SSID>"
 psk="<PASSPHRASE>"
 proto=RSN
 key_mgmt=WPA-PSK
 pairwise=CCMP
 group=CCMP
 auth_alg=OPEN
}

Automatically connect via wpa_supplicant and obtain an IP:

# cat /etc/network/interfaces
auto lo

iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Further info on how to connect to wifi from the commandline can be found on the Arch Wiki:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment