Getting Started With Raspberry Pi: Setting Up Wireless Networking

In this tutorial we are going to walk through setting up wireless networking for the first time on a Raspberry Pi. 

Prerequisites:

The tools required for this tutorial are a configured Raspberry Pi and a computer to communicate with it. To configure the Raspberry Pi see this tutorial on setting up the pi for the first time.

Parts required:

  1. Wireless Adapter

Steps:

  1. Connect Wireless Module to Raspberry Pi
  2. Scan for Wireless Networks
  3. Configure Raspberry Pi Network Details

Step 1: Connect Wireless Module to Raspberry Pi

Before you power on the Raspberry Pi, connect the wireless module to one of the USB ports. Once connected, go ahead and power on the Raspberry Pi and wait a minute for it to boot up. Log into the Raspberry Pi using your SSH client.

Step 2: Scan for Wireless Networks

Once logged in, type the following command to scan for wireless networks available around you:

sudo iwlist wlan0 scan

Find the name of the wireless network you would like to connect to and copy down the name of it.

Step 3: Configure Raspberry Pi Network Details

In order to connect to the wireless network, the SSID and password need to be added to the WPA supplicant file. Open the WPA supplicant file in Nano:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Once the file is opened, go the end of the file and add the following text:

network={
    ssid="wireless"
    psk="password"
}

Replace "wireless" with the name of your network and replace "password" with the password of your network. Press CRTL-X and enter Y then press enter again to save all of the changes. Restart the Raspberry Pi by typing:

sudo reboot

Wait for the Raspberry Pi to reboot and log back in. To check if your Raspberry Pi is connected to the wireless network, type:

ifconfig wlan0

If the wireless network is connected you should see the information next to inet addr is populated.

Make a note of the new IP address go ahead and shut down your Raspberry Pi by typing:

sudo halt

Once the Raspberry Pi is shut down, power off the pi and disconnect the Ethernet cable. Power on the Raspberry Pi and wait for it to boot up. Log into your Raspberry Pi using the new IP address. Congratulations! you have set up wireless networking on your Raspberry Pi.