Raspberry Pi, Raspian

Raspberry Pi: Set up Wifi on Raspian

This post is about my experience of setting up wifi on my Raspberry Pi 2 Model B running Raspian. In fact it’s about two attempts at setting up wifi, one bad and one good.

Context: I’m running Raspian, connected via a terminal window running on my PC; I have a directory on my Pi which appears on my PC as a drive.

First Attempt (bad experience):

The first wifi dongle I bought was the TP-LINK Archer T1U AC450 Nano USB Adapter (from Amazon). I bought this because it uses 5GHz and I thought this would be a better option when using my Pi as a Kodi media player.

My first action was to just plug in the dongle and reboot to see if it would work out of the box … it didn’t. The following command shows that it’s not being recognized on usb port 004 (i.e. there is no driver installed):

sudo lsusb

wifi lsusb

Next action was to go the the TP-LINK web site to download a driver. The site had a linux driver and this contained a PDF with instructions and screenshots … so far so good although the screenshots are for Ubuntu.

I downloaded and un-zipped the driver to my PC and copied the Driver folder across to my Pi using the pishare drive. First instruction was to run the make command to build the driver; tried this and got the following errors:

wifi tp-link make error

At this point I tried emailing the help address supplied with the dongle and posted a help request on the TP-LINK forum and waited.  Two days later, no reply. I decided to try the wifi dongle on my PC (Windows 10) just to make sure it worked; which it did after downloading and installing the Windows 10 driver. However, on checking the connection speed on my router, my PC’s 5GHz wifi connection had a slower connection speed that the kids’ laptops running with 2.4GHz wifi. This was the tipping point, so time to send it back, get a refund and just buy a much cheaper lower spec dongle which other buyers had said works fine with the Pi.

Second Attempt (good experience)

This time I bought the Tontec 150Mbps 11n USB Wifi Dongle Adapter (from Amazon) for only £5.99 (compared to £15.99 for the TP-LINK T1U).

Again, tried plugging it into the Pi and this time it does just work! (even without a reboot); the lsusb command now shows the dongle installed on usb port 004:

tontec lsusb

… and the ifconfig command shows the wlan0 network connection with a different IP address from the eth0 connection (if you are doing this for yourself then make a note of the wlan0 IP address):

tontec ifconfig

… now this is looking as easy as I’d hoped it would be the first time around.

Now all I need to do is connect to my router: I’ve already got VNC installed so I just run my start-vnc script which opens a window to the Pi, and set the wifi connection up through the Raspian GUI (just click on the wifi icon in the top right); there are clear instructions on the official website.

Finally, test that it’s all working by disconnecting the Ethernet cable and rebooting the Pi (enter sudo reboot command). Open a new terminal window using PuTTY but this time use the IP address for the wifi connection (as noted above after running the ipconfig command).

As a another check, run the following command in the terminal window:

sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

… which will should show the ssid and key for your router set up in the file:

tontec supplicant.conf

If you don’t have VNC set up and want to set up the connection to your router you can do so on the command line following the instructions given on the official website.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s