Manuals, Timing, Ham Radio, Test Equipment

Help keep this site free:
(More Info)

Configure the Ralink 5370 WiFi Dongle on the Raspberry Pi

adapted from :

Note: While based on the RT5370, the instructions would be basically the same for any WiFi dongle natively supported by the Raspbian distribution. I tried several dongles and interestingly they all worked. I prefer the RY5370 because it is generally cheaper and is available with an external antenna (see below for a bit of a warning though...)

1. Install Operating System

Make sure you have the latest Raspbian Operating System (OS) installed on your Raspberry Pi. You can download the latest version of NOOBS here and follow the discussion of installing NOOBS on your Raspberry Pi here. This is important as new drivers are added with each new distribution.

Note: this was written using Raspbian Wheezy, dated 5 May 2015.

2. Update everything

Once installed, we'll then need to make sure we've got the latest firmware drivers by running the following commands (make sure you've got an internet connection - this won't work without!):

 sudo apt-get update

(This updates the list of available packages and their versions, but it does not install or upgrade any packages.)

sudo apt-get upgrade

(This actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed.)

sudo apt-get autoremove

(This will then remove all of the reduntant packages after the latest upgrade)

3. Check and make sure your wifi dongle has installed correctly (LSUSB):


This will list all the connected USB devices.

The line your looking for is:

Bus 001 Device 005: ID 148f:5370 Ralink Technology Corp. RT5370 Wireless Adaptor

If it's there, it's been installed correctly! Note: your Device Number and ID will vary, it's the "5370 Ralink Technology Corp. RT5370 Wireless Adaptor" bit you need to see!

You can also use (LSMOD)


This shows which kernel modules (e.g. drivers) are currently loaded. You're looking for the rt2800usb, rt2800lib etc. modules. If they're there - then they're working :) It should look something like:

rt2800usb        14940  0
rt2800lib        55351  1 rt2800usb
rt2x00usb        11215  1 rt2800usb
rt2x00lib        42335  3 rt2x00usb,rt2800lib,rt2800usb
mac80211         273413  3 rt2x00lib,rt2x00usb,rt2800lib
cfg80211         184163  2 mac80211,rt2x00lib
crc_ccitt        1522  1 rt2800lib

4. Set up the dongle to connect to your network.

Network connections are handled by the WPA Supplicant utility. It should be installed by default on the Raspbian distribution. WPA Supplicant implements WPA key negotiation with your router using configuration information stored in a text file /etc/wpa_supplicant/wpa_supplicant.conf. If multiple networks are specified in the configuration file, the WPA Supplicant utility will automatically select the best network based on the order of the network blocks in the configuration file, network security level (WPA/WPA2 are preferred), and signal strength.  Comments are indicated with the `#' character; all text to the end of the line will be ignored. See the man pages at

You do not need to read the man pages unless you are really interested, we are going to walk you through editing the wpa_supplicant.conf file. 

The configuration file for WPA Supplicant requires an encrypted version of your network passkey. This is done so that your actual key does not need to be simply passed into the document, and the encrypted version will not be useful on another machine. You create the encrypted version using the wpa_passphrase utility as follows:

wpa_passphrase <ssid> [passphrase]

Replace <ssid> with your router's SSID and [passphrase] with your passphrase. For example, this is the command line and the program's response on my RPi:

root@raspberrypi:~$ sudo wpa_passphrase YOURSSID "Your passphrase"
        #psk="Your passphrase"

The easiest way to add that information to the wpa_supplicant.conf file is to use the shell shortcut >> to automatically append the output of the wpa_passphrase program to the wpa_supplicant.conf file. This requires to be logged in as root (I have not managed to make that work using sudo) as follows:

pi@raspberrypi:~$ cd /etc/wpa_supplicant
pi@raspberrypi:/etc/wpa_supplicant$  sudo bash
root@raspberrypi:/etc/wpa_supplicant# wpa_passphrase YOURSSID "Your passphrase" >> wpa_supplicant.conf
root@raspberrypi:/etc/wpa_supplicant# exit

The last exit returns to the normal login.

Now verify that the wpa_supplicant.conf file is as you would expect (IMPORTANT: if editing the wpa_supplicant file by hand, there should be no spaces on either side of the = sign and use tabs, not spaces to indent):

root@raspberrypi:/etc/wpa_supplicant$ sudo cat wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
         #passphrase="Your Passphrase"

Note that wpa_supplicant.conf can have more than one network={} block (each with a different ssid setting), which can be useful if you regularly operate from more than one location. WPA Supplicant will automatically select the best network among those that are specified.

Also, there may be an additional statement "update_config=1" after ctrl-interface... It is of no consequence.

Edit /etc/network/interfaces:

cd /etc/network
nano interfaces

Change it to look like this:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off
iface default inet dhcp

Notice the wireless-power off statement. It turns off power management for the WiFi dongle. It has been known to cause random problems like disconnection.

Exit from root account:

root@raspberrypi:/etc/wpa_supplicant# exit

Now we need to stop wlan0:

sudo wpa_action wlan0 stop

Then load it back up with the new wpa config:

sudo ifup wlan0

After wlan0 has come back up, check to see if you have connectivity:

sudo wpa_cli status

Here what I get here:

root@raspberrypi:/etc/network# wpa_cli status
Selected interface 'wlan0'


If you can see an ip_address, chances are you have succesfully connected to your wifi network!!


I had a lot of problems connecting my Ralink RT5370 WiFi adapters to my network. The drivers would load, iwconfig would show the wlan0 device in disconnected state and scanning would return nothing. No matter what I did, the dongle would not connect to my network. I checked all the places on the net that had info about this problem to no avail. It looked like everything was setup properly and yet, there was no connection. I had two identical dongles and both did the same thing. It looked like a hardware problem was unlikely.

After pulling whatever hair I had left (admitedly not that much), while trying to convince myself it was useless, I swapped the WiFi dongle to another model. Bingo, I was connected immediately.

It turns out that the two dongles that I tried first (both RT5370 with external antenna) are extremely hard of hearing and they did not see any of the 7 (seven!) WiFi hotspots that my laptop, sitting on the same table, would see. Two of those are in my house and the laptop reports full signal strength. On the same Raspberry Pi, I also tried another RT5370 with built-in antenna (one of these ultra small devices) and it worked, even though it would only see 3 access points, and the other device that worked (not sure what chipset) that saw 4 or 5.

It puzzles me that two devices with external antennas would not "see" anything while another using the same chipset but a microscopic internal antenna would work much better.

Buyer beware!!!