Headless Pi Zero VNC setup

After setting up a few pi zero’s with VNC without a monitor, here’s the process I follow that may be helpful if you are trying to do similar. I’m no expert but this works for me 🙂

Hardware
sd card reader
pi zero+psu
wifi dongle+adapter if required
pc/laptop (I’m using a pc with ubuntu 16.04)

Software
Raspian image – https://www.raspberrypi.org/downloads/raspbian/
Etcher – https://etcher.io/
SD card formatter – https://www.sdcard.org/downloads/formatter_4/

1. Prep
download raspian jessie with pixel and save to your desktop (or similar location)
download sd card formatter
download etcher

Check your sd card has nothing important saved to it, then format with the SD formater tool. Ensure you pick the correct drive letter to avoid accidental data loss.

2 – Write the image
Open etcher, it should find your SD card, then locate the raspian image (no need to unzip – etcher will do this for you) and follow the steps to write the image. I find etcher much easier than DD or win32disk imager. Wait for it to write and confirm the write was successful.

3. Edit the SD Card
remove and re-mount the sd card in your pc/laptop.
Open the SD card and find: etc/wpa_supplicant/wpa_supplicant.conf

If on linux – open the terminal (shortcut is ctr, shift and t)
type:

CODE:
sudo nano

then drag the file
“etc/wpa_supplicant/wpa_supplicant.conf”
to the terminal window, enter your password when prompted and the nano txt editor will open.
Then add this to the end of the file (edit the name and password with your wifi network details):

CODE:
network={
ssid="my network name"
psk="my network password"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

Then,
ctr + X
y to save changes
then type:

CODE:
exit

in the terminal window to close.

then “As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. For headless setup, SSH can be enabled by placing a file named ‘ssh’, without any extension, onto the boot partition of the SD card.”

create a new blank document on the “boot” partition as detailed above.

4. Eject the sd card

5. Then over to the zero, insert the SD card, wifi dongle, power and watch it boot. Give it 30 seconds or so.

6. Then back to pc to find the IP of your pi on the local network.
Open up router config screen (mine is found @http://192.168.1.1/ – yours might be different) look for the pi in the list of connected wifi devices and note down ip address.
like: 192.168.1.105

open terminal

CODE:
ssh pi@192.168.1.105

accept the connection type
username – pi
password – raspberry

then type:

sudo raspi-config

then I usually:
expand the file system to use all the space on the SD card
change user password to something unique
enable camera if required
advanced options, enable VNC

Exit and it will ask you to reboot, accept and wait for the zero to reboot.

Then to connect over VNC, open your VNC viewer, I use VNC viewer for google chrome by realVNC (search in extensions for: “realVNC”)

Then the desktop should open, enter your username “pi” and password “raspberry” unless you changed it in the previous step, then enter that instead!

Then update the system by:

sudo apt-get update
sudo apt-get upgrade -y

Addition, you might need expand desktop size when viewed under VNC, I followed these instructions:
https://support.realvnc.com/Knowledgeba … spberry-pi
with these settings:

CODE:
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=16

which outputs to – 1024×768@60Hz