Saturday, August 29, 2015

Configuring WIFI USB Adapter with Raspberry Pi2

In this tutorial, we will discuss about, how to configure a WIFI USB adapter with RaspberryPI2 in station/client mode. Hope you already have a WIFI router to which your PI2 can connect to using the adapter.
 
image
 
I usually use my Pi2 as a download box, to download large files, which sometime takes days to complete. The advantages are quite obvious, when comparing to your PC downloads the files. Pi2 consume very less energy, silent and cost effective. If you are using your PC for downloading larger files, you’ve to keep it on for a long time, hence it will consume more energy compared to Pi2. Since it has rotating hard disks and fans, the noise can also make it less attractive choice for late night downloads.
 
For this experiment, I’ve used my BELKIN USB WIFI adapter (F7D2101 802.11n Surf & Share Wireless Adapter v1000). Internally it uses (Realtek RTL8192SU) chipset. I’ve referred this Raspberry thread to compile the details.  Though this article uses BELKIN, the steps are generic, so that you can use it for your devices, by replacing the firmware and driver, for your specific device.
 
The steps are detailed below.
 
1. Have a RaspberryPi2 with Ubuntu14.04 installed. (Follow this tutorial)
Note: Install Lubuntu Desktop, as per the tutorial.
 
2. Plugin your WIFI USB Adapter and then issue the command ‘lsusb’ (in LXPanel)
Now find out your USB device listed in the output. For mine its something like,
 
`Bus 001 Device 004: ID 050d:845a Belkin Components F7D2101 802.11n Surf & Share Wireless Adapter v1000 [Realtek RTL8192SU]`
 
Now we’ve to install the firmware and the kernel driver for the specified device, if not already installed. In this scenario, I’ve to install the firmware and driver for ‘RTL8192SU’, as Belkin internally uses this chipset
 
3. Installing the WIFI USB Firmware
This is specific to your device. In this scenario, there are various Realtek chipsets, which are supported by a specific driver and module.You can find this mapping in this wiki. According to this mappings, search your device and find the name of the driver and firmware you’ve to use.
 
Then download the firmware for various Realtek chipsets from, here. By referring to this link, I’ve found that, I’ve to install this firmware, for RTL8192SU.
 
Now Download the firmware and copy it to /lib/firmware/rtlwifi/
(In this scenario, I’ve /lib/firmware/rtlwifi/rtl8712u.bin)
 
4. Installing the WIFI USB Driver
Edit the file "/etc/modprobe.d/blacklist.conf" and add the line, blacklist rtl8192cu
 
Download the kernel driver for your device. In this scenario, there are various Realtek chipsets, which are supported by a specific driver and module.You can find this mapping in this wiki.  In our case the module name is ‘8192cu.ko’. You can either compile it from source for ARM (which is hard) or download the compiled one (for ARM) from here.
 
Open LXPanel and then issue the below commands;
 
tar xf 8192cu.tar.gz
sudo install -p -m 644 8192cu.ko /lib/modules/3.18.0-14-rpi2/kernel/drivers/net/wireless
(Verify the the above path, as it can be different based on your kernel version: i.e. in our case it is 3.18.0-14-rpi2)
 
sudo depmod –a
 
5. Reboot and Configure WIFI
After reboot, your WIFI Adapters LED must be blinking. Now you can either use Network Manager, to add the WIFI networks or you can use wpa_supplicant system, to configure the WIFI.
 
PS: Download the driver and firmware from here, if you are not able to access the aforementioned links.