Home » Hardware, Linux

Add WiFi to the Raspberry Pi

9 April 2015 No Comment
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

USB WiFi AdapterThe Raspberry Pi comes with a 10/100 Ethernet Port to connect to the Internet. In most instances, this works fine. If you set up your Raspberry Pi as a Media Center, your Wi-Fi router and your A/V Receiver might not be in the same room. Running a long Ethernet cable from your Wi-Fi router in one room to your Raspberry Pi in another room does not seem like a practical solution.

A reasonable solution is to connect the Raspberry Pi to a wireless adapter. Use a USB Wi-Fi adapter to avoid the messy wires and connect your Raspberry Pi to the network. There are hardware and software requirements that are required before we can set this up.

Hardware Requirement

You are going to need the following:

The USB keyboard is needed for setting up the USB WiFi Adapter. Once it is set up, you can use a remote control to navigate the XBMC media center. If you don’t want to buy the components individually, you can get the CanaKit Raspberry Pi 2 Complete Starter Kit.

Software Requirement

You are going to need the following:

  • Linux operating system

You can either get a blank SD card or one that is pre-installed with the XBMC media center.

Software Configuration

Once you have connected all the equipment together including the USB WiFi adapter, you can configure the wireless adapter. The driver needs to be installed. It is not plug and play.

Run the following command to display all the USB devices attached to the Raspberry Pi:


You should see a device listed such as the following. The results may vary depending on the type of USB device you install.

Bus 001 Device 006: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Update the package information by running:

apt-get update

Locate the package needed for this device. In the above example, you will specify RTL818. You don’t need to specify the whole ID.

apt-cache search RTL818

When the search completes, it will give you an output similar to the following:

Firmware-realtek – Binary firmware for Realtek wired and wireless network adapters

Install the driver for the wireless adapter by running:

sudo apt-get install firmware-realtek

Verify the wireless adapter has been installed by running:


It will have the same ID as the one listed above when you ran lsusb.

Module Size Used by
rtl8187 44897 0

Configure your network setting by modifying the network interface file:

sudo nano /etc/network/interfaces


Your wireless network will look something like:

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
wpa-ssid “Your Network SSID”
wpa-psk “Your Password”

Save this file by pressing Ctrl-X. When prompted to Save modified buffer?, press Y and then Enter to confirm the filename.

Reload the network interface by running:

sudo service networking reload

You can check the status of the network interface by running:


The result should look something like:

wlan0 Link encap:Ethernet HWaddr 80:1f:02:aa:12:58
inet addr: Bcast: Mask:
RX packets:154 errors:0 dropped:173 overruns:0 frame:0
TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32399 (31.6 KiB) TX bytes:13036 (12.7 KiB)

If the IP address shown above is not similar to the one above, you are not connected to the network. Start the process again from the beginning. Otherwise, your Wi-Fi should be set up and you can control your XBMC media center from your remote control.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.