Contributions

Contributions are appreciated and used to host this site. Thank You for your support.

Feature Products
  • Raspberry Pi with Java: Programming the Internet of Things (IoT)
    Raspberry Pi with Java: Programming the Internet of Things (IoT)
  • Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU
    Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU
  • Premium Clear Case for Raspberry Pi 2 Model B Quad Core and Raspberry Pi Model B+ (B PLUS)
    Premium Clear Case for Raspberry Pi 2 Model B Quad Core and Raspberry Pi Model B+ (B PLUS)
  • Edimax EW-7811Un 150 Mbps Wireless 11n Nano Size USB Adapter with EZmax Setup Wizard
    Edimax EW-7811Un 150 Mbps Wireless 11n Nano Size USB Adapter with EZmax Setup Wizard
  • Getting Started with Raspberry Pi
    Getting Started with Raspberry Pi
  • Raspberry Pi User Guide
    Raspberry Pi User Guide
  • PiBrella LED Add On Board
    PiBrella LED Add On Board
  • Diversitech® WS-1 - Wet Switch Flood Detector
    Diversitech® WS-1 - Wet Switch Flood Detector
  • Onsite Pro FS1NPTW Whole Home Wireless FloodStop with 1 Inch Valve
    Onsite Pro FS1NPTW Whole Home Wireless FloodStop with 1 Inch Valve
  • Floodstop Washing Machine Valve Shutoff Kit
    Floodstop Washing Machine Valve Shutoff Kit
  • Onsite Pro FS3/4H Washing Machine FloodStop with Straight Valves
    Onsite Pro FS3/4H Washing Machine FloodStop with Straight Valves
  • Floodstop Individual Water Appliance Additional Water Sensor XS-01
    Floodstop Individual Water Appliance Additional Water Sensor XS-01
  • Aqua Managers - FS 1 1/4-NPT - Floodstop for Water Heaters Water Leak Detection System - White - 1.25 in. pipe
    Aqua Managers - FS 1 1/4-NPT - Floodstop for Water Heaters Water Leak Detection System - White - 1.25 in. pipe
  • Furman MP-20 Power Relay Accessory, 20 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
    Furman MP-20 Power Relay Accessory, 20 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
  • Furman MP-15 Power Relay Accessory, 15 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
    Furman MP-15 Power Relay Accessory, 15 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
  • Metra 70-2002 Radio Wiring Harness for Saturn 00-05
    Metra 70-2002 Radio Wiring Harness for Saturn 00-05
  • Metra Reverse Wiring Harness 71-2002 for Select 2000-2005 Saturn Vehicles OEM Radio
    Metra Reverse Wiring Harness 71-2002 for Select 2000-2005 Saturn Vehicles OEM Radio
Saturday
Oct202012

Raspberry Pi - Installing the Edimax EW-7811Un USB WiFi Adapter (WiFiPi)

