This tutorial is for those who do not have access to a display and want to set up their new Pi Zero W.
Pi Zero W is the latest version of Pi Zero launched on the last birthday of Raspberry Pi. Comparing to the previous version the new model comes with inbuilt Wifi and Bluetooth making it truly wireless as the W represents. Pi zero being a stripped down version of the Pi series lacks many things seen on the Raspberry Pi's. They have low power processor and ram, also lacks the no of ports. The lack of an ethernet port makes setting up Pi zero without a display harder and the recent changes in the SSH enabling also make ssh-ing into the Pi tougher. Well, this tutorial will guide you to solve these problems. The first problem many users have reported is that upon starting Pi Zero W up for the first time it behaves like dead. Even the SD cards working on other Pi's did not work on Pi zero w. The reason for this is that the Pi zero w only supports the latest version of raspbian. If you use an SD card with an old image of raspbian it will behave like dead. Even many sellers are selling Pi zero W kits with SD card containing an old raspbian image. The kit that I had bought from Adafruit had an SD card with old NOOBS. So it's good to burn the new raspbian image onto your SD card before powering up your Pi zero w.Preparing the SD card
You can download the latest version of raspbian from https://www.raspberrypi.org/downloads/
NOTE: Use at least an 8GB SD card
Using an SD card adapter connect the SD card to your computer:
Run the Etcher program:
Select the downloaded Raspbian file.
Select the connected SD card:
Then click on Flash:
Let the program do it's work until you get a message showing success. This process can take up to 10 minutes or more depending upon the write speed of your SD card.Enabling SSH
As per the new versions of Raspbian SSH is not enabled by default. We must enable it so we can enable VNC without the help of a display. For enabling SSH we must make some modifications in the files.
Now remount the SD card and open Notepad in Windows.
Save that empty notepad file as SSH.txt in the Boot folder of SD card (the folder sd card opens into):
Rename that SSH.txt and remove .txt. This way you will get a file named SSH without any extension.
Remove the SD card from its adapter and slide it into the SD card slot in Pi zero W.
Connect the 5v adapter to the power port:
You should see the LED blinking. When the rate of blinking is reduced the Pi zero w has booted into the interface. Since we do not have a display at the moment we cannot see the interface. Now we must connect to the Pi using SSH so as to enable VNC. For SSH-ing we must know the IP address of Pi.Finding the IP address
There are many ways you can find the IP address. If you have a display you could just type in:
the terminal to know the current IP address of Pi. But in our case, it is not possible. If you search the internet you can find many ways by which you can find IP address of your Pi without a display.
I had a WIFI hotspot lying around, So I just connected the hotspot using a USB cable onto my Pi zero w with the help of an OTG cable.
Using the configuration address of my WIFI hotspot I was able to get hold of the IP address of Pi zero W:
For SSH-ing we need SSH client. Since I'm using Android to SSH I downloaded Juice SSH from playstore. If you are using PC you can use putty.
Install and open the app.Click on the lighting icon above the app type in your IP address and name as pi. Then you will be asked to enter the password, default password for pi is raspberry. The SSH windows will open up.
At first type in and press enter:
sudo apt-get update
It will take some time before it updates everything.
When it finishes type in:
It should open a window as shown in the images below:
Using the arrow key get down to Interface options and click select using the arrow key and enter.
Select VNC in the upcoming window and enable it and click finish.
That's it you have enabled VNC in your Pi:VNC remote desktop
Note: Connect your smartphone to the same network as that of the Pi
Open VNC app and click the + icon and type the IP address you have found earlier.
Click connect and it will ask you whether you want to connect click continue and then type the username as Pi and password as Raspberry and click continue:
You will be welcomed with the wonderful UI of Raspbian. You can do everything you do after connecting Pi with a display apart from playing Minecraft. After many tries, I could not get video output working while playing minecraft.Conclusion
So far we used the help of a hotspot to reach upto this level. There is an intermediate between PI and smartphone. What if we could avoid that intermediate and create our own network so as to communicate between the pi and smartphone.
Switch On the Wifi Hotspot on your phone for few minutes and then connect back to the Pi using VNC. Click on the network icon in VNC you can see 2 network names one from the Hotspot and other from your phone. Click the one with the name of your smartphone hotspot and type in the password (if any).
Close VNC and switch on WIFI hotspot and after sometime Pi will automatically connect to your WIFI hotspot. Install an IP scanner from playstore.
Scan your network using that app, when it finishes you can find the new IP address of your PI. Using that IP address connect to your Pi using VNC.
Now you have created your own small network between Pi and smartphone. You can control your Pi zero W wirelessly around the wifi range.
Thank you for your time.