I recently received a second Raspberry Pi as a gift, and decided to connect it to the internet via wi-fi. Initially, I was unsure as to which wi-fi adapters were compatible with the Pi however, the community suggested the Edimax EW-7811Un USB adapter. The adapter itself is tiny, and can be purchased for less than £10.

Whilst I was trying to set it up, I came across multiple guides offering various conflicting pieces of information, so I thought I’d share what worked for me. Before I go any further, I should state I’m running the Raspbian 2013-09-25-wheezy-raspbian.zip image.

First, update the repo

$ sudo apt-get update

Then, upgrade the system

$ sudo apt-get upgrade

Next, you need to generate a wpa passphrase based upon the name of your wi-fi network and the password you use to connect to it. Note the use of quotes around the name and password- I had spaces and certain awkward characters in both the name and the password- without the quotes, incorrect values were generated. The wpa_passphrase function will return a string- take a copy of this, you’ll need it later.

$ wpa_passphrase "name of your network" 'password for your network'

The interfaces file on the Pi now needs to be edited

sudo nano /etc/network/interfaces

The following code shows the contents of my interfaces file. There were many conversations online about what this file should contain In the end, this is what worked for me.

auto lo
 
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "network name"
wpa-psk the_string_wpa_passphrase_generated

Save the file and reboot the machine. Now the Pi should connect to your wireless home network.