Raspberry Pi Blog


USB wifi adapter

8/18/2012

I purchased a sweet little USB wifi adapter from Ebay for $4.29, which includes shipping from Hong Kong. That is 7,843 miles away or about 12,622 kilometers. The stats on the packaging give us lots of useless numbers:

Wireless Standards IEEE 802.11n (draft) IEEE802.11g IEEE802.11b
Host Interface High speed USB 2.0/1.1 interface
Data Rate 802.11n: up to 150Mbps (downlink) and 150Mbps (uplink)
802.11g: 54/48/36/24/18/12/9/6 Mbps auto fallback
802.11b: 11/5.5/2/1 Mbps auto fallback
Frequency Band 2.4GHz ISM (Industrial Scientific Medical) Band
Chipset Ralink RT5370
RF Frequency 2412-2462 MHz (North America)
2412-2472 MHz (Europe)
2412-2484 MHz (Japan)
Radio Channel 1-14 channels (Universal Domain Selection)
Modulation 11n: BPSK, QPSK 16QAM,64QAM with OFDM
11g: BPSK, QPSK 16QAM,64QAM OFDM
11b: DQPSK, DBPSK, DSSS, CCK
Data Security 64/128-bit WEP Encryption
WPA, WPA-PSK, WPA2, WPA2-PSK, TKIP/AES
Operating System XP/Vista/WIN7 Linux and MAC OS X
Environment Operating Temperature: 0oC to 40oC
Storage Temperature: -20oC to 75oC
Operating Humidity 10% - 90% (Non Condensing)
Storage Humidity: 5% - 95% (Non Condensing)

I found the adapter used about 25ma while booting and then jumped to 78-85ma once the radio turned on. This put the entire pi at about 420ma. The Debian Wheezy found the hardware automatically. dmesg shows us something like this:

[    6.142546] usb 1-1.2: new high speed USB device number 4 using dwc_otg
[    6.290780] usb 1-1.2: New USB device found, idVendor=148f, idProduct=5370
[    6.312373] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    6.330789] usb 1-1.2: Product: 802.11 n WLAN
[    6.344361] usb 1-1.2: Manufacturer: Ralink
[    6.351071] usb 1-1.2: SerialNumber: 1.0
[    8.454978] cfg80211: Calling CRDA to update world regulatory domain
[    9.702550] usb 1-1.2: reset high speed USB device number 4 using dwc_otg
[    9.990435] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[    9.992987] Registered led device: rt2800usb-phy0::radio
[    9.993156] Registered led device: rt2800usb-phy0::assoc
[    9.993325] Registered led device: rt2800usb-phy0::quality
[    9.996898] usbcore: registered new interface driver rt2800usb

Then we add the static IP into our DMZ, or use a DHCP.

root@raspberrypi:~# cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet dhcp

#auto wlan0
#iface wlan0 inet dhcp
#       wpa-ssid 2WIRE992
#       wpa-psk insertfakepskhere

auto wlan0
iface wlan0 inet static
      wpa-ssid 2WIRE992
      wpa-psk insertfakepskhere
      address 76.222.227.50
      netmask 255.255.252.0
      network 76.222.224.0
      gateway 76.222.224.1

Finally we do a "ifup wlan0" and bingo.

root@raspberrypi:~# iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"2WIRE992"
        Mode:Managed  Frequency:2.427 GHz  Access Point: 00:1F:B3:A9:EA:71
        Bit Rate=36 Mb/s   Tx-Power=20 dBm
        Retry  long limit:7   RTS thr:off   Fragment thr:off
        Encryption key:off
        Power Management:on
        Link Quality=43/70  Signal level=-67 dBm
        Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
        Tx excessive retries:3  Invalid misc:3   Missed beacon:0

We give ourselves a hefty pat on the back and reward ourselves with two or three games of BFBC2 and a 16oz Monster Energy drink.

root@raspberrypi:~# ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:6e:c4:53
        UP BROADCAST MULTICAST  MTU:1500  Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
        inet addr:127.0.0.1  Mask:255.0.0.0
        UP LOOPBACK RUNNING  MTU:16436  Metric:1
        RX packets:20 errors:0 dropped:0 overruns:0 frame:0
        TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:5481 (5.3 KiB)  TX bytes:5481 (5.3 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:0f:53:a0:19:e7
        inet addr:76.222.227.50  Bcast:76.222.227.255  Mask:255.255.252.0
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:18545 errors:0 dropped:191 overruns:0 frame:0
        TX packets:6793 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:13691289 (13.0 MiB)  TX bytes:803031 (784.2 KiB)

You can also find much better info about this kind of setup here.





created: Dec. 1, 2013, 1:01 a.m.
modified: April 14, 2019, 12:57 a.m.

Dullbits.com