WiFi Telemetry

Yes it is possible to set-up a WiFi network and easily connect with a mobile application. I guess you’re hitting similar issues to me at the start and here is what I found:

Network Type
The documentation here on WiFi setup on Linux/RasPi stops short of the whole WPA2 security, which people want because WPA (v1) is totally unsecure and depreciated nowadays. WPA2 support is added to Linux with the “WPA Supplicant” component, already installed on the RasPI and Emlid images. Basically you will use special options in the wpa_supplicant.conf to enable the WiFi dongle as an ad-hoc access point, specifically a P2P network (also known as IBSS mode) where there is no master and nodes sharing the same network ID can randomly join and drop-out. I found many guides claiming they were describing a P2P connection which were just enabling the drone’s WiFi as an access point, so when searching for help quote IBSS mode to be specific.

Addressing
It follows that for this solution you also need to choose some static IP addresses as there cannot be any one device nominated as a DHCP server (because it would defeat the object of P2P and not be available when out of range). That’s a lot of configuration to maintain, so a better option is to setup broadcast then anyone with a (secure) connection to the network can start a GCS or MAVProxy and view/participate in communications. This is explained here:

The good thing with the broadcast solution is you can also use it for video streaming (see GStreamer setup documentation). Then you can pick-up the broadcast video as UDP anywhere on the network, a bit like traditional FPV radio where any FPV receiver on the same channel can view the transmission :smile:

I’m about to write all this up (keep saying that but time is limited sorry) but these snippets may help get you started:


  1. Open the network interface configuration file for editing.
    sudo nano /etc/network/interfaces
  2. Change the contents as shown below, substituting your chosen subnet and IP address for the device in place of “192.168.xxx.yyy”, e.g. “192.168.123.1”:
    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.xxx.yyy
netmask 255.255.255.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
3) Press CTRL+O then ENTER to save, followed by CTRL+X to exit.
4) Open the WPA Supplicant (WPA security extensions) configuration file for editing.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
5) Change the contents as shown below, substituting your chosen network SSID for “MySSID” and password for “My!Passw0rd”.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
ap_scan=1

network={
mode=1
ssid=“MySSID”
scan_ssid=1
psk=“My!Passw0rd”
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
auth_alg=OPEN
}
6) Press CTRL+O then ENTER to save, followed by CTRL+X to exit.
7) Start the network:
sudo ifdown wlan0
sudo ifup wlan0
8) You can ignore these error messages:
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
9) Check the configuration.
iwconfig wlan0
10) Reboot to make sure the connection is fully enabled.
sudo reboot
11) Optional: Test connection to the drone from another device on the same P2P wireless network, e.g. SSH shell connection.


Note the use of network “mode=1”, which is the IBSS/P2P mode! I’ve read that not all WiFi dongles support IBSS mode. I know at least the Realtek based devices (like the cheap Edimax dongles already supported by RasPi standard image) do work.

As for range and speed testing, I’ve bought a couple of different dongles and plan to do a full test to complete my article. There are some other comments here, so to be safe plan for a bit of lag over WiFi and hence for fast flying always a traditional RC transmitter/receiver. For telemetry of a FPV racing drone this should be fine, for long range/glider stuff search here for more information about solutions people have built with long range WiFi systems, e.g. Ubiquiti Rocket M5. But that’s overkill (a lot of expense and too much weight) for a FPV racer/250 class if you just want some fun.

4 Likes