Using WiFi Adapter with Raspberry Pi

It is really tedious to have an Ethernet cable always hanging around with your R pi. A WiFi adapter helps in making the pi module more mobile.In this post I will describe how to use one.

Things you need to have before you can do this:

  • A working raspberry-pi which you can control via your computer or using a screen.
  • A WiFi Adapter

Adding WiFi adapter to the Raspberry Pi:
The WiFi adapter does not start working as soon as you connect it to the Pi. You are still going to need some other means of being able to control the Raspberry Pi either via a keyboard or remotely using a wired network connection.
If you do not have a working Raspberry Pi I will soon post how to setup one.
Configuring the WiFi network:
On the Raspberry Pi (and on Linux in general) we configure our network settings in the file “/etc/network/interfaces”. To edit this file use the following command:

sudo nano /etc/network/interfaces

This opens an editor called nano. It is a very simple text editor that is easy to approach and use.After opening the file in nano to configure your wireless network you want to modify the file such that it looks like the following:

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"

You will need to put your own SSID(network name) and password into the appropriate places.
To save the file and exit press Ctrl+X this will write the file to the disk . If nano asks if you want to Save modified buffer? press “Y” followed by hitting enter to confirm the filename.

At this point everything is configured – all we need to do is reload the network interfaces. This can be done by running the following command .

sudo service networking reload

After reloading the network interface (and re-connecting to the pi if you are using a remote connection) – you can now check the status of our WiFi connection by running:


The result should look something like this:

wlan0 Link encap:Ethernet HWaddr e8:4e:06:17:75:79
inet addr: Bcast: Mask:
RX packets:134501 errors:0 dropped:173 overruns:0 frame:0
TX packets:72985 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:172631666 (164.6 MiB) TX bytes:6815325 (6.4 MiB)

If you see a valid IP address under “inet addr” you can now disconnect the network cable, and enjoy your freedom to move your Raspberry Pi around – because the WiFi connection is up and running!