Headless Setup for Raspberry Pi 3 and Raspberry Pi Zero W


This is an initial setup steps to create a headless Raspberry Pi 3 B+ or Raspberry Pi Zero W (Wireless). It enables access to Raspberry Pi’s console without having a dedicated keyboard, mouse, or display. A PC and Wi-Fi network is required since we’ll access to the console from PC using ssh over Wi-Fi.

 

Contents
– Prerequisites
– Steps
1. Burn Raspbian OS on micro SD card
2. Enable SSH
3. Enable Wi-Fi access
4. Boot up Raspberry Pi board
5. Check Raspberry Pi’s IP address
6. Access to Raspberry Pi via SSH

 

Prerequisites

  • Raspberry Pi board (Raspberry Pi 3 B+ or Pi Zero W)
  • Micro SD card
  • Micro SD card reader like this (in case your PC doesn’t have SD card slot)
  • PC (for burning the OS image, accessing to Raspberry Pi via ssh)
  • Micro USB cable for power supply

 

Steps
1. Burn Raspbian OS on micro SD card
Follow the official instruction to prepare OS image in a SD card.

 

2. Enable SSH
2-1. After finishing writing OS image, open the created “boot” partition.

2-2. Create an empty file with name “ssh”.

 

3. Enable Wi-Fi access
In the same partition, create a file named “wpa_supplicant.conf” with lines below. Please replace <SSID> and <PASSWORD> with your own Wi-Fi network name and password.

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

network={
	ssid="<SSID>"
	psk="<PASSWORD>"
	key_mgmt=WPA-PSK
}

 

4. Boot up Raspberry Pi board
4-1. Eject the micro SD card from PC and insert it into Raspberry Pi

4-2. Connect Micro USB Power Cable and boot Raspberry up.

 

5. Check Raspberry Pi’s IP address
Find out Raspberry Pi’s IP address to access via ssh. I used “nmap” command on Linux PC.

Note: You need to specify netmask of your own Wi-Fi network.

nmap -sn 192.168.1.0/24

Output:

$ nmap -sn 192.168.1.0/24

Starting Nmap 7.01 ( https://nmap.org ) at 2017-09-04 17:35 EDT
Nmap scan report for 192.168.1.1
Host is up (0.032s latency).
Nmap scan report for 192.168.1.141
Host is up (0.049s latency).
Nmap scan report for 192.168.1.142
Host is up (0.00017s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned in 2.83 seconds

 

6. Access to Raspberry Pi via SSH
ssh from PC to the IP address you found out.

ssh pi@192.168.1.141