This article explains the step by step in setting up a headless Raspberrypi running on Raspberry Pi OS without connecting it to Monitor and Keyboard.

A standard method of setting up a Raspberrypi, involves writing the image file onto the SDCard, insert the SDCard into a Raspberrypi, and normally it will require a monitor and keyboard for the first boot to configure the WiFi, SSH, VNC, and etc. However we noticed that in a lot of scenario, we are not able to connect this RaspberryPi to a Monitor and a Keyboard. In this guide, the steps involved here will get you onto your Raspberrypi without the need for a Monitor or Keyboard.

Write image file onto SDCard

First, to write the Raspberry Pi OS, you can refer to this guide for more details. After you have the SDCard written, before inserting them into your Raspberry Pi, insert them into your PC as we will need to add some files onto it. If you have just completed the Raspberry Pi Imager, you might need to remove and re-insert the SDCard as the Raspberry Pi Imager will automatically unmount your SDCard from your PC.

Add in “ssh” and “wpa_supplicant.conf” file to boot drive

After inserting the SDCard to your PC, you should see a drive called boot in your My Computer windows. Sometimes your computer might show a message saying that “you’ll need to format the drive to continue”. You can ignore the message as it is due to the ext4 drive format that is not supported by Windows.

Under this boot drive, you are required to add 2 files, the first one is “ssh” file. Take note that you will need to create an empty “ssh” file that does not has any extension. Before you proceed to next step, in order to avoid the confusion for the file extension, it is recommended to first show the extension for your File Explorer. At your Windows File Explorer, navigate to View > Options > View and uncheck the “Hide extensions for known file types”.

Now, navigate to the boot drive and you should see all the extension the files under this drive. Right click on the empty space and create a new Text Document.

Rename the “New Text Document.txt” to “ssh” without any extension. It should warn you about the changes of the extension, click Yes to apply. Now you should have a “ssh” file in your boot drive.

Next you will need to create a file called “wpa_supplicant.conf” under the same boot drive. Repeat the same steps as for the “ssh” file but this time, the filename is “wpa_supplicant.conf”. Do take note that the file name has to be exactly “wpa_supplicant.conf”.

Edit wpa_supplicant.conf according to your WiFi setup

Next edit this file by using Notepad++ or any text editor that is available for you.

Replace the country code, ssid and psk according to your country and WiF setup. You can refer for more information about wpa_supplicant.conf here. After that, save the file, and eject the SDCard from your PC. The SDCard are now ready for the first boot up.

First boot up

Insert the SDCard into your Raspberry Pi, take note that we are using WiFi communication for the connection through SSH, so you will need to use the Raspberry Pi that has built-in WiFi module. Connect the power connector and it should boot up accordingly. Also be sure that the RaspberryPi is within the coverage of the WiFi configured onto wpa_supplicant.conf file in the previous steps.

For the first bootup it should take some time for the initial configuration, the expansion of partition and etc. After which it should be automatically connected to the WiFi according to your wpa_supplicant.conf file. In order to get the IP Address of the RaspberryPi, there are several ways. In this guide I am using Advance IP Scanner (more info here) to scan through all the connected device in my local network, and eventually find the IP Address of the RaspberryPi.

Aside from using this method, you can also check the connected device via your Router page, or you can use zeroconf method, or there are actually tons of way to get the IP address of your connected RaspberryPi.

SSH to the Raspberry Pi

After getting the IP Address, you can now access the device through SSH.