Home‎ > ‎Dabbles‎ > ‎RaspberryPi‎ > ‎

RaspberryPi 104 - Adding a Network Connection (WiFi - EDiMAX EW-78811Un)

posted Nov 10, 2015, 8:33 AM by Joshua S   [ updated Nov 11, 2015, 2:16 AM ]
This tutorial demonstrates how to add WiFi functionality to a RaspberryPi.  This will be very helpful when you want to use a Pi in a location not located directly next to the router or with an available LAN cable.

With any of the Dabbles on this site, if you have questions, suggestions, or thoughts, please feel free to send me an eMail (I'm still working to figure out how to enable comments on Google Sites -- suggestions would be appreciated)!

Supply List:
  • RaspberryPi  The actual RaspberryPi hardware this will all be built around.  In this tutorial, a Raspberry Pi 2 is used and has a memory card with the Raspbian operating system pre-installed.
  • PuTTY SSH Client – PuTTY is a free and open-source terminal emulator, serial console and network file transfer application. It supports several network protocols, including SCP, SSH, Telnet, rlogin, and raw socket connection.  Other SSH tools can be used, but this tutorial will leverage PuTTY.
  • WiFi Module  There are a number of USB modules compatible with the RaspberryPi.  In this case, we're using the EDiMAX EW-78811Un.

  • I know I said this guide was going to be comprehensive and not skip any steps, so what better way to start this off than by skipping steps.  I am not writing out instructions for the following (and illustrating from XKCD):
    • Buying a MicroSD Card
    • Buying a RaspberryPi 
    • Finding the IP Address of your Pi
      • This can be done in many ways, including on your router or using an IP scanner such as (AngryIP Scanner or NMAP) -- if there are requests from the "Contact Me" form; I'll look to create a tutorial for this.
    • Obtaining and installing PuTTY
  • Using PuTTY (or the SSH client of your choice) enter the IP Address or DNS Name of the RaspberryPi.
  • If this is the first time you connect, you will get a warning that the RaspberryPi's host key is unknown.  Click "Accept" or "Connect Once" to proceed with the connection.
  • Once connected, log onto the Pi using the credentials you created.  If you have not defined your own credentials, you should, but these are the default credentials:
  • UserID:  pi 
  • Password:  raspberry

  • First things first, let's run the ifconfig command to make sure all of our drivers are set up.  If you see a wlan0 section, then you know the drivers and hardware is functioning but not configured.  If you do not see this section, there is a hardware or driver issue.  
  • If there are issues, try working through the "Problems?" section of this site.
sudo ifconfig

  • Many network related settings can be found in your /etc/network/interfaces configuration.  Navigate to this file and open it to edit with Nano. 
sudo nano /etc/network/interfaces

  • Note -- your wired connection is configured in the first "eth0" section.  The Add (or update) the wlan0 (wireless) section with the following lines.  Note -- this assumes you are running WPA2 (I haven't tried it with any others).  
allow-hotplug wlan0 (remove)
auto wlan0 (add)
iface wlan0 inet dhcp
wpa-ssid "<WiFi Name>"
wpa-psk "<Password>"

  • Now that the config is complete, we need to cycle the wireless network in order to connect.  Use the following commands:
sudo iwconfig 
      • Shows the network is still not set up
sudo ifup wlan0 
      • Gets the wifi card ready to configure
sudo ifdown wlan0
      • Takes down the wifi card
sudo ifup wlan0 
      • Brings up the wifi card and begins the process to connect
sudo iwconfig 
      • Shows the network is set up and has an IP address assigned
sudo ifconfig 
      • Shows the network has an IP address assigned

  • Congratulations!  You have now WiFi'd your Pi!