Getting a Raspberry Pi to work with a USB Wi-Fi adapter:
Raspbian doesn't support a ton of Wi-Fi adapters, so you need to choose carefully. Fortunately, they're cheap (15 USD or less), and Amazon accepts returns. You'll also need a decent power supply for your Raspberry Pi.
I have used each of the following adapters successfully, directly plugged in to a Raspberry Pi model B second revision. They should work out of the box with Raspbian 2013-02-09 or later. Note that your Pi will immediately reboot when you plug them in; if you want a clean shutdown, type
sudo shutdown -h now first.
Tenda W311MI (Based on Ralink 5370 chipset; small and cute. Performance is laggy.)
TP-Link TP-WN721N (Based on Atheros 9K chipset; big and ugly, but performs well.)
Edimax EW-7811un (Based on Realtek 81xx chipset; small and cute. Can not be used out of the box, if at all, for A2SERVER or as an access point.)
Other adapters based upon the same chipsets, as well as other supported chipsets, should work equivalently. Note that adapter manufacturers sometimes keep the model number the same but change the underlying chipset, so your mileage may vary. You might also want to check out this list of various Wi-Fi adapter models for Raspberry Pi.
Configuring the adapter for your Wi-Fi network
First, test to see if your adapter is recognized in Raspbian by typing
iwconfig at the command prompt. If you see an entry for "wlan0", you're in good shape. (If not, you can ask for help on the forums, but the easiest thing to do is get a different adapter. Believe me.)
Now you can configure your adapter using either the Raspbian desktop GUI (even if you don't have a screen attached), or the command line, as explained below.
All of the methods described here will automatically set up your Pi's configuration files (specifically /etc/wpa_supplicant/wpa_supplicant.conf) so that you should automatically connect after reboot (though that sometimes hasn't worked for me when I also have wired Ethernet attached.)
Using the Raspbian GUI desktop (with screen attached)
Using the Raspbian GUI desktop (no screen attached)
startx to start the desktop. Then open the "WiFi Config" app on the desktop. Click Scan, then click Scan in the window that opens, and double-click your network. Enter your WPA passphrase under "PSK" or your WEP key under "key 0". Click Add, then close the Scan window. Choose Save Configuration from the File menu. You're done.
You can remotely display the Raspbian desktop GUI on another computer if you install an RDP/VNC server on your Raspberry Pi. Type:
sudo apt-get -y install xrdp
Then use an RDP client, e.g. Microsoft Remote Desktop Connection included with Windows, or its Mac version, to connect to your Raspberry Pi.
(If you would prefer to use a VNC client, configure tightvncserver, which was installed by xrdp.)
Now you should see the Raspbian desktop in a window on your computer, and you can use "WiFi Config" as described above.
If you don't want to work with the GUI, you can use wpa_cli, which is the command line version of the GUI's "WiFi Config" tool. Make sure you type both the single and double quotes accurately where shown. Type:
sudo ifup wlan0(returns network number, assuming 0 below)
(replace with your WiFi network name)
wpa_cli set_network 0 ssid '"MyNetworkName"'
If you have a WPA/WPA2 protected network, type:
(replace with your 8 to 63 character WPA passphrase; omit double-quotes for 64 digit hex)
wpa_cli set_network 0 psk '"abcdefgh"'
Or, if you have a WEP protected network, type:
(replace with your 5 or 13 character WEP key; omit double-quotes for 10 or 26 digit hex)
wpa_cli set_network 0 key_mgmt NONE
wpa_cli set_network 0 wep_key0 '"abcde"'
(If you have an unprotected network, you should change that, but in any case you can simply omit the above commands.)
wpa_cli enable_network 0
sudo ifdown wlan0; sudo ifup wlan0
Now you can type
ip addr. If you see an IP address for wlan0 (next to "inet"), your Wi-Fi adapter is on your network.
Raspberry Pi Party
last updated June 12, 2013