Time to make Raspberry Pi go wireless

Raspberry Pi Model B comes with Ethernet interface built in where you can plug cable and have internet access. In many cases this is enough, but what if you want it to be more portable and still be able to connect to it? One solution would be using Wi-Fi adapter. Since there are couple USB connectors, probably best choice would be using USB based Wi-Fi modules. You can get them in very compact size that aren’t that good at sensitivity and range or choose bigger ones with antenna. No matter what type you select – all of them works pretty same way.


For my experiment I am going to use cheap Wireless adapter EDUP model EP-N8508. It supports all necessary features and standards that are needed to have WiFi. Small form factor makes it attractive to use on many devices like Laptop and so on Raspberry Pi. You may need to use powered USB hub to get reliable performance. For now I am using it attached to one of USB ports directly.

As always in order to learn and understand we are going to set up Wi-Fi from command line using PuTTY. So for this we will need an Ethernet connection.

First of all log in to Raspberry Pi and run command:

sudo nano /etc/network/interfaces

Here you should see

auto lo

 iface lo inet loopback

iface eth0 inet dhcp

 allow-hotplug wlan0

iface wlan0 inet dhcp

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

With the latest Raspbian, all: loopback, Ethernet and wlan interfaces should be present. If not then then add missing parts. Be sure that wlan0 is using dhcp (not manual) IP configuration.

To configure Wi-Fi connection to secured network open configuration file by running command:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

and edit it to connect to WPA secured network:

pi@raspberrypi ~ $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev



ssid="your ssid"










Until Wi-Fi adapter isn’t plugged in you can run command:


to see that there are two interfaces active – loopback and eth0:

pi@raspberrypi ~ $ ifconfig

eth0 Link encap:Ethernet HWaddr b8:27:eb:72:2d:bd

inet addr: Bcast: Mask:


RX packets:517500 errors:0 dropped:0 overruns:0 frame:0

TX packets:280158 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:24861065 (23.7 MiB) TX bytes:14249246 (13.5 MiB)


lo Link encap:Local Loopback

inet addr: Mask:


RX packets:8 errors:0 dropped:0 overruns:0 frame:0

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB)


No Ethernet yet. Now plug in adapter and reboot Raspberry Pi either completely with

sudo shutdown -r 1


sudo reboot

Also you can disconnect and reconnect wlan0 adapter only so you dont: have to reboot. For this first run:

sudo ifdown wlan0

and then:

sudo ifup wlan0

then you will see message:

ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

which can be ignored.

After wlan0 is connected you can run ifconfig command again to check if wlan0 has its IP address assigned. Also you can scan access points with command;

sudo iwlist wlan0 scan

Now when you see you Wi-Fi is working, you can remove ethernet cable and reboot. This will make wifi become default network interface.

I am sure you will run in to several problems like mistyping things, setting something wrong. Actually it took couple hours to get this working. With Linux you should get used to this – in command line you can’t miss anything as there is no GUI that does this for you. If you have different adapter, you may need to check this list to find out common problems with it.

Leave a Reply

Your email address will not be published. Required fields are marked *