Tiny WiFi Adapter for Raspberry Pi

[Updated on Feb. 2. 2013 for (2012-12-16-wheezy-raspbian) Kernel Version 3.2.27+]

The extremely small EW-7811Un USB wireless adapter looks like the perfect WiFi adapter for the Raspberry Pi. Not only is it tiny and relatively inexpensive, it also seems capable enough to be a great companion device for the Raspi. While elinux still shows that some users report timeouts trying to initialize the module, I cannot verify this with 2012-12-16-wheezy-raspbian.

WiFi is not really necessary for the Raspberry Pi. It already comes with an ethernet port, provides RS-232 (aka serial-) connectivity, and has two USB ports. However, in case you wanted to add WiFi to the Raspi, this little adapter seems to be as good as any. Here is why:

The Edimax EW-7811Un

  • complies with wireless IEEE802.11b/g/n standards
  • adjust transmission output by distance and CPU offload, to reduce power consumption when wireless is idle
  • is currently the smallest wireless adapter
  • currently cost between US$ 9 and US$ 15

more than enough reasons to cut the cord and add WiFi connectivity to the Raspberry Pi.

After performing the usual initial configuration in raspi-config, using WiFi Config (a GUI tool sitting at the desktop when starting LXDE with startx) is by far the easiest way to get the Edimax EW-7811Un configured.

But let’s quickly run through the steps of creating that bootable SDCard before dealing with the actual WiFi issues:

Creating that bootable SDCard

  1. Download the image file from http://www.raspberrypi.org/downloads
  2. Unzip the file to get to the image file.
  3. df -h to determine which drive is used for the sdcard, e.g. integrated SDCard Reader turned out to be disk2 for me.
  4. sudo diskutil unmount /dev/disk2s1
  5. sudo dd bs=1m if=/Users/wolf/Downloads/2012-12-16-wheezy-raspbian.img of=/dev/rdisk2
  6. sync
  7. sudo diskutil eject /dev/rdisk2

On a class 10 SD Card, the whole process shouldn’t take much longer than 70 seconds maybe. Insert the SDCard into the Raspi, power up, boot, and use the on screen menu:

In case you need to do this over a network, the Raspberry Pi’s default hostname is raspberrypi. I.e.
ssh pi@raspberrypi .. the pasword is raspberry

sudo raspi-config
to:

  • Expand root_fs
  • Change password
  • Change locale to EN_US.UTF-8 UTF-8 (un-select english UK and select select in long list)
  • Set Time zone (America / Los_Angeles)
  • Change memory split to 128:128
  • Enable ssh

Finally reboot: sudo shutdown -r now
Running the raspi-config again to execute update feature, reboot and login.
Now finding more updates and upgrades like so:
sudo apt-get update
sudo apt-get upgrade

Changing the PI’s hostname

Edit the host name in these two locations:

  • sudo nano /etc/hostname
  • sudo nano /etc/hosts

Adding WiFi support / EW-7811Un

With previous wheezy builds, I had to install the realtek firmware, blacklist the already installed 8192cu driver and install a new one. Not this time. ifconfig shows the wlan0 interface and iwlist wlan0 scan can be used to scan for available Wifi access-points, without any firmware installation or driver updates.

/etc/wpa_supplicant/wpa_supplicant.conf

All what’s needed to do to connect the Raspberry Pi to a Wifi Network, is to add a network configuration to /etc/wpa_supplicant/wpa_supplicant.conf.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

The network configuration depends very much on your network, SSID, Password Security etc. However, here is what I have added, to make the EW-7811Un connect to my WiFi network:

network={
ssid="MY_SSID"
psk="******"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

With the correct WiFi network configuration added to the wpa_supplicant.conf file, the ethernet cable can be removed and the Raspberry Pi will automatically switch over to WiFi.
This behavior is pre-configured in /etc/network/interfaces, which looks something like this:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

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

 

Raspberry Pi – WiFi (Edimax EW-7811Un)

 

Backup the SD Card

Once done with setting up Raspian, I usually create an backup image that later can be copied onto the same or a different SD Card (of equal size).

Backup

Insert the perfect SDCard into the Card Reader and find out how to address it. Again, for me that usually is disk2s1.
sudo diskutil unmount /dev/disk2s1
sudo dd bs=1m if=/dev/rdisk2 of=~/RASP_3_2_27.img
sync
sudo diskutil eject /dev/rdisk2

Depending on the size of the SDCard, this will create a huge file (like 16GB) an may take a while (like 7min).

Restore or Copy

Insert am empty SDCard into the Card Reader and find out how to address it. Once again, for me that usually is disk2s1.
sudo diskutil unmount /dev/disk2s1
sudo dd bs=1m if=~/RASP_3_2_27.img of=/dev/rdisk2
sync
sudo diskutil eject /dev/rdisk2

Leave a Reply