New domain and blog

New domain and blog
Please head over to my new domain to view my blog and current projects

Monday, 10 December 2012

Raspberry Pi: Edimax EW-7811UN WiFi Dongle

I recently bought myself an Edimax Wifi dongle to use with my Raspberry Pi. My router is hidden away so I got tired of running a network cable to my Raspberry Pi. The Edimax WiFi dongle was ideal as it is really inexpensive and very small.

It took a while for me to get it set up correctly but eventually I got there. To set up the WiFi connection, you either need a ethernet cable plugged into your Raspberry Pi or you need to connect via the serial port. I connected via the serial port with a FTDI USB to UART converter as this made it much easier to know when the network was connected. 

First of all plug the dongle into one of the USB ports and then reboot.I have not tested this in a USB hub but I am sure it will work the same. To make sure that the dongle has been started, run 
ifconfig
and make sure that wlan0 can be seen.


The next step is to see if your Raspberry Pi can see your wireless network. Run the following command and look for your network.
sudo iwlist wlan0 scan

Under 'Cell 01' I can see my network. Take not of your ESSID and you will also need your network password.

Once you have established that your Raspberry Pi can see your wireless network, you will need to edit the network interfaces file.
sudo nano /etc/network/interfaces
You will need to add the following:
  auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid 'your ESSID'
wpa-psk 'your password'
Your interfaces file should now look like this. Note that I have set a static IP address so if you still use DHCP then you will not need the static IP address settings like I have.


Restart your network connection by running
sudo /etc/init.d.networking restart
and then run
ifconfig
and you should notice an IP address assigned to wlan0.

Now reboot your Raspberry Pi to make sure that everything is working in order.
sudo reboot
If your connection is up and running after the reboot, then you are all set to go wireless.

Greg

12 comments:

  1. Thank you! This is exactly the step by step guide I've been searching for weeks.

    ReplyDelete
  2. How do you connect to hidden ssids?

    ReplyDelete
    Replies
    1. I haven't tested this but I would imagine the setup is the same. The only difference being that when you run 'sudo iwlist wlan0 scan' you won't see your network. So if you know the SSID and password then edit the interfaces file and see how it works.
      I hope this helps.

      Delete
  3. My pi automatically put some wlan0 entries in the /etc/network/interfaces file, so make sure that if you follow the above directions you remove the wlan0 configuration from the file first.

    ReplyDelete
  4. Thanks this was really helpful in getting this thing up and running on my wifi!

    ReplyDelete
  5. Once I get to this part:

    sudo nano /etc/network/interfaces

    I can write in the following:

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-ssid 'your ESSID'
    wpa-psk 'your password'


    but how do I get it to accept those entries? Once I hit enter it just adds another line.

    ReplyDelete
    Replies
    1. Once you have made your changes to your file, press Ctrl+x. This will close nano. You will then be given the option to save changes, press y, and then you will be given the option to change the file name, just press enter to keep the original file name.

      Hope that works for you

      Delete
  6. what happens if your Wlan0 is not there?

    ReplyDelete
    Replies
    1. Try rebooting your RasPi once the wifi adapter has been plugged in. If it still is not recognised, make sure your wifi module has been verified and the drivers are installed. http://elinux.org/RPi_VerifiedPeripherals#USB_Wi-Fi_Adapters

      Delete
  7. I had to change ssid to essid to work it.
    wpa-essid 'your ESSID'

    ReplyDelete