In this article we will explore the ways to auto connect Raspberry PI to WIFI and control it from a Windows machine.

In this demo I use RASPBERRY PI 4 2 GB board , but the method applies to all versions with WIFI ,

RPI 3 B , B+ &  RPI Zero W.

There is no need to connect any Ethernet cable to PI .The keyboard , display of Windows machine are used to control RPI. This is called HEADLESS MODE of operation.

This post will get you up and running with a Raspberry Pi, connected to your WIFI network and accessible over SSH, without ever needing to connect anything to it, besides power source.

RPI 4 comes in 3 variables with 1GB , 2GB  or 4GB RAM. This has 2 USB 3.0 & 2 USB 2.0 ports , a Gigabyte Ethernet port & 2 micro HDMI 4k support ports.

The power cable to be used is C type which can handle more current .

To start with download the latest Raspbian OS image from the official website:


Use CLASS 10 Micro SD card of more than 16GB memory.

A card reader can be used to plug in the SD card on to the Windows Laptop.

Image102                   Image104


To burn the OS image use ETCHER software .

Download it from here :



Image 101


You now have the latest Raspbian image ( BUSTER at the time of this blog) which is ready to boot, but not yet ready to fully work headless!

Remove the card reader with SD card and plug it again .The Windows system can display only the BOOT partition . The ROOT partition is not visible.

Image 1


Prepare to Connect WIFI

To make the Pi connect to your Wifi access point at first boot, store the wifi connection details on the Pi’s boot drive.

Following to be done on Windows system.

Under boot partition of SD card , you need to create a file named wpa_supplicant.conf.

Before this , click on View & put a tick mark against File Name Extensions.

This enables to view the extension of filenames.


Image 2

Right click on empty space and create a new Text document.

Image 4

Rename the text document to  wpa_supplicant.conf.txt.

Image 5


Image 6

Double click the file to open in Notepad.Remember , the file name is now with .txt extension , so that it is open with Notepad.Later you need to delete this .txt extension .

Visit this official site to copy and paste the WIFI code.


The 2 letter Country Alpha-2 code is important and can be known from this wiki link :


Now enter the 2 letter Country code & then your WIFI SSID name and password.

Image 7

If you want to connect with more than 1 SSID , wherever available , you can use the

PRIORITY setting as shown below.

Image 8

Save the file.

Right click to rename & remove the .txt extension.


Image 9

On First Boot the contents of this file will be copied to the relevant etc file location , WIFI enabled and joined to the SSID credentials given.

Finally this wpa_supplicant.conf file will be deleted automatically.


By default, a clean Raspbian image will have Secure SHell SSH disabled. You need to enable SSH at first boot.

To do this , right click on empty space on BOOT section of SD card and create an empty text document ssh.txt

Rename it to delete the .txt extension.

On first boot SSH will be enabled and the file will be deleted automatically.

Image 105


Now remove the SD card and plug it on to Raspberry PI.Power up the PI using proper adapter , a power source of 5v 2.4amp required.

Allow some time to boot up and to auto connect with WIFI.

Following image is the scenario setup now.



A Router connected to Internet Service Provider acts as an Access point .My Windows Laptop is connected to this Router over WIFI.

Now my Raspberry PI also joined the same network.

The Gateway IP of my Router is

The Router will assign IP address to its clients as and when connected by DHCP server.

To verify , whether RPI has joined the network , use PUTTY Software


PuTTY is an SSH and telnet client


Open PUTTY and select SSH .

Enter HOSTNAME as  raspberrypi.

Click OPEN

Image 10

Now you can login using standard Raspberry PI credentials

username : pi

password : raspberry

Image 11

You get the Raspberry PI home prompt.

To know the IP ADDRESS allotted to PI type in

hostname -I

Image 12


To know the Gateway IP of Router

route –n



You can type in this Gateway IP on to your Browser to access the Router settings.



Under DHCP –> DHCP Clients list you can see the list of CLIENTS

You can see the raspberrypi as a client with MAC address and an IP allotted.

This IP is allotted by the DHCP Server, which allots accordingly on first come first basis.

It means , if you shut down RPI and connect again the IP may not be the same.The IP allotted is DYNAMIC.

Image 109

To make it STATIC , copy the MAC address of PI (as seen in above screen shot)

Click on ADDRESS RESERVATION under DHCP of Router settings.

Click ADD NEW…

Image 110

Paste the MAC address and the IP address of RPI you wanted to make it permanent.

This IP should fall in Gateway IP , where the last octet only is changed.

Image 111

Now the address is made STATIC and will be same on every boot.

Next  to view RPI on windows we need to install Remote Desktop protocol client XRDP on RPI


sudo apt-get install xrdp

to start installation of xrdp.

Image 13

On Windows machine , RDP server is installed by default on WIN7,8 & 10.

RDP is proprietary of Microsoft.Just ensure that under advanced system setting,

Remote Assistance is allowed.


Open the Remote Desktop connection on Windows.

Image 14

Type in computer name as rapberrypi & Connect.

Image 28



Image 29

Login window will appear.Here under Session select Xorg ( previously it was called sesmanager)

Image 38

username as pi & password raspberry

Image 30

Now you can see the Raspbian welcome screen on Windows machine.

Image 31

Image 32


Image 33

video tutorial :