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 (53)

@Nick

Hi Nick, WPA is WiFi Protected Access --- Its a security protocol for wireless networking to prevent open/unencrypted access to your wireless router. Before WPA, WEP was commonly used, but today WEP should not be used as it is easily defeated/cracked. Most routers today use some form of WPA for protecting wireless connections to the router.

More details here:
http://en.wikipedia.org/wiki/Wi-Fi_Protected_Access


Thanks, Robert

September 9, 2014 | Registered CommenterRobert Savage

This page helped me get my Pi working with the Edimax. I posted a few notes on my experience here:

http://niktheplumber.blogspot.co.uk/2014/09/so-i-wanted-to-get-my-raspberry-pi.html

Hope it helps :)

September 14, 2014 | Unregistered CommenterNik

What a great informative site thanks

December 16, 2014 | Unregistered CommenterAlan

Great post, but I have a WLAN situation where no WAP is configured. Security is via MAC filtering only. I've added the MAC to the router table but no activation yet. What do I need to configure here?
Thanks!
R

January 12, 2015 | Unregistered CommenterRich

@Jon,
I was having the same issue myself. These steps are probably completely coincidental, but this is what I did:
I went to /etc/wpa_supplicant/ and ran all of the SH files.
then i ran sudo ifup wlan0
it had an issue
then I went into the wpa_supplicant config file and changed proto to WEP.
After that i ran sudo Ifup wlan0: It looked promising
sudo ifconfig wlan0: still promising
browser test: internet is working
Try this.

January 25, 2015 | Unregistered CommenterTom

Thank you for the guide. In case somebody else has the same problem I did, I had trouble with the psk since my psk has an @ symbol and the American keyboard produces a ' symbol when I typed it in using the traditional American keyboard layout. This occurred in both nano and using the wpa_gui. However the ' symbol on the American keyboard corresponds to the @ symbol on the (I'm assuming) UK keyboard so I was able to edit the psk in the wpa_supplicant.conf file and now my wireless works perfectly.

February 7, 2015 | Unregistered Commenterfornitsumfornis

I tried all these setups and really didn't have any success, this was the one that worked for me:

(1)Using Winscp on your Windows PC, connect to the raspberry pi using root, then do the following

(2)Find the etc/network/interfaces file and right click and choose edit

(3) Edit the file with the following items:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "wifi-name"
wpa-psk "wifi-password"

(change wifi-name to the appropriate SSID of the network you want to connect to leaving the " ")
(change wifi-password to the correct wifi password of the network leaving the " ")

after setting this up, your wifi should use dhcp, and your ethernet connection should still work

(4)to verify it works, putty into your raspberry pi with your root logon and then at the command prompt type the following commands:

sudo ifdown wlan0

(5)after you enter this command it will bring up information that it is bringing down the interface, then you want to enter the following command:

sudo ifup wlan0

Which should bring up the wlan0 interface with an ip address

(6)to verify you do have a working wlan0, then type the following that will bring up all your interfaces to verfiy you have ip addresses:

ifconfig

This resolved my wifi issues with the edimax wifi card on retropie with a WPA2 wireless network.

February 22, 2015 | Unregistered CommenterAaron

FOR EVERYONE HAVING "IFUP" PROBLEMS:

http://richteel.blogspot.co.uk/2012/11/configuring-wifi-connection.html

This helped me out and got it working straight away

April 7, 2015 | Unregistered CommenterJordan

Thank you for this article! It's great for people that have no networking experience whatsoever (like me). What I had to do to get my pi on the network was change the link auth or "key_mgmt" to WPA2-PSK as well, these were the errors I was getting after typing

`$ sudo ifup wlan0
ioctl [SIOCSIWAP] : operation not permitted
ioctl [SIOCSIWENCODEEXT] : invalid argument
ioctl [SIOCSIWENCODEEXT] : invalid argument`

this worked and I was able to ping other ips on my network without restarting wlan

May 18, 2015 | Unregistered CommenterLauren

These steps are very useful, thanks for taking the time to write them.

When I ran:

`sudo ifup wlan0`

I got an error, but restarting solved the issue.

October 11, 2015 | Unregistered CommenterKunigami

Thanks so much for taking the time to write this up – I have had to refer to it several times!

January 9, 2016 | Unregistered CommenterToby

upon startup it says "not running dhcpcd because /etc/network/interfaces ... failed!" what am I doing wrong

February 7, 2016 | Unregistered CommenterRich Consiglio

Hello,

Great and very informative post. This post helped me a-lot. I followed your post step by step. Thanks for sharing a good post.

March 9, 2016 | Unregistered Commenterhollytech0103

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 »