Raspberry Pi WiFi Setup in Headless Mode

Fig 1: A Raspberry Pi 3 board
Method 1: Using the wpa_supplicant File
- First, open a text editor on your computer and paste the following code into it.
- Second, replace the <country code>, "YOURSSID," and "YOUR PASSWORD" with your country name, WiFi network name, and password, respectively.
- Third, save the file name as wpa_supplicant.conf. Note that the file name should appear exactly as shown.
- Fourth, mount your SD into your computer and copy the wpa_supplicant.conf file to the boot partition.
- Fifth, if you need to enable SSH automatically, create a blank file named ssh in the same boot partition. SSH is an acronym for secure shell. It enables you to run terminal commands on a Raspberry Pi 2 or 3 from an internet-connected computer.
Set up WiFi on Raspbian Desktop

Fig 2: Robotics using a Raspberry Pi board
Method 2: Configure WiFi using Welcome Wizard
The above method requires a Raspbian desktop connection to set up WiFi wireless on Raspberry Pi 2 or 3. You'll automatically get a welcome wizard message like "Welcome to Raspberry Pi" if you boot after flashing your SD card. Furthermore, booting will take you to a window that gives you the following options.- First, Select WiFi Network
- Second, Select WiFi network from the list.
Method 3: Connecting from the Taskbar
Connecting from the taskbar is effective if it's not your first boot or you missed the welcome wizard. For this method:- First, locate the menu, clock, and shortcuts panel on the top of the display.
- Next, locate the network icon at the panel's top close to the clock.
- Click on the network symbol, and you'll see a list of available networks.
- Finally, select your preferred network and key in your password.
Setting up WiFi on Raspbian Lite
Fig 3: A close-up image of the Raspberry Pi ports
Method 4: Using the raspi-config Tool
A raspi-config tool is suitable for setting up WiFi on the Raspberry Pi OS Lite or Raspbian Lite. The tool is available by default on all Raspberry Pi OS Lite; hence no need to worry if you’ve one. Here are the steps you'll follow:- First, open the terminal and run the following command.
- You’ll see a page with options such as Change User Password, Network Options, Boot Options, etc. Go to Network Options and select WiFi.
- Finally, key in your SSID and password and exit the tool after a successful connection.