Jump to: navigation, search

Using USB WiFi Devices for Dual Radio

Introduction

The MP02 and many commonly available routers provide a single radio which operates on a selected channel in a particular band, typically either 2.4GHz or 5GHz.

In the SECN firmware, we configure OpenWrt so that the single radio operates two WiFi interfaces - an AdHoc interface for the mesh, and an AP interface for the Access Point.

Obviously the resources of the device have to be shared between the two interfaces and so there is a reduced bandwidth/data throughput available in this configuration. In many circumstances this is not a great issue.

Perhaps more important in some situations however is that the antenna of the device is trying to satisfy the diverse requirements of the mesh and the AP.

In a typical campus scenario, the mesh is used as a backbone network to provide connectivity to a number of APs operating within buildings. For good mesh operation, the antenna should be able to get a strong signal from a central node across the campus, whereas the AP requires a strong signal to be established within a building.

There are some excellent dual band routers available (e.g. TP Link WDR3500, WDR4300) which provide two radios which operate simultaneously, one on each band. Removable antennas may allow for the use of specialised antennas for the mesh. A good example of this approach is the Altermundi Project:

 http://altermundi.net/
 https://commotionwireless.net/blog/2014/11/05/do-it-yourself-antennas-for-community-networks/


As another alternative, routers such as the MP02, and many TP Link devices, provide USB ports which may be used to support USB WiFi devices in order to provide a second radio, and a second antenna which may have quite different characteristics to those of the main router antenna.

There are a wide variety of such USB WiFi devices available, and many have directional antennas (eg panel antennas) which will provide around 10dB more signal in the forward direction. The USB cable connection allows the device to be mounted separately from the main router, with the antenna oriented towards the central node for the mesh. For example in a school classroom, the router can be mounted on the internal building wall with a normal omni-directional antenna, while the USB device is sited at a window, or on an outside wall, pointing towards the central mesh node.

A variation of the SECN fimware called SECN-Duo has been built to support USB WiFi devices. These devices generally use either a Ralink or Atheros chipset, and the firmware has drivers for both.


Preparation

Firmware

The SECN Duo firmware is available on the Village Telco Downloads web page along with the normal SECN firmware:

   http://download.villagetelco.org/firmware/secn/unstable/mp02/SECN-2/
   http://download.villagetelco.org/firmware/secn/unstable/tp-link/SECN-2/
   http://download.villagetelco.org/firmware/secn/unstable/mp02/SECN-3/
   http://download.villagetelco.org/firmware/secn/unstable/tp-link/SECN-3/


Setup

To set up the system, download the firmware and md5sum file, then reflash the router from the SECN Advanced/Firmware page, and restart the router.

Do this without the USB WiFi device installed.

After you flash a router with the SECN Duo firmware, on the Advanced page you will see a 'Duo Radio Mode' control which lets you select one of three modes:

   1. AP and Mesh running on internal radio (Default, as flashed)
   2. AP on internal radio, Mesh on USB radio
   3. Mesh on internal radio, AP on USB radio

By default the mesh and AP interfaces will be running on the internal radio after flashing i.e. Mode 1.

Check that the router is operating correctly, and that you can connect to your mesh with the appropriate settings using the default internal radio mode.

Once you have the router operating correctly, select the required Duo mode (e.g Mode 2 - AP on internal radio, Mesh on USB radio), select the required channels for the internal and USB radios, then click the Save button. After the screen refreshes, check that the settings have been saved correctly.

Switch off the power to the router, connect the USB device, and switch on the power. The router will start up with both radios operating with the select mode and settings. Check that the mesh and AP interfaces are operating correctly.


Notes

USB Power, Hubs and Cabling

USB WiFi devices are relatively high power devices and are particularly sensitve to the capabilities of the USB power source to which they are connected, and the characteristics of the USB cables used to connect them.

Some routers have limited internal USB power power capabiliy which may not support high power USB WiFi devices.

The power supply for the router has to supply the current required to run the router as well as the current to run the USB WiFi device. This is particularly critical for USB powered routers (such as the MR3020)

Be sure to use good quality USB cables. Thin, unshielded cables often cause problems with USB WiFi devices.

Routers with single USB ports typically drive the USB data lines directly from the main system chip and thus have very limited capability to drive data through long cables. Adding a USB hub will provide buffering for the data lines and allow the use of extension cables and multiple devices. Keep in mind that the USB hub itself will consume some current from the power supply, in addition to that drawn by the router and USB peripherals.

A soft reboot (from the command line or SECN admin screen) may not properly reset the USB WiFi device. Be sure to cycle the power to ensure correct start up.

Capabilities of USB WiFi Devices

The capabilities of USB WiFi devices varies considerably, even though they use the same chipset. The manufacturer can pre-set many characteristics such as TxPower and MaxAssociations, and you may not be able to change these through the SECN interface.

Be sure to validate the capabilities of particular devices that you wish to use before committing to a production network design.

NOTE: Please be aware that not all USB WiFi devices will interoperate correctly on a mesh due to differences between the AdHoc implementation in the devices and the device driver libraries. This may mean that a particular device type will mesh with other devices of the same type, but not with devices of a different type.

A number of branded devices have been tested with the firmware and are known to work satisfactorily as below. Please post on the VT mail list if you test with other devices and let us know the outcome.

 TP Link        TL-WN722N    (Atheros 9271, 2.4GHz, removable antenna, RP-SMA) 
 TP Link        TL-WDN3200   (Ralink 5592, dual band 2.4/5 GHz, internal antenna)
 Netgear        WNDA4100     (Ralink 3593, dual band 2.4/5 GHz, internal antenna)    *** Possible interop issue 
 ALFA Networks  AWUS036H     (Ralink 3070, 2.4GHz, removable antenna, RP-SMA)
 LinFox         LF-8500000G  (Ralink 3070, 2.4GHz, removable antenna, RP-SMA)
 KASENS         KS-6800000N  (Ralink 3070, 2.4GHz, integrated panel antenna)


There are also many other, unbranded devices available that will work as well. Look for devices with the chipsets listed above as a starting point.

Be aware that devices may behave differently even though they have the same chipset, and that branded devices may change chipsets between hardware revisions.

Useful information about the device can be found in the 'dmesg' output when the device is installed on a router or a PC running Ubuntu. Some typical 'dmesg' outputs below:


On OpenWrt

   Ralink RT3070
   [   31.740000] usb 1-1: reset high-speed USB device number 5 using ehci-platform
   [   31.900000] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
   [   31.930000] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 0005 detected
   [   31.940000] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
   [   31.940000] Registered led device: rt2800usb-phy1::radio
   [   31.940000] Registered led device: rt2800usb-phy1::assoc
   [   31.940000] Registered led device: rt2800usb-phy1::quality
   [   31.940000] usbcore: registered new interface driver rt2800usb


   Ralink RT5390
   [   31.740000] usb 1-1: reset high-speed USB device number 2 using ehci-platform
   [   31.900000] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
   [   31.930000] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected
   [   31.940000] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
   [   31.940000] Registered led device: rt2800usb-phy1::radio
   [   31.940000] Registered led device: rt2800usb-phy1::assoc
   [   31.940000] Registered led device: rt2800usb-phy1::quality
   [   31.940000] usbcore: registered new interface driver rt2800usb


   Atheros AR9271
   [  167.470000] usb 1-1: new high-speed USB device number 2 using ehci-platform
   [  167.640000] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
   [  168.050000] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
   [  168.300000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33 credits
   [  169.070000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
   [  169.070000] ath: EEPROM regdomain: 0x60
   [  169.070000] ath: EEPROM indicates we should expect a direct regpair map
   [  169.070000] ath: Country alpha2 being used: 00
   [  169.070000] ath: Regpair used: 0x60
   [  169.090000] ieee80211 phy1: Atheros AR9271 Rev:1
   [  169.110000] Registered led device: ath9k_htc-phy1


On Ubuntu 14.04

   Ralink RT3070
   [ 4014.524963] usb 1-1.2: new high-speed USB device number 5 using ehci-pci
   [ 4014.635070] usb 1-1.2: New USB device found, idVendor=148f, idProduct=3070
   [ 4014.635077] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
   [ 4014.635081] usb 1-1.2: Product: 802.11 n WLAN
   [ 4014.635083] usb 1-1.2: Manufacturer: Ralink
   [ 4014.635086] usb 1-1.2: SerialNumber: 1.0
   [ 4014.749270] usb 1-1.2: reset high-speed USB device number 5 using ehci-pci
   [ 4014.852178] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
   [ 4014.880310] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 0005 detected
   [ 4014.887017] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
   [ 4014.887488] usbcore: registered new interface driver rt2800usb
   Atheros AR9271
   [11236.836132] usb 1-2: new high-speed USB device number 5 using ehci-pci
   [11236.984931] usb 1-2: New USB device found, idVendor=13d3, idProduct=3327
   [11236.984941] usb 1-2: New USB device strings: Mfr=16, Product=32, SerialNumber=48
   [11236.984947] usb 1-2: Product: UB93
   [11236.984953] usb 1-2: Manufacturer: ATHEROS
   [11236.984959] usb 1-2: SerialNumber: 12345
   [11237.874950] usb 1-2: ath9k_htc: Firmware htc_9271.fw requested
   [11237.875068] usbcore: registered new interface driver ath9k_htc
   [11238.233421] usb 1-2: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
   [11238.471316] ath9k_htc 1-2:1.0: ath9k_htc: HTC initialized with 33 credits
   [11238.741296] ath9k_htc 1-2:1.0: ath9k_htc: FW Version: 1.3
   [11238.741303] ath: EEPROM regdomain: 0x60
   [11238.741305] ath: EEPROM indicates we should expect a direct regpair map
   [11238.741309] ath: Country alpha2 being used: 00 
   [11238.741311] ath: Regpair used: 0x60
   [11238.747218] ieee80211 phy1: Atheros AR9271 Rev:1