Thursday, February 04, 2016

Raspberry Pi Zero: How to first access it headlessly

I obtained a Raspberry Pi Zero a few weeks ago, but hadn't really done anything with it. I was puzzled as to how to access it initially, since it only has one USB port and no RJ45 connector built in for accessing a network.

The easiest thing would be to get a USB hub, but I wanted a minimalist approach. No screen, keyboard, mouse. This method only requires a wireless dongle. So I did some sleuthing on the old Interweb and stumbled and David Maitland's blog.

My approach varies slightly from his, that is why I describe it here:

get access to Raspberry Pi Zero on the network by:
  - downloading Raspbian Jessie and dump the image on a microSD card using your PC
  - taking another Raspberry Pi, a B+, inserting the 'Zero' microSD card in it
  - hooking this up to the network (or screen, keyboard and mouse)
  - booting the Pi B+
  - modifying the file /etc/network/interfaces file
       specifically: add 'auto wlan0' as a separate line above 'allow-hotplug wlan0'
  - modifying the file /etc/wpa_supplicant/wpa_supplicant.conf
       specifically: add to the end of this file
     network={
     ssid="MYNETWORKNAME"
     psk="MYNETWORKPASSWORD"
     proto=RSN
     key_mgmt=WPA-PSK
     pairwise=CCMP
     auth_alg=OPEN
     }
      
         Obviously you will replace MYNETWORKNAME and MYNETWORKPASSWORD with your specific values.

  - gracefully shut down the B+
  - take the microSD card from the B+ and insert it into the Zero
  - attach a wireless dongle to the Zero's USB port
  - boot the Zero, it should work. If not, check the entries you made for the network values.