The Edimax EW-7811Un 150 Mbps Wireless 802.11bgn USB Adapter is a popular choice for use with the Raspberry Pi.  Here is what this little adapter has going for it:  

  • It is on the approved list of known working peripherals.
  • Works directly attached to the Raspberry Pi USB port. 
    (Some network adapters used with the Pi require an external USB powered hub) 
  • The latest Raspbian distributions come with the driver for this adapter pre-installed.  
  • It's tiny!  It does not block access to the second USB port on the Raspberry Pi (Model B).  
  • Supports 150 Mbps 802.11n  
  • Backward compatible with 802.11b/g  
  • Internal chip antenna  
  • Affordable / Reasonably priced at $8.79 USD (Buy it here

Shopping List

Photos

(Click photo to enlarge.)

Packaging / Specs

(Click image to enlarge.)

Installation

The latest Raspian distribution (Raspbian “wheezy” 2012-09-18) already includes the drivers for this adapter pre-installed.  This greatly simplifies the installation.  (If you are using a different distribution or an older distribution you may have to install the Linux driver for the Realtek RTL8192CU driver.)

Insert the Edimax USB adapter into your Raspberry Pi's USB port.   Next, lets make sure that the Raspberry Pi recognizes the device.  Use the following command to verify that the Pi "sees" the Edimax WiFi adapter.

lsusb

You should see the Edimax EW-7811Un device listed in the output.


Now that we have verified that the Edimax adapter is recognized, lets check to make sure the kernel driver is loaded.  Use the following command to list the kernel modules:

lsmod

You should see the "8192cu" kernel module loaded.  If not, try removing and re-inserting the Edimax USB adapter. 


As a final validation check to make sure that the Edimax is ready to use, send the "iwconfig" command to display a listing of the current wireless network configuration. 

iwconfig

We are just looking to ensure that the "wlan0" adapter is present.

Now we are ready to move on to the configuration steps.

Configuration

One you have installed the adapter, verified the kernel driver is loaded, and confirmed that a wireless network interface ("wlan0") is available, you will need to configure the wireless connection settings to securely connect to your wireless network.

First, let's open the network interfaces configuration file for editing using the following command:

sudo nano /etc/network/interfaces

Make sure the following lines are added to (or un-commented in) your file

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

 

After modifying the network interface configuration file, we need to create the wireless configuration file. Use the following command to create (or edit) this file.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following data to this wireless configuration file. (Replace the "_SSID_" and "_WPA_SHARED_KEY_" text with your actual SSID and WPA key values.)

network={
ssid="_SSID_"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="_WPA_SHARED_KEY_"
}

(Note:  This configuration is intended for WPA protected wireless networks.)


Once the configuration files are complete, use the following command to restart the wireless adapter / interface.

sudo ifup wlan0

This command will restart the network interface and use the newly defined interface and wireless settings to establish a wireless network connection.  Assuming the configuration is correct, the wlan0 interface should connect and acquire an IP address.

 

For connection verification and an alternate way to see your assigned IP address, use the following command to list the network configuration:

ifconfig wlan0

If you have any trouble getting connected using the "ifup" command, verify your wireless connection settings and reboot your Raspberry Pi.  If you have the Raspberry Pi connected to a display you can watch the Pi attempt the connection during startup.  

That's it, hopefully you now have a WiFiPi.

* Raspberry Pi is a trademark of the Raspberry Pi foundation.

Also check out the installation instructions for installing and configuring the

>> Airlink 101 Wireless N 150 Ultra Mini-USB Adapter (AWLL5099)

The following article is an excellent resource describing many different wireless network configurations for Debian based distributions: 

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (5)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (59)

Worked perfectly, thanks for the guide!

February 18, 2013 | Unregistered Commenter@choitowers

Great guide, I spent ages wasting time trying to understand and install the drivers from the CD that comes with wireless adapter, then found this guide, and had WiFIPi in 10 minutes!

February 24, 2013 | Unregistered Commenter@Dale

Hi Robert - I just wanted to thank you for a great set of setup instructions - Worked like a champ!

March 10, 2013 | Unregistered Commenterjpport123

I used the same Edimax wifi dongle described in this guide, but I could not make it work with dhcp. Dhcp works with eth0, though.

I finally decided to go the static IP route, and it is now functional. For whatever reason, dhcp is not getting an IP address over Wifi. My other systems have no difficulty getting an IP address via dhcp over Wifi. The link below describes one approach to using a static IP.

http://antael.blogspot.com/2013/01/wifi-is-live-and-kicking.html (I did not use this, though).

I have multiple APs, and I entered the specs for each AP in the wpa_supplicant.conf file, giving each entry a unique value for id_str. Below is my wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="SSID1"
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN
psk="PASSWORD"
id_str="SSID1"
}
network={
ssid="SSID2"
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN
psk="PASSWORD"
id_str="SSID2"
}

My /etc/network/interfaces file looks like this:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface SSID1 inet static
address XX.XX.XX.XX
netmask XX.XX.XX.XX
gateway XX.XX.XX.XX

iface SSID2 inet static
address XX.XX.XX.XX
netmask XX.XX.XX.XX
gateway XX.XX.XX.XX

Note that the iface stanza refers to the id_str value in the wpa_supplicant.conf.

March 15, 2013 | Unregistered CommenterMukesh Sundaram

Credit for instructions for Wifi with static IP goes to this site: http://neilbaldwin.net/blog/raspberry-pi-wifi-with-static-ip-address/

March 15, 2013 | Unregistered CommenterMukesh Sundaram

I finally got wifi working with an edimax wireless adapter.
Once in the linux GUI (after typing "startx"), I clicked on the "wifi config" icon and "scan" to detect my network.
I just entered my WEP KEY and it started working!!!
I first followed all instructions above, and had no sucess.

March 27, 2013 | Unregistered CommenterMike

this may be a stupid question but I don't know how to exit the files like /etc/wpa_supplicant/wpa_supplicant.conf

April 17, 2013 | Unregistered Commenterollie

@Ollie

If you are using the "nano" editor, then keystrokes CTRL-O will save the file and CTRL-X will exit.
see this link for more: http://staffwww.fullcoll.edu/sedwards/Nano/NanoKeyboardCommands.html

April 17, 2013 | Registered CommenterRobert Savage

Worked like a charm, thank you

April 18, 2013 | Unregistered CommenterDan

Hi, this tutorial not work for me, but i found another one who work, i think you got to configure your interfaces like that:

sudo nano /etc/network/interfaces


iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

then

sudo /etc/init.d/networking restart

source:
http://omer.me/2012/04/setting-up-wireless-networks-under-debian-on-raspberry-pi/

May 2, 2013 | Unregistered CommenterNIPSEN

Hi. Thanks for exellent guide. Worked fine for my Edimax EW-7811Un in the latest Raspbian 'Wheeze'.. I have a question to which I have not been able to find an answer by searching the web....

Should I be concerned regarding the apparent high number of 'dropped' packets (usually higher that the number of received packets) displayed in the ifconfig results. I have basically the same result as shown in Robert's last screenshot, however an alternative 'generic' wifi adapter shows '0' dropped packets, as does the eth0 interface.?

Does anyone know what is happening re this?

May 9, 2013 | Unregistered CommenterSteve

Hi. Thank you. The only modification needed was to set proto=WPA. It seems to be so that the tutorial is not general, but everyone must match wpa_supplicant.conf according to the modem settings.

October 5, 2013 | Unregistered Commentermatti

it´s horrible. I get a connection when setting up the information in the /etc/network/interfaces, but not through wpa_complicant and not through the gui. So the problem isn´t in the hardware I guess. Any Ideas? Wich information do you need to help?

November 18, 2013 | Unregistered CommenterWapiyaTheBrave

Perfect instructions. Thanks for sharing.

I was using a wired connection during the process and even if ifconfig wlan0 was showing an IP assigned I couldn't reach the network when I unplugged the wire. An extra reboot fixed it and now I'm completely wireless.

December 31, 2013 | Unregistered CommenterAlexis Bellido

So I have had one of these working for ages, no problem.
recently I did some updates and it stopped working but as it, he pi, was near a switch, I just plugged in a LAN cable and all was well, I am a little lazy.

I got a new pi, it had to be wireless, several hours later I arrived at this log, THANK YOU. I have wireless working again.

February 22, 2014 | Unregistered CommenterPeter

Hi
This is an amazing guide but i'm stuck when I type 'sudo ifup wlan0' it says:
ioctl [SIOCSIWAP] : Operation not permitted
ioctl [SIOCSIWENCODEEXT] : Invalid argument
ioctl [SIOCSIWENCODEEXT] : Invalid argument

Thanks
Ryan

April 25, 2014 | Unregistered CommenterRyan

Excellent! Worked perfectly. Thank you

July 5, 2014 | Unregistered CommenterAjan

Congratulations. The best guide I have ever readen about Linux network configuration. I use this guide to configure nano adapter on BeagleBone Black.

Thank you.

July 22, 2014 | Unregistered CommenterFausto Carrion

How do you save and exit those configuration screens?!?!

July 25, 2014 | Unregistered Commenterfish

Hi guys,
I'm 12 and kinda new to the RPi. This is probably an uber-stupid question, but what is WPA? Is there something specifically needed for my router, like a setting or something? I have followed the the instructions a gazillion times, but to no avail.
Any help appreciated.
Thanks!

September 2, 2014 | Unregistered CommenterNick

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
« Raspberry Pi - RS232 Serial Interface Options (Revisit) | Main | Pi4J - Connecting Java to the Raspberry Pi »