Extract
Up to now I have been using an Edimax EW-7812UAn V2 USB WiFi Dongle. This has been very reliable and reasonably simple to install and configure. The only problem is that it operates on the 2.4 GHz frequency band, which means it will interfere with the majority of modern radio control systems. Up to now I have been using a 35 MHz RC system which was fine as long as I was flying on my own. However, I’d like to fly with others who will be using 2.4 GHz systems.
There are now a number of Dual Band Wifi Dongles that operate in the 5 GHz band as well as at 2.4 GHz. This provides a solution so long as they work with the Raspberry Pi. A couple of candidates were obtained, configured and tested on my Model B Raspberry Pi. For an extra comparison I also ran a test over the wired LAN interface.
The results were interesting in that there was no clear winner in the speed stakes, there was however a clear loser. What is clear is that useable 5 Ghz WiFi is possible but for now it’s not plug and play.
Setup
For these tests I used the following network devices.
- Raspberry Pi Model B Ethernet (100 Mbit/s)
- Tenga W522U Dual Band (2.4 GHz & 5 GHz)
- Edimax EW-7612UAn V2 (2.4 GHz)
- Edimax AC600 Dual Band (2.4 GHz & 5 GHz)
I setup my Model B, with the latest release of Raspbian (2015-01-31) and the current scripts.
5 GHz WiFi Prerequisites
To get 5GHz WiFi working you need to install the Central Regulatory Domain Agent (crda). Basically, the 5 GHz band is more tightly regulated worldwide and you need to specify your regulatory domain so that hostapd knows which channels are available.
To install the necessary packages use:
sudo apt-get install hostapd crda iw
Then edit /etc/default/crda and set the REGDOMAIN variable to match your region. Examples are US, JP, EU and in my case UK.
Devices
The amount of work needed to setup networking varied by device. I’m not going to give a detailed description of configuring each device. I’ll do that in separate posts.
1. LAN
This simply required plugging the Pi and the Laptop into a switch and running ipconfig on the receiving device to get its IP address. This was then used in remote.conf to direct the UDP stream.
2. Tenga W522U
The W522U is nl80211 compatible. This means it works with a standard install of hostapd. No special configuration is needed.
3. Edimax EW-7612UAn V2 (2.4 GHz)
The EW-7612UAn V2 uses the RTL8191SU chipset. The kernel supports this chipset for client networking, but not for AP mode. However, Realtek provide a custom version of hostapd that needs to be downloaded, compiled and installed which does work.
4. Edimax AC600 Dual Band (2.4 GHz & 5 GHz)
The AC600 is not supported by the latest kernel. All is not lost, it just takes a little more work. You need to download the kernel source code and the code for a Realtek 8812U driver. Then you need to install the latest version of GCC from the Jessie repository. This lets you build the kernel module. Finally you need the same hostapd build as for the Edimax EW-7612UAn V2 device.
Hostapd Configuration
There are four combinations of hostapd.conf depending on the driver and band. I’ve set them out in the table below.
Hostapd Version | 2.4 GHz | 5 GHz |
---|---|---|
nl80211 |
interface=wlan0 driver=nl80211 ssid=Pi_AP hw_mode=g channel=13 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=Raspberry wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP |
interface=wlan0 driver=nl80211 ssid=Pi_AP hw_mode=a channel=44 ht_capab=[HT40+] ieee80211n=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=Raspberry wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP |
Realtek |
interface=wlan0 driver=rtl871xdrv ctrl_interface=/var/run/hostapd ssid=Pi_AP channel=13 beacon_int=100 hw_mode=g ieee80211n=1 wme_enabled=1 wpa=2 wpa_passphrase=Raspberry wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP max_num_sta=8 wpa_group_rekey=86400 |
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 |
Procedure
These tests were a straight comparison between the four devices using the same settings and the same testing methodology as previously. The resolution was 1280 x 720 pixels with a 6Mbps bit rate.
Results
The table below shows the resulting latency by device.
Device | Latency |
---|---|
Edimax EW-7612UAn V2 – 2.4 Ghz | 132 ms |
Tenga W522U – 2.4 GHz & 5 GHz | > 10 s |
Edimax AC600 – 2.4 GHz | 122 ms |
Edimax AC600 – 5 GHz | 126 ms |
LAN | 124 ms |
Here they are as a graph.
Analysis
The big surprise is how bad the Tenga W522U adapter was. The latency was not just two or three times higher, it was two order of magnitudes higher. There are a number of threads on various forums where other people have found similar issues, although not to this extent, but then they are probably not swamping the feed with a continuous video stream. Whether this is just a compatibility issue with the Pi remains to be seen.
The Edimax AC600 was 10 ms faster than the previously used Edimax 7612UAn V2 at 2.4 GHz. At 5GHz it was still faster, but only by 6ms. Interestingly, the LAN connection was not any faster than the AC600. On the Pi the LAN connection is 100 MBit/s as is the USB bus, so although the AC600 is theoretically capable of 433 Mbit/s it is never going to manage more than 100.
Conclusion
What we can take away from this test is that there is a limit to how much the latency can be reduced by changing the WiFi adapter. It is a shame that to get a 5 GHz WiFi link requires a lot of compiling and configuration. Hopefully this will improve with time. For now we have another small reduction in the video latency to add to the current optimisations.
Adendum
Just as these tests were being done, the new Raspberry Pi 2 was released promising a x1.5 to x6 speed increase. As I had used the latest release of Raspbian, I swapped the microSD card from from the Model B to the Model 2B. What I found was that the Edimax AC600 was no longer detected and I couldn’t find a way to compile the module so that it would. So that’s my next task. I may run a quick comparison of the B versus the 2B with the Edimax 7612UAn V2 to see how much improvement the new processor has made.
Hello,
I am very interested in your tests regarding the Raspberry Pi 2.
The wifi you did test are very different from these who the M5 ?
http://www.msdist.co.uk/product_Rocket_M5.php
I wonder what camera we could use for lowriding wifi HDFPV, as the usual analog camera has WDR that deals with light/dark very well… I have no experience with GoPro, will it handle that part well ?
So basically we need to decrease latency by :
1. using a more powerful bord for enconding
2. same for decoding in ground station
3. having a reliable and quick video link
For 1 and 2, what about using another codec ?
Sorry, a strange mistake in my second sentance :
“The wifi you did test are very different from this M5 ?”
The Ubiquiti Rocket M5 could be used ground side to improve the range. I don’t expect it would improve the latency much as it would add another stage to the stream.
At the moment my ground station is an Intel i7 quad core laptop, so I don’t think there is much to be gained there either.
I’ve run some tests on the Pi2-B now and will get them posted soon. So far the results are not showing any great improvement over the first generation hardware in this application. I think the problem is bandwidth through the whole pipeline: camera -> gstreamer -> usb -> Wifi -> gstreamer -> display, with the camera and usb being the biggest bottlenecks.
Using a different codec and stream protocol might be the answer. When I get time there are a couple I want to try.
Thank you for your quick and clear answer.
This work is a very challenging one !
What about using another plateform than RP2 for onboard transmitter ?
LIke http://elinux.org/Minnowboard:MinnowBoard or even a minipc board directly ? The main advantage could be integrated GPU for encoding, and using HDMI in place of USB.
But I dont know if the weight / power ratio is any better….
I have thought about other platforms. The Pi currently has a low cost of entry in both money and time and raspivid program does use the Pi’s built in hardware encoding. The challenge is to see how low we can get the latency for the current platform.
1. Would using UDP change anything with latency ?
2. About codecs, I red this on forum last year :
http://www.rcgroups.com/forums/showthread.php?t=1507916&page=20#post27957704
I don’t know if there are any udates now.
1. I am currently using UDP in my testing.
2. Using a non-mpeg codec would mean loosing hardware encoding. Thanks for the link to the thread. I’ll have a read through when I have a moment.
May be you know this other thread related to the same subject :
http://www.rcgroups.com/forums/showthread.php?t=2281169
It is the english part of a very brainstorming german thread (if you understand german) :
http://fpv-community.de/showthread.php?46646-Low-Cost-HD-Video-%DCbertragung-Telemetrie
I’ll try running it through Google translate. I have tried to learn German in the past, but I have no ability with Languages.
Vocabulary is hard especially with german 🙂
Not my mothertongue as well, but I can catch the general idea. But beware : this is a 1000 posts thread !
Hi,
I don’t know if you saw that project on kickstarter, may be could have some utility in the future :
Currently, when airborne I power my Pi from a 3A BEC connected to the flight battery balance connector.
The same way I flight analog FPV. I am glad to know this part will not change 😉