Wednesday, January 7, 2015

How to Install a Wireless USB Network Card on Raspberry Pi

I’m going to show you how to install a wireless networking card on your Raspberry Pi. I’m using the ultra cheap Ralink wireless card, but the instructions are similar for any Wireless Device.

Update Your System

For this tutorial I’m using Raspian. This is a great beginner OS for the Pi and quite easy to use.
You’ll want to make sure you’re at least wired in so you can do an update:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove

Get Started

We’re going to do this from SSH, though it’s easier to do from the desktop. But you got a Raspberry Pi to learn didn’t you? Many people use their pi strictly over SSH and don’t run a desktop at all. I have decided to include those kinds of instructions rather than do it the graphical way.

1. Plug in your USB device and find it

Once plugged in, again we’ll look at our USB devices:
lsusb
It looks like in my case it’s installed, so now we’ll make a copy of the WPA supplicant file:
sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.bak
Now open up the file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
And add the following:
network={
    ssid="[YOUR NETWORK SSID]"
    psk="[YOUR NETWORK PASSWORD]"
}
It should look like this:
Now, save the file. CTRL + X - Save “Y”

Start up Your Adapter

Now we need to stop the wlan service:
sudo wpa_action wlan0 stop
Then bring it back up:
sudo ifup wlan0

Test Connectivity

sudo wpa_cli status
You should see something like this:
If not, double check your network SSID and Password, that’s the most common problem. You may have a card that isn’t supported by the Raspberry Pi, if not get a new one! They’re super cheap and well worth it.

(Optional) - If You End up Needing a Driver

Sometimes there are issues that prevent you from loading the drivers for your card. Much of the firmware comes with raspian, but if not you’ll have to find the drivers for it. You’ll need a Windows machine to get the drivers you’ll need (at least for Ralink).
Insert the device and run the driver disk provided. Then after successfully installing it, open up your control panel, and select the properties of the device:
Click on “driver details”
This will show you the location of the driver files to copy off the machine, you can put them on a USB stick and put them on your Pi from there.

Get The Drivers off the USB Stick The Hard Way

I put the driver files on a USB stick. Getting them from the desktop is really easy, but what if you only have SSH access? Don’t fret. With Raspian it should automount just fine, you only need to find it.
Run the following command to list your USB devices:
lsusb
Now, you want to see all the disks that are attached to your system:
sudo fdisk -l
As you can see in my case, my USB stick is mounted at /dev/sda1 so the device is connected to my pi. But where is it?
mount
There it is! Under /media/MYLINUXLIVE but that probably won’t be your folder, it will show the drive label you gave it when you formatted it. (I happen to use and love the LinuxLive program whenever I can).
Now I can just look for the drivers on the disk and copy them to a folder in my home directory:
cd ~
mkdir usbdriver
cp -r /media/MYLINUXLIVE/driver/* usbdriver/
Now the files are copied, safely unmount the drive:
sudo udisks --unmount /dev/sda1
sudo udisks --detach /dev/sda
Now you’ll have the drivers you need, but keep in mind the device may not be supported at all.

Conclusion

I hope this has helped to show you how to install a wireless USB card on the Raspberry Pi. Raspian has a lot of firmware already built in and a lot of USB Wifi adapters are supported right out of the box. Wpa_supplicant makes things really easy. I decided to show how to do it from the prompt for those who want to learn more about the prompt, or install from SSH.
The Raspberry Pi is all about learning so I encourage you to experiment with this stuff as much as possible. The worst that will happen is you’ll need to reinstall the OS. Remember, you’re learning Linux at the same time which opens a lot of doors for your projects. Enjoy!

2 comments:

  1. I was searching for loan to sort out my bills& debts, then i saw comments about Blank ATM Credit Card that can be hacked to withdraw money from any ATM machines around you . I doubted thus but decided to give it a try by contacting {skylinktechnes@yahoo.com} they responded with their guidelines on how the card works. I was assured that the card can withdraw $5,000 instant per day & was credited with $50,000 so i requested for one & paid the delivery fee to obtain the card, i was shock to see the UPS agent in my resident with a parcel{card} i signed and went back inside and confirmed the card work's after the agent left. This is no doubts because i have the card & has made used of the card. This hackers are USA based hackers set out to help people with financial freedom!! Contact these email if you wants to get rich with this Via email skylinktechnes@yahoo.com whatsapp/t: +1(213)785-1553

    ReplyDelete
  2. This card are real i got my card few hours ago and am just coming back from the ATM where i made my first withdraw of 1500$ i am going crazy this is fucking real OSCAR WHITE sorry for being so skeptical about it at first don’t blame me the street these days got fucked up lots of scammers and now i can recommend whoever needs a blank ATM card with about $50,000 on it which you can withdraw within a month because the card has a daily limit.if you are facing any financial problem contact him asap email address is oscarwhitehackersworld@gmail.com or whats-app +1(513)-299-8247 as soon as possible .

    ReplyDelete