Connect with us

How To

How to Connect Raspberry Pi to WiFi Network?



Connect Raspberry Pi to WiFi

Raspberry Pi has received a new revolution in computing, that stretches far beyond its original remit, but still many users with some old Pi models are struggling to connect the Raspberry Pi to home WiFi network. This article will help you to connect Raspberry Pi to Wifi network in cases where you don’t have the graphical user interface for the Raspberry Pi. For doing this you must have the WiFi dongle unless you are using the Raspberry Pi 3, which has the WiFi built-in.

Connect Raspberry Pi to WiFi
Connect Raspberry Pi to WiFi

Steps to Connect Raspberry Pi to WiFi

There are three major steps to connect Raspberry Pi to WiFi. Here are the steps:

  • Connecting to your Raspberry Pi
  • Getting your network information
  • Configuring your WiFi Network

Connecting to your Raspberry Pi

The first step in connecting the Raspberry Pi to get to a terminal. You can do this by connecting the Raspberry Pi to your monitor and a Keyboard – or connecting through the Ethernet.

Login to Raspberry Pi with the default Raspberry Pi credentials;

Username: pi
Password: raspberry

Getting your network information

This guide will help you to connect Raspberry Pi to WiFi network with the following information:

  • SSID (Network Name): Test Wifi Network
  • PSK (Password): SecrectPassWord

Every time you can see this network name and password in the guide you need to change them to the network name and password of your local network.

If you want to find the network name of your local network you can run the following command in your Raspberry terminal:

sudo iwlist wlan0 scan

This will list all the networks in the region along with some useful data for each network. In order to find your network name look for something which looks like: ESSID: “Test Wifi Network“.

Configuring your WiFi network

Connect Raspberry Pi to WiFi
Connect Raspberry Pi to WiFi

You may also like: x86 Raspberry Pi | Raspberry Pi Ubuntu Core

To make the Raspberry Pi to automatically connect to the WiFi network you need to edit a file called: wpa_supplicant.conf. 

To open the file in nano type the below-mentioned command:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Now scroll to the end of the file and add the following to your file to configure the network:

ssid=”Test Wifi Network”

Remember to replace this with your own network name and password.

Then save and close that file by pressing the Ctrl+X followed by Y. At this point, Raspberry Pi will automatically connect to your network.

You can check the network connection by running the following command:

ifconfig wlan0

If the output seems like this (with the inet addr) then you are connected:

wlan0 Link encap: Ethernet HWaddr 74:da:38:2b:1c:3d
inet addr: Bcast: Mask:
inet6 addr: fe80::8727:5526:a190:b339/64 Scope:Link
RX packets:6917 errors:0 dropped:229 overruns:0 frame:0
TX packets:2931 errors:0 dropped:1 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10001000 (9.5 MiB) TX bytes:295067 (288.1 KiB)

Sometimes the Raspberry Pi won’t get connected automatically and requires a reboot to connect.

If your Pi does not connect after waiting for 2-3 minutes, then try to reboot it using the following command:

sudo reboot

Thank you for reading this post. These are the ways to connect Raspberry Pi to WiFi network.