Truly Headless Raspberry Pi Setup

Soham Biswas
The Startup
Published in
5 min readNov 9, 2019

There have been times when we enthusiastically buy a new raspberry pi and then later realise that the board itself isn’t the only requirement for it’s setup. Generally a raspberry pi setup requires a display, keyboard and mouse but for this headless method we don’t require any of them. This setup is done over your local WiFi Network.

This headless setup is applicable for Rpi boards with built in WiFi. Incase your board doesnt have one, you can use a USB WiFi dongle as well.

Components required for Headless Setup:

  1. Raspberry Pi Board.
  2. Micro SD card & Card Reader.
  3. WiFi Access Point. (WiFi router or mobile hotspot)
  4. Power Adapter with micro-usb cable.
  5. Laptop/Desktop/Smart Phone with access to the local WiFi network.
  6. USB Wifi Adapter.(optional, if your board doesnt have built in WiFi)

If you choose to use your mobile charger as a Power Adapter make sure it has a rating of 5 Volts and 2 Amps for better compatibility.

Downloading Required Software:

1. Latest version of Raspbian

Download the latest version of Raspbian here. The latest version of Raspbian during the creation of this blog was Buster.

Screenshot of raspbian download page

Download Raspbian Lite if and only if u plan to use it via SSH only.

2. Zip Flashing Tool

The most popular flashing tool for raspberry pi is Etcher. You may download and install it from here.

It’s an efficient and lightweight tool for flashing.

  1. Simply click on “Select Image”. Navigate to your downloads folder and select the .zip file containing the raspbian OS.
  2. After the .zip file is selected, insert your micro-SD card in your computer and click on “Select Target” and choose the inserted SD card. If your SD card is the only removable drive then it will be automatically selected.
  3. Finally click on “Flash!” to start flashing. Flashing can take upto few minutes depending upon your system configurations.

Alternatives to Etcher can be found here.

For Android Users, if you dont have access to a computer you can use this app to flash your SD Card.

3. IP Scanning Tool

For the following steps we require an IP Scanning tool to determine the IP address of the Raspberry Pi. The one that I prefer is Wnetwatcher. You can also use Angry IP Scanner. Download Wnetwatcher here.

For Android, you can use this app.

For Linux users, you can use nmap command from your linux terminal to acquire the same.

sudo apt-get install nmap #For installing Nmap
sudo nmap -sn 192.168.1.0/24 #For scanning IP address

4. SSH Client

Popular SSH Client for Windows is PUTTY. You can download putty from here. Most Linux distributions come packaged with an ssh client. Simply type ssh in your terminal to access SSH Client. For Android, JuiceSSH is a good choice. Install JuiceSSH from here.

Putty SSH Client

Procedure for Headless Setup:

  1. Flash the Raspbian OS on your SD card using Ethcher.
  2. Removed your SD Card once flashing is completed successfully.
  3. Insert your card again.
  4. Now, two different drives will appear on your file manager under the “Devices & Drives” tab, one named boot and the other having a generic name such as USB Drive, Drive etc.

In case of windows, the file manager might prompt to format the SD card. You may click on cancel or ignore the prompt altogether.

5. Now open the drive named boot and do the following:

Firstly, create a file named ssh without any extension or any content. This asks raspberry Pi to enable SSH on boot.

Secondly, create another file named wpa_supplicant.conf with the following content:

country=in
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid="Your WiFi Name"
psk="Your WiFi Password"
}

This file stores the details of your WiFi network. You can change the country code according to your location.

6. Now after saving the files, remove your SD card from your computer.

7. Insert your SD card into your Raspberry Pi and power it up.

8. Use your IP scanning Tool to identify the IP address of your pi.(Raspberry Pi Foundation will be mentioned as the host name)

9. Once you retrieve the IP address, fire up your ssh client . For Putty, enter the IP address in the Host Name field and click open.

For Linux users, open a terminal and type:

ssh pi@ip.address.of.pi

10. Once your ssh connection is successful, enter the password: raspberry .

Congratulations! your Raspberry Pi headless setup was Successful.

Optional Procedure for Desktop Access:

In case you are not comfortable using the command line, you can install a VNC server on your Pi to access its GUI desktop. To do so you need to follow the following steps:

  1. Execute the following commands(line-by-line) through ssh on your Pi.
sudo apt-get update && sudo apt-get upgrade
sudo raspi-config

This opens the raspi-config CLI, here you can navigate the menu using arrow keys.

Here, go to -> Interfacing Options -> VNC, then select Enable radio button -> Finish

Now pi will download and install neccessary software. After installation, reboot Pi.

2. Install VNC Viewer on your Computer/Smartphone. You can download VNC Viewer from here. After Installation, provide IP address, Username(pi) and password(raspberry)[default credentials] to VNC Viewer and then you will be able to view your Pi Desktop on your computer or smartphone. It works similar to TeamViewer.

Here, you can interact with your Pi using your computer’s mouse and Keyboard.

--

--