Emlid

Navio2 in the Raspberry Pi Foundation Weekly


#1

Hello guys!

Just to let you know that my Navio 2 project was selected in the guardian’s favourite projects for 2016.
I am part of an article which was again selected to be published in the weekly raspberry pi foundation weekly newsletter
You can have a check on https://www.raspberrypi.org/weekly/desktop/
And as well on https://www.theguardian.com/technology/2016/dec/22/quadcopters-to-alzheimers-solutions-readers-best-raspberry-pi-projects
And as well selected in the TOP5 coolest RPi 3 projects for 2016 by raspberry pi france: http://www.raspberrypi-france.fr/5-projets-raspberry-pi-3-plus-cools-de-2016/

You will find with no doubt the RPi fishing quadcopter :slight_smile:

I explicitly mention Navio2 in the project description, thanks for your excellent support on this forum (special note to George for my dummy questions ;-))

Guillaume


#2

Here some picture of my fishing drone project!
Thanks to the EMLID community for the great help in setting it
I am now currently trying to optimise the wifi range and the weight to get a better autonomy

It is a waterproof quadcopter that can land over water
It has a built-in line drop system working with a servo
It has a home made gimbal based on Storm32 BCG
This design is fully 3D printed
I take pictures and change video streaming quality through RC switch

I would be VERY interested in knowing the best hardware set-up for improving Wifi quality and range.
I am using an Alfa AWUS051NHv2 on the quad and relying on the built-in antenna of my android device on the GCS. I get 650m and video lag can be improved :slight_smile:


(Marcello) #3

Sorry, but wouldn’t the obvious answer be that using an external antenna on the GCS, and a external wireless adapter (higher power) for that matter will significantly increase link range and quality.

In terms of latency search around for what others have used for low latency gstreamer options, there are a lot of test out there. Also, if you need help increasing latency or improving latency you need to give your settings. I don’t know what you are using but for example configuration settings , for hostapd and network interfaces; As well as, your current latency and hardware specifics for example how you are powering your Alfa, is it receiving enough power? Also looking at other things such as maybe increasing your Alfa’s output power in the kernel.

You leave too much information out. Could you also give some insight into your homemade gimbal like what motors you used, etc.


#4

Thanks for your feedback Marcello
I have maybe wrongly eliminated the option of external antenna on GCS due to the fact I bet on android device which doesn’t seem to accept external wifi device (no drivers).
I don’t have access to my hostapd conf file right now but I will post it after Jan 1st for your review.

Therefore I know think about the following set-up for an improved range/quality:

  • RC channels through 433 Mhz telemetry + joystick connected to Android device
  • RPi doing RX on 2.4 GHz wifibroadcast (more range than 5 GHz and no lag when quality becomes poorer due to lost packets) + local AP for video streaming back using conventional wifi on Android device --> would be more convenient to have Wifibroadcast working on Android :thumbsdown:

The backup solution to get rid of the Android device would be to use QGroundControl directly from the RPi but there I am still struggling to compile it on raspbian (cannot find the proper version of the QT compiler… if anybody knows how to do… it would be much more than a great solution)

@staroselskiy : is the stable release of EMLID image incorporating wifibroadcast still planned in January?

Guillaume


(Marcello) #5

No Problem! I definitely agree with the 433mhz telemetry. I also agree 2.4ghz does generally perform better because of better penetration or range.

Wifibroadcast is definitely useful thought I personally don’t use it since it gets rid of the possibility to access the shell or any other data I may want to send between the pi. Though that is your choice wether you choose to use hostapd or wifibroadcast. Generally, it seems your choice will not affect lag or range (if hostapd is properly implemented)

The main difference is with wifibroadcast you get a more reliable video feed. So Wifibroadcast definitely comes out stronger as when your in situations where reliability is needed it definitely keeps up with less lag in rough environments. Though again it has its downsides.

Be careful about QGroundControl as well, it uses mavlink_control or something like that instead of rc_override which APM Planner 2.0 and Mission Planner both use, I’m not even sure if the Navio supports mavlink_control. I have also found QGroundControl to be slower and less reliable than APM Planner.


(Marcello) #6

Also,

Have you checked something like this out?
http://www.wirelesshack.org/wireless-pen-testing-with-a-android-using-a-wireless-usb-adapter.html


#7

Very valuable input !
I indeed thought Wifibroadcast brings more range due to the possibility to add “diversity” antennas (just like CSL-300 dongle equipped with 2 antennas) and no need for high power TX on the GCS side
Wifibroadcast is definitively more complex to implement on the field therefore I will think about keeping a conventional 2.4 Ghz wifi link for both control and telemetry, just to check range possibilities. I would save as well some precious weight on the drone as no 433 Mhz telemetry would be needed in such case.

Concerning the lag issue, I indeed have very low latency unless I go around 200 to 300meters away from GCS where I get some stalled images which is probably due to the degraded wifi link quality

I could finally get a copy of my hostapd.conf file, here are the details:
ctrl_interface=/var/run/hostapd
driver=nl80211
country_code=AS #code AS allows 24dB on Canal 40
ieee80211n=1
ieee80211d=1
ieee80211ac=1
ctrl_interface_group=0
beacon_int=100
interface=wlan1
ssid=Gabian
hw_mode=a
channel=40
auth_algs=1
wmm_enabled=1
eap_reauth_period=360000000
macaddr_acl=0
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

–> I still don’t really know about the following items for improved range:

  • does my wifi modem ALFA receive enough power from the RPi?
  • what is the effect of using ieee80211n and ac modes on range?
  • would HT_CAPA parameter bring more range thanks to a larger authorized bandwidth?

Here is a copy of my network/interface file:
source-directory /etc/network/interfaces.d

allow-hotplug lo
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant

iface default inet dhcp

allow-hotplug wlan1
iface wlan1 inet static
address 192.168.200.1
netmask 255.255.255.0
network 192.168.200.0
broadcast 192.168.200.255

allow-hotplug eth0
iface eth0 inet manual

up iptables-restore < /etc/iptables.ipv4.nat

Thanks for the advices


(Marcello) #8

Thank you for the files, I will definitely look into them and get back to you. Allow me to ask a couple more questions while I’m at it so I can get a bit of a better idea as how to guide you.

You are using the Alfa AWUS051NHv2 correct?

Im assuming you are currently running your hostapd on 5ghz since it is on channel 40? On 2.4ghz generally the channels are only 1-11, 12, or 13 depending on where you live.

So you are planning on switching to 2.4ghz correct, and not using the 5ghz?

Are you running disc-dhcp-server or dnsmasq or something else?

Do you know your wireless cards max output power? I see that the V1 of your card seems to be 500mw but I am having trouble finding data on the V2, I would assume they would be the same?

I do see that 80211ac is enabled, though it seems your wireless card does not support 80211ac. Good news is there are definitely a few improvements you can make, I just want to check against mine and refresh my memory real quick.

There are a few settings more advanced improvements I am working to figure out myself. So I can definitely update you on that. I am actually planning on making a blog about this, so this may be a little extra motivation to get that done :slight_smile:

Sorry I haven’t really gotten any of your questions answered, I’m just trying to figure everything out. So then I can help you out and give you the information in the way that makes the most sense, because it’s a lot of information to take in, haha!


#9

You are using the Alfa AWUS051NHv2 correct?
Im assuming you are currently running your hostapd on 5ghz since it is on channel 40?

Yes and yes

So you are planning on switching to 2.4ghz correct, and not using the 5ghz?

Yes, if I can manage to get full joystick control through 433MHz link, I will get rid of my 2.4GHz RC. But if not, I will use wifibroadcast on 5 GHz

Are you running disc-dhcp-server or dnsmasq or something else?

Yes, running dnsmasq to get stable IP allocation for my GCS

Do you know your wireless cards max output power? I see that the V1 of your card seems to be 500mw but I am having trouble finding data on the V2, I would assume they would be the same?

Not sure what output power is possible, but my 2.4GHz alfwifi card therotically allows up to 2000mW

Thanks for the improvement tips, would be as well interested in your blog :slight_smile:


(Marcello) #10

Okay, I apologize for not being able to get back to you sooner but I have some good information for you now.

Hostapd:

Because you are running on 5ghz, you should check if “ieee80211h=1” is required in your country. This command enables DFS and radar detection to avoid interference with radar systems. If you are unsure you should add it to be safe. If you switch to 2.4ghz you no longer need this, it is only for the 5ghz band. (It appears this may not work with all drivers, so if you find this to crash your hostapd just ignore it.

I also recommend you set “ieee80211w=” to either 1 or 2. When this is enabled it prevents someone else from using a deauthenticating attack your connection (disconnecting you) from your AP. Deauthentication is a known method to use by hackers to cause a MITM attack. More importantly, if someone was playing with you it could result in possible crashing (loss of control or video) or them taking over your drone in an extreme case.

For good practice also use “wpa_pairwise=CCMP TKIP” this will try to use AES (much stronger) instead, but will revert to TKIP if there is a compatibility issue. Otherwise, your rsn and wpa look properly configured for AES which is much more secure and supposedly gives better network performance and speed.

“ieee80211n” should remain as it will help you achieve higher range. This may seem contradictory as usually lower bandwidth results in shorter range and you will find that most forums will agree with this general concept. However, 802.11n does much more than increase bandwidth which should theoretically improve performance. It even includes MIMO (diversity) which definitely helps range, although unfortunately in your case your wireless adapter does not have diversity.

You should get rid of “ieee80211ac=1” as it is not supported by your wireless card anyways. In theory, if you were continuing to use 5ghz and your card supported AC wifi, you should enable this for similar reasons as above. In fact AC supports a new kind of MIMO which slightly increases performance in that field of things. Do note that AC does require modification to achieve range though as it is very high bandwidth and low range by default. I am simply stating that when properly modified it could increase performance.

“HT-Capa” would increase your range. This is the modification that can be used on 802.11n and especially 802.11AC as I mentioned to increase range. However, you actually want to use this to decrease range. While wireless n and ac add many features as I said above they also increase the width of the network channel. For instance 802.11n increases the channel from the standard 20mhz to 40mhz. In doing this it increases the bandwidth but decreases the range of where the radio power is concentrated (therefor decreasing range).

It appears by default this is enabled: “ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]” though it is unclear and it now appears it may automatically be set to only 20mhz. In either case for good practice set “ht_capab=[SHORT-GI-20]” this should give you the most range. Allowing you the higher range of wireless a/g while allowing you all the improved features (security, latency, etc.) of wireless n.

There are likely many more modifications you can make under the hostapd wireless n settings though you would have to google and experiment. I myself will be looking into this more as I work on my blog site. Currently, don’t have time to do everything as I can only really focus on one thing at a time, and that is getting my website up :slight_smile:

Wireless card output power. As I said before do to lack of any other info I will assume your cards max power is 500mw.

I have no clue what the regulations are in Australia and would help but I cannot find any solid info. In any case you must realize that you need to check the maximum allowed power in your transmitting channel for your country.

First type “ifconfig” and check to ensure that your wireless card (I assume wlan1 is your AP) reports “Power Management:off”. If it does not adding this line below (wlan1) in your network interfaces should disable power management “wireless-power off”. Which will definitely improve performance regardless of changing power.

Also search for “tx-power” by default this is usually 20dbm.

The command “iwlist” should give you the supported frequencies and power limits based on your hardware and regulations. In any case these should get 500mw working for you (if it is allowed by your country regulation, otherwise it will not work)

ifconfig wlan1 down
iw reg set AS
ifconfig wlan1 up
iwconfig wlan1 txpower 27

and check ifconfig again to see if the tx-power successfully increased. Also, the following should give you a more modest 200mw. But still two times the default output power of 100mw.

ifconfig wlan1 down
iw reg set AS
ifconfig wlan1 up
iwconfig wlan1 txpower 23

If you get any instabilities (should not occur below 1w) Increase the usb hub power from .6A to 1.2A by adding
"max_usb_current=1" here “sudo nano /boot/config.txt” This should be safe for the RPi as it is usually only disabled by default incase your power supply cannot handle the extra power. The power module is able to supply up to 2.5A I believe, maybe higher which is more then enough. I believe the RPi itself does not support above 2A or 2.4A or something.

Finally, may I ask why your “eap_reauth_period=360000000” is set to high?


(Marcello) #11

Let me know if this works for you and if you need any other help, id be happy too. I too will also work on experimenting with more settings like I said for my blog website as well as for my own quadcopter. Of course, I will have more time to experiment after I get the actual website up and running at which point I can experiment and will publish my findings there, so feel free to check it out when its up. I will give you the link of course! :slight_smile: Also, when you figure out wether your keeping 5ghz or 2.4ghz let me know and I can maybe recommend you to a wireless adapter that supports MIMO (diversity) and such for better performance if your interested. You could then maybe use your alpha wireless adapter on your android to get the ultimate range!

If you get time let me know if something like this works for you? As I said above you could then use a MIMO adapter on the quad with the alpha on your android, or even on another RPi for GCS as you put on the diagram above, which then forwards to your Android.

http://www.wirelesshack.org/wireless-pen-testing-with-a-android-using-a-wireless-usb-adapter.html

For my own reference I was curious in making a gimbal, could you give some more insight into how you made your gimbal, what you used, maybe some pictures? Thanks!