Community Forum

[How To] Navio2 Raspberry Pi 3 Access Point

(David) #1

In this post I want to share with you how to set up an access point on the raspberry pi so you can connect to it from your PC Tablet or phone and run ground control, using the Beta v4 image with ROS and Wi-Fi Broadcast support for Navio boards

To obtain a fully working Access Point (AP) you need to configure four aspects of Raspbian: network interfaces to isolate the usb dongle and manage separately, hostapd, the module that manages the host access point, dnsmasq a very lightweight module for assigning IP addresses using DHCP, and Raspbian’s routing tables.

The need for a USB WiFi Dongle: In my experience, the on-board RPi3 wifi module has a range of about 20 to 30 meters, and for a UAV that will go away for a lot more than that, it is very problematic. A high gain wifi dongle is much better, and while still limited, it’s a very good plug and play option (a popular option for longer range telemetry and control include 433MHz modems, but that’s out of scope here). I recommend that you check that the usb wifi dongle has AP capabilities, has a Raspbian driver, and either conforms to the nl80211 generic wireless driver, or has a hostapd that can be compiled for it. I found many posts where people give up and focus on a specific REALTEK hostapd implementation, but there is no need for that. In fact, my TP-Link WN722N worked plug and play with the EMLID image.

First Backup all the files we will touch:

sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.ORIG
sudo cp /etc/network/interfaces /etc/network/interfaces.ORIG
sudo cp /etc/default/hostapd /etc/default/hostapd.ORIG
sudo cp /etc/sysctl.conf /etc/sysctl.conf.ORIG
sudo cp /etc/rc.local /etc/rc.local.ORIG
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.ORIG
sudo sh -c “iptables-save > /etc/iptables.ipv4.nat.ORIG”

If you need to RESTORE your OS:

sudo cp /etc/dhcpcd.conf.ORIG /etc/dhcpcd.conf
sudo cp /etc/network/interfaces.ORIG /etc/network/interfaces
sudo cp /etc/default/hostapd.ORIG /etc/default/hostapd
sudo cp /etc/sysctl.conf.ORIG /etc/sysctl.conf
sudo cp /etc/rc.local.ORIG /etc/rc.local
sudo cp /etc/dnsmasq.conf.ORIG /etc/dnsmasq.conf
iptables-restore < /etc/iptables.ipv4.nat.ORIG

To fully restore, you may also need to disable hostapd and dnsmasq, but that depends on what else you may be doing.

Taking a break, more to come very very soon