Raspberry PI comes with on-board wireless LAN (WLAN – 802.11n) i.e. WiFi and Bluetooth adapter. This means that you all need your Raspberry PI3 to connect to WiFi or Bluetooth and there is no need for additional peripherals such as USB dongles (for WiFi or Bluetooth). In this blog, I will teach you how to setup WiFi on Raspberry PI3
The WiFi setup will be explained in case of headless setup using Raspberry PI with SSH connection (command line) and monitor (or TV) from Rasabian desktop and keyboard.
First, we will see the steps required to install WiFi on Raspberry PI3 using command prompt using SSH connection. This type of setup is required only if you setup raspberry PI in headless mode i.e. without monitor and keyboard.
We have already discudssed about setup Raspberry Pi 3 without monitor and keyboard. It is very important that you complete that setup first to proceed with the WiFi setup.
Setup WiFi in Raspberry Pi from Putty
Before going into the details of the setup of WiFi on raspberry Pi 3, let’s summaries the important steps in Raspberry PI’s headless setup.
- Format the SD Card using SD Card Formatter.
- Download the Raspbian OS
- Write the OS image(.img file) file on the SD Card by using Win 32 Disk Imager
- Activate SSH by creating a blank file with name SSH and have no extension
- Insert the SD Card in to Raspberry Pi and attach the Ethernet cable and power on the Raspberry Pi
- Scan for IP Addresses using Advance IP scanner and note down the IP Address of Raspberry Pi
- Open Putty and enter the IP Address of Raspberry Pi
- Login to raspbeery pi using the default username and password
Please note the IP Address because we need to scan for IP Address again after Wifi Setup.
After successfully logging into Raspberry PI using any SSH client like Putty, type the following command and hit enter .
|sudo iwlist wlan0 scan|
This command will return a list of all wireless networks available with Raspberry PI. The name of the network can be identified from the line ESSID. In our case, the network name is “Anshul”.
Now, we need to connect our Raspberry PI to this network. For this, we need to make some changes to the wpa_supplicant.conf file.
In this file we also need to add the name and password of the WiFi network. Therefore, to open the file, type the following command and hit enter.
|sudo nano /etc/wpa_supplicant/wpa_supplicant.conf|
You can see the file will already have some line like country = GB etc. You need Just enter the following command.
ssid=”Name of the WiFi Network”
psk=”Password of the WiFi Network”
Enter the real name of the network instead of the name of the WiFi network here. In our case, it is The SLNP. Type the password in the PSK section.
Press CTRL +X to exit. Then it will ask you whether to save the changes or not. Type Y and hit enter to save.
After this we need to TURN ON the WiFi ADAPTER . Enter These Command One By One this will TURN ON the WiFi ADAPTER
|sudo ifdown wlan0
sudo ifup wlan0
If Raspberry PI doesn’t connect to the WiFi network, or if you’re not sure if the connection is successful or not, you can reboot raspberry PI using one of the following commands.
After the commands you can disconnect the LAN cable and restart the raspberry PI. It automatically connects to the WiFi network. Scan for raspberry PI’s IP address once again to check it out.
Here You can see the IP Address has been changed now we need to use the new IP address to login in putty In our case the IP Address is 192.168.1.9
You Can login the ssh by using Username and Password. Here You can see the IP Address in second line.
In the next Tutorial I will Show you How to write First Python Program in Raspberry Pi .