How to Set Up WiFi on the Raspberry Pi

print
we need to will need to change a few conguration settings in two

les: /etc/network/interfaces, and /etc/wpa_supplicant/wpa_supplicant.conf.

To edit these les, we need to use the Raspbian text editor, Nano. At the command prompt, type sudo nano /etc/network/interfaces to edit the /etc/network/interfaces le.

Pro Tip: If you ever want to copy something from your laptop/desktop and paste it into PuTTY, just copy it on your laptop/desktop, then right click with your mouse where you want to paste it into PuTTY and it will be inserted.

Replace the code in the le with this code:

1 auto lo

2

  • iface lo inet loopback
  • iface eth0 inet dhcp

5

  • auto wlan0
  • iface wlan0 inet dhcp
  • wpa‐conf /etc/wpa_supplicant/wpa_supplicant.conf 9

Afterwards, the le should look like this:

Then type ctrl X to exit, and Y to save the changes. Now edit the /etc/wpa_supplicant/wpa_supplicant.conf le by typing sudo

nano /etc/wpa_supplicant/wpa_supplicant.conf at the command prompt. Replace the code in the le with this code:

4

  • network={
  • ssid=”YOUR WIFI NETWORK NAME”
  • psk=”YOUR WIFI PASSWORD”
  • proto=WPA
  • key_mgmt=WPA‐PSK
  • pairwise=TKIP
  • group=TKIP
  • id_str=”YOUR WIFI NETWORK NAME”
  • }

14

The le should look like this:

The entry for ssid=”YOUR WIFI NETWORK NAME” should be the name of your wireless network, typed exactly as it shows when you connect to your WiFi from another computer. It is case sensitive. The entry for psk=”YOUR WIFI PASSWORD” is the password you normally use to login to your home wireless network. Then re-enter your network name under the id_str=”YOUR WIFI NETWORK NAME” line. Now press ctrl X, then Y, to save the changes to the le.

To see a list of the currently available WiFi networks, enter sudo iwlist wlan0 scan | grep ESSID at the command prompt. To check the status of your WiFi connection, type iwconfig at the command prompt. Your WiFi network name should appear under ESSID: “YOUR WIFI NETWORK NAME”, in my case it is “Siamese“.  If your WiFi connection is successful, you should see a message like this:

If you see something like “Link Quality=0/100“ or “Signal Level=0/100“, go back and make sure that you have entered everything exactly as it is shown in the images. All of the conguration settings should now be saved to work with your WiFi dongle, so enter sudo poweroff into the command prompt to shut down the Raspberry Pi. Now disconnect the ethernet cable and the power cord. Wait about one minute, then plug the power cord back into it without the ethernet cable. Now we will need to use Advanced IP Scanner again to nd the new local IP address of the Raspberry Pi when it is connected via WiFi. This has likely changed slightly from when we used it on the ethernet connection. It is useful to keep track of both IP’s if you will be connecting with ethernet at all in the future.

PuTTY is great if all you need to do is access your Raspberry Pi from the command line. However, many features are only available through the Raspbian desktop. In order to access the desktop remotely, we need to install and congure a Remote Desktop Connection. Read How to Set Up Access to the Raspbian GUI via a Remote Desktop Connection for a tutorial on how to do that. And as always,  feel free to leave a comment if you’re having trouble setting this up and I’ll do my best to help you out.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.