5GHz Wifi On the Raspberry Pi 2

Extract

After much searching I found a way to get 5MHz Wifi Dongles working on the Raspberry Pi 2 without having to compile a new kernel.  I can’t claim any credit here;  that belongs to MrEngman on the RaspberryPi.org forums who has done all the compiling and has made the kernel modules available to download.

One thing I did discover is that the high gain 5GHz wifi dongles draw more power that the Raspberry Pi 2 would like to deliver.  To fix this I have made a special USB cable with a dedicated 5V power supply for the dongle.

Hardware

I have two 5 GHz Wifi dongles: an Edimax AC600 EW-7811USC Dual Band and an Alfa Network AWUS036AC Long-Range Dual-Band AC1200.

Edimax AC600

Edimax AC600

Alfa AC1200

Alfa Network AWUS036AC Long-Range Dual-Band AC1200

I could get the Edimax AC600 to work, but not the Alfa AC1200 even though they have the same chipset.  When I tried running the Pi2 on batteries through a BEC I found that the AC600 would not always come up either.  As the dongle was getting quite hot in use I summised that it was trying to draw more current than the Pi was able to supply.

To test this out I took a USB extension lead and chopped some cable out of the middle to make it shorter.  At the same time I added a dedicated 5V power supply for WiFi dongle, fed from the BEC.  The joins were insulated with heat shrink tube and insulation tape.

USBSplice

USB Power Booster Cable

USB Power Booster Cable

With this in place I was now able to use both the Edimax AC600 and the Also AC1200.

Power Booster Setup

Power Booster Setup

Procedure

The full post on how to install the Realtek RTL8812AU driver module is available on the raspberrypi.org forums.  I’ll expand on the details given there based on my experience.

  1. The first task is to establish the current kernel version on your Pi.  This is done with the command:
    uname -vr
  2. This command shows the details you need.  For instance a fresh install of the 2015-05-05 Raspbian build gives.
    3.18.11-v7+ #781 PREEMPT Tue Apr 21 18:07:59 BST 2015
  3. The information we want is the version number at the start, up to, but not including the plus sign (+) and the build number after the hash (#).  In this case 3.18.11-v7 and 781.
  4. These values are inserted into a url to get the modules relevant to your kernel.
    https://dl.dropboxusercontent.com/u/80256631/8812au-{kernel_version}-{build}.tar.gz
  5. Replace {kernel version} and {build} with your values.  In my case the url becomes:
    https://dl.dropboxusercontent.com/u/80256631/8812au-3.18.11-v7-781.tar.gz
  6. Use this url with wget to download the compressed kernel module.
    wget https://dl.dropboxusercontent.com/u/80256631/8812au-3.18.11-v7-781.tar.gz
  7. If you get an error here, it probably means that there isn’t a pre-compiled modules for your kernel version. All is not lost however.  You can try upgrading your kernel to a version that is supported.
  8. Type the command:
    sudo rpi-update
  9. This can take a while, so go have a drink and periodically check-in to see if its finished.  When done, you will need to reboot your Pi.
  10. Now run ‘uname -vr’ again to get the new version and build numbers
    3.18.12-v7+ #782 SMP PREEMPT Tue Apr 28 19:54:13 BST 2015
  11. Try downloading a module with the new kernel version and build number.  Remember up to but not including the +. In my case:
    wget https://dl.dropboxusercontent.com/u/80256631/8812au-3.18.12-v7-782.tar.gz
  12. This worked for me leaving the file 8812au-3.18.9-v7-768.tar.gz in my home directory.  We extract the files from this with the command:
     tar zxvf 8812au-3.18.12-v7-782.tar.gz
  13. This creates some files in the current directory, one of which is ‘install.sh’.  Run this script with
    ./install.sh

    you don’t need a sudo at the start.

  14. Reboot your Pi.  If you already have the Realtek specific version of hostapd installed the 5GHz dongle will probably work straight away, although possibly on the 2.4Ghz band if your system was previously configured to do so.
  15. The 5GHz band is more regulated than 2.4GHz, so we need to install the Central Regulatory Domain Agent (CRDA) package that controls which frequencies and features are available to your country.  Hostapd does not work with the world domain (00).  You have to be specific.  If not already installed, get the necessary package with:
    sudo apt-get install iw crda
  16. Then to set the CRDA region edit the file /etc/default/crda
    sudo vi /etc/default/crda
  17. Append your domain to the line “REGDOMAIN=”, which in my case is GB
    REGDOMAIN=GB
    
    crda
  18. Edit your /etc/hostapd/hostapd.conf to use the 5GHz band
    sudo vi  /etc/hostapd/hostapd.conf
  19. This is my configuration.
    interface=wlan0
    driver=rtl871xdrv
    ctrl_interface=/var/run/hostapd
    ssid=Pi_AP
    channel=44
    beacon_int=100
    hw_mode=a
    ieee80211n=1
    wme_enabled=1
    ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
    wpa=2
    wpa_passphrase=Raspberry
    
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=CCMP
    max_num_sta=8
    wpa_group_rekey=86400
  20. Finally reboot again and hopefully you will have a 5GHz Wifi access point.  I use WiFi Analyzer on my android phone to check.

Performance

At home with the transmitter and receiver in close proximity, there were no issues, the latency being comparable to the 2.4 GHz WiFi.

Buoyed up by this result, the next step was to get outside and test the range.

I took my test rig to my club flying field one lunchtime.  With the Edimax AC600 connected directly to the Raspberry Pi, the maximum distance I could get before the picture froze was 28 metres.  This was in a level rural location, so the chance of interference was minimal.

For the second test I used the Alfa Network AWUS036AC (AC1200).  I had to use the power booster cable, as this Adapter requires too much power for the Pi to supply directly.   With the Alfa AC1200 I managed 100m before the video started stuttering; still not enough for a useable FPV system.  If the line of sight was blocked by a building or tree the video would freeze completely.

Conclusion

If these results are to be believed, then the future of this project looks bleak.  However, the WiFi adapter manufacturers claim that these devices should perform better for range and speed than the previous generation.  I need to check the performance of the WiFi adapter in the Laptop.  It is about three years old now and probably can’t cope with the latest WiFi protocols.  Perhaps the next stage is to obtain an extra AC600 and/or AC1200 and run the test again.

I’m also going to try measuring the current draw of these devices to see if the power consumption tallies with the 100mW permitted radiated power they are allowed.

Another possibility is to change the CRDA domain.  There are examples of people reporting that using BO allows for increased transmission power.  Obviously, do this may be breaking some rules in your country, unless you live in Bolivia.