The configuration of WLAN with a RTL8188CUS dongle on RaspberryPi is quite trivial now. It doesn’t’ rely on esoteric scripts, of manual installation of third-party kernel modules anymore.
I’ve been digging the solution for days before, it came alone at the beginning of September with a release of new ‘firmware’ for the RPi (see ‘A little of Story’ at the end of the post).
The procedure to install and configure a wireless network interface with Raspbian requires as little as a system upgrade and minimal understanding of the ‘wpa_supplicant’ utility.
Prerequisites
- The RaspberryPi must be powered with a 2A output USB charger because the WiFi dongle is very energy-thirsty, especially when it’s scanning the network for available SSIDs or when it’s creating the connection with the assigned SSID.
- The RaspberryPi must be installed with Raspbian version 2012-08-16-wheezy-raspbian or greater.
- The RaspberryPi must be connected to the internet via the ethernet card.
- It’s advisable to have the ‘avahi-daemon’ package installed (and running)
- The WiFi Dongle must not be plugged to the RaspberryPi until specified in the following procedure.
- It’s better to use a USB extension lead to connect the WiFi dongle to avoid the RaspberryPi to self-restart if the dongle is hot-plugged (or hot-unplugged).
Notes
I did notice that when the WiFi dongle is installed and active, sometimes it interferes with the usb keyboard (with both normal and wireless keyboards).
System Preparation
If your RPi is running a Raspbian version greater than 2012-08-16-wheezy-raspbian you can skip the System Preparation.
- launch a repository update:
$ sudo apt-get update
- run a system upgrade:
$ sudo apt-get upgrade
- make sure that the latest RaspberryPi firmware version is installed
$ sudo apt-get install raspberrypi-bootloader
The recent RPi firmwares include the Linux kernel version 3.2.27+ or greater.
On Raspbian the RPi firmware is packaged as ‘raspberrypi-bootloader‘ - Install the wpa_supplicant utility:
$ apt-get install wpasupplicant
WLAN configuration and wpa_supplicant set-up
We suppose that the WiFi dongle will be recognised as the wlan0 device.
Under some circumstances it may be recognised as wlan1 (..or wlan2 on so on), in such case modify the configuration accordingly.
Otherwise if you want your system to forcibly recognise the dongle as wlan0 you will have to play with the /etc/udev/ configuration files.
- Generate a PSK version of your WLAN password with wpa_passphrase utility
$ wpa_passphrase My_WiFi_SSID mypassword
the output will be similar to
network={ ssid="My_WiFi_SSID" #psk="mypassword" psk=b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe }
This output is meat to be an entry for a network configuration blocks of a wpa_supplicant.conf file. By the way we e will use it differently.
- Copy the ‘psk’ value of the wpa_passphrase output
i.e. b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe - edit the /etc/network/interfacesand add the wlan0 configurations as follow:
... auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid "My_WiFi_SSID" wpa-psk b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe
alternatively you can use the clear-text version of the passwordwpa-psk "mypassword"
- Shutdown the RPi.
- Unplug the ethernet cable.
- Plug the WiFi dongle in the RPi’s USB port.
- Restart the RPi and wait that it connects to the Wireless LAN.
If the dongle will lighten up and you can ping or ssh into the Raspbian, congratulations, you’ve done it!
A little of story:
The Linux kernel 3.x comes with the module rtl8192cu.ko that is not able to properly recognised the WiFi dongle with the RTL8188CUS chipset, and when plugging the device, the RPi will hang on device detection of may even freeze.
The most recent versions on the RPi firmware (Sep 2012) have removed the buggy kernel module, and substituted it with a ‘manually’ compiled module called 8192cu.ko probably sources from the source code available at Realtek home page.
Comments
Powered by Facebook Comments
Thanks – this worked great – no issues.
[…] and posts on the Internet. I found a few different approaches. The simplest was presented this article by Macro M.C. on MacroMC.com. Much of the following is based on his article. Marco […]
Awesome – thanks a bunch for these instructions – worked perfectly with an Edimax EW-7811Un dongle.
Thanks for this how-to!
Also works with the soft-float Raspbian “2012-08-08-wheezy-armel”, a TP-Link TL-WN725N wifi dongle and a USB charger with only 700 mA output (while a non-powered USB hub with keyboard and mouse are also connected at the other USB port of the Raspberry Pi).
Thank you so much for writing this, now I have WLAN on my raspberripi!!!
I tried your instructions but got DHCPDISCOVER 255.255.255.255 on port 67 as i tried to connect.
The problem is… you should show in your /etc/network/interfaces the point:
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
while normaly there is only a:
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
which doesnt worked for me but after adding the wpa-conf it worked fine.
And If you dont use Passphrase Encryption and had allready added the SSID and PSK in your wpa_supplicant.conf file your dont need that wpa-ssid and wpa-psk in your interfaces, only needed it seems if you are using the generated passphrase
writer explain all steps of device clearly. Good job.
Thanks, this indeed gets wifi working with my EDUP dongle (https://dx.com/p/48166), but I have the bizarre problem that my download speed maxes out at 50KB/s, while upload goes up to 5MB/s without problem. Over a wired connection I get about 5MB/s in both upload and download.
I’ve seen other people having similar problems online (e.g., https://forum.stmlabs.com/archive/index.php?thread-2579.html) but no solutions that work for me so far. Anyone else having this problem? Any idea how to solve it?
Just in case anyone is facing the same problem: I think my problem must have something to do with the power available to the dongle. I got normal download speeds (5MB/s) after I replaced my 1A power adapter with a more powerful 2A adapter and used two USB slots on the adapter to feed into the Pi’s micro-USB port using a USB Y-cable.
The problem didn’t disappear completely, though, but became intermittent. During large downloads (> 500MB) or after a number of hours of connection, the download speed drops back to 50KB/s. But when that happens, I can usually get it back to normal speeds by resetting the network interface through:
$ sudo /etc/init.d/networking restart
Bizarre…
Actually I’m experiencing a similar problem, but also with Windows 8 (and the same micro WiFi Card).
That dongle has the option to go in low energy consumption mode. In windows you can deactivte it but I’m not sure it’s possible with the RPi.
I will try to implement the ‘restart’ command in a cron job so that it does periodically to prevent the RPi to go offline, especially if you use it to provide a network service.
not working !!! 🙁
i modified file interfaces like this :
iface lo inet loopback
iface eth0 inet static
adress 10.5.5.145
netmask 255.255.255.0
gateway 10.5.5.243
#auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid “corail-technologie”
wpa-psk “b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe”
Remove the brackets from the PSK key
[…] https://marcomc.com/2012/09/how-to-configure-wireless-lan-on-raspberrypi-with-raspbian-kernel-3-2… […]
Hi, it does not work on my rpi
I used:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid “rvrk5010”
wpa-psk f4baf8eba7acb695e68e5e75d025d7624ef2ee336fb532818b2a257a600c13ea
using dmesg I can see the adapter. I am using edimax nao ew-7811Un
Are you sure you have enough Amperage to the RPi (2A)?
Have you tried to put the PSK in clear instead of the MD5 version?
Great man!!! I’ve finally managed to put my wi-fi dongle to work!! thanks again!!
thanks! worked well for me!
It works fine. I skipped System Preparation as I have Raspbian 2015. Ten minutes to set up and now my internet router can see both my laptop and Raspberry.