The Raspberry Pi Zero is an impressive piece of kit.
Weighing in at just 9g and small enough to fit in your pocket it has a 1GHz Arm processor, 512MB of RAM, a micro-SD card slot, input/output pins a mini HDMI socket for 1080p video and can be connected to Wifi using a USB Dongle.
So, like us you might have rushed out to get one for your latest project only to discover that setting it up is not as easy as it sounds. So, if you're looking for a simple cost-effective and repeatable way to set up a Raspberry Pi Zero read on.
Step 1: What's the Problem?
The attraction of the Raspberry Pi Zero is to buy the minimum kit including a power supply, Raspberry Pi Zero, mini USB Wifi Dongle and an SD card with an operating system like Raspbian.
To connect the Raspberry Pi Zero to your Wifi network you need to change some settings and add your network details. The easiest way to do this is to plug a powered USB hub into the single micro USB port and connect a keyboard, mouse and the Wifi dongle and then an HDMI monitor and use the Graphic User Interface of Raspbian to connect to your Wifi. But wait a minute...
...I bought a Wifi dongle with a micro USB connector so that it can connect directly to the Pi Zero in my project. So, it won't fit into the normal sized USB ports on a hub. I could use a dongle with a normal sized USB but now I have had to use a powered hub, a keyboard, mouse. monitor and another dongle just to get up and running.
There must be a better way!
Step 2: Get Full Access to the Raspberry Pi Zero SD Card
After lots of searching around we came across a little publicised method for updating settings on the Raspberry Pi Zero that only requires one piece of software. It costs less than all the other peripherals together and can be used at any time with nothing more than your computer or laptop.
The key is that the files that you need to access on the SD card that runs your Raspberry Pi Zero are usually hidden. If you put the SD card in your computer some files will show up but the ones we need are not readable.
What you need is a file system driver that bridges between your computer's OS and Linux. There are several available but we chose Paragon ExtFS as it is one of the few that works with Mac OS.
Once you've installed the software you can put the SD card into your computer and two volumes will appear; root and boot. You'll probably need to use an SD card adaptor (our micro SD card came with one) so beware of the little lock feature on the side (shown in the image above). We lost a whole afternoon trying to figure out why we couldn't access the root folder before we realised that pushing the adaptor into the slot on a Macbook often slides the lock across!
Step 3: Use Terminal to Update the Settings
Now that you have full read/write access to the SD card used by your Raspberry Pi Zero you can update the settings that control Wifi access.
The easiest way to do that is to use the Terminal application (on a Mac).
There are two files that need to be edited; network interfaces and wpa_supplicant.
Start by changing the directory to the 'network' folder on the SD card by typing:
Then open the 'interfaces' file in the nano editor by typing:
sudo nano interfaces
Terminal will probably ask for the login you use for your computer (the one you enter when you boot up).
Then you will see the contents of the 'interfaces' file.
Make sure the first line says auto wlan0 and that there is a line that says allow-hotplug wlan0 and a reference to the wpa_supplicant file as in the image above.
Step 4: Add Your Wifi Network Settings
Once your 'interfaces' file is edited type Ctrl X to exit and save the file.
Then navigate to the wpa_supplicant file:
Open the file:
sudo nano wpa_supplicant.conf
Enter your password if requested and then you will see the contents of the file.
Change the SSID and password to suit your Wifi network and then type Ctrl X to exit and save the file.
Step 5: Connect to Your Raspberry Pi Zero Over Ssh
Now you can eject your SD card and insert it into the Raspberry Pi Zero along with your Wifi dongle and power cord and then use the Terminal programme to remotely access over ssh. Make sure your computer is on the same Wifi network when you attempt this.
You can find out details on using ssh here.
Once the connection is made you will see a window like the image above and you're good to go.
One of the first things you might want to try now is to use your computer as a virtual display using something called tightvncserver since you saved all that money and hassle by not using a keyboard, mouse and display!