Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Install a Wireless USB Network Card on Raspberry Pi

DZone's Guide to

How to Install a Wireless USB Network Card on Raspberry Pi

Installing a WiFi module is quite easy on Raspberry Pi. Berry easy indeed.

· IoT Zone
Free Resource

Discover why Bluetooth mesh is the next evolution of IoT solutions. Download the mesh overview.


I have recently completed a course called "Hands on Internet of Things" that takes you step by step through actual projects with a Raspberry Pi. I am offering a special code for DZone readers to get the full 3 hour course for only $10!! Click here to redeem it!

Today 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.

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!

Do You Like My Rasbperry Pi Tutorials?

I’m constantly hacking on stuff with the Raspberry Pi. Get notified when I post a new article! Sign up for the Raspberry Pi Newsletter spam free! 

Or follow me on GitHub!

Take a deep dive into Bluetooth mesh. Read the tech overview and discover new IoT innovations.

Topics:
usb ,wireless ,raspberry pi

Published at DZone with permission of Jeremy Morgan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}