Connect your Raspberry Pi to Wi-Fi network in 5 easy steps
In This tutorial we will show you how to connect your Raspberry Pi to a Wi-Fi network in few easy steps.
The Wi-Fi adapter used is Edimax EW-7811UN, but the same steps apply for many other Wi-Fi adapters such as Ralink RT5730.
- Edimax EW-7811UN or similar Wi-Fi adapter
- This tutorial has been tested with success on 2013-09-25-wheezy-raspbian
Step 1 – Connect to Raspberry Pi
Connect to your Raspberry Pi via SSH or launc a LXTerminal app.
Step 2 – Open the command line interface for wpa_supplicant (cli)
in the command line and hit Enter. This will open wpa_supplicant command line interface.
Step 3 – Scan for available Wi-Fi networks and display the results
in the command line and hit Enter. This will scan for all Wi-Fi networks in range.
To display results type
. A list of all networks in range will appear.
Step 4 – Add new network
To add a new Wi-Fi network to Raspberry Pi type
and hit Enter. You will see a number displayed back to you. Make a note of this number as we will have to use it in the following steps.
set_network 0 ssid "yourSSID"
and hit Enter. Replace yourSSID with the network SSID you want to connect to and number 0 with the number that was returned by add_network command. We are going to connect to the network pirate008. You should get OK as a reply if the entry was successful.
After SSID has been added we need to enter a password for the network. To do that type
set_network 0 psk "yourPassword"
and hit Enter. Replace yourPassword with your network password and number 0 with the number that was returned by add_network command. If the password entry was successful you should get OK as an answer. If FAIL is returned then repeat previous step making sure that the password is typed in correctly.
Step 5 – Save configuration and reboot
To make sure that the changes are saved type
and hit Enter. Replace 0 with the number that was returned in step 4. Then type
to save the configuration file and finally type
to exit the wpa_supplicant command line interface.
Reboot your Raspberry Pi by typing
in the command line and after Raspberry Pi is rebooted it should be connected to your chosen Wi-Fi network.