Raspberry PI 3 B+ as an Access point/bridge on a local wireless network

A Raspberry PI 3 B+ based setup is expected here. This is detailed in a previous blog.

O. Create a PI based Network Access point using static host (pi@navx.local)

Major reference that describes how to create a DHCP server based WiFi bridge is available here, http://ardupilot.org/dev/docs/making-a-mavlink-wifi-bridge-using-the-raspberry-pi.html


Hostname & Setup: Two Raspberry Pi’s. One is the access point and other connects to it for communicating over Wireless LAN.

navx.local -> pi@ 
-> This Raspberry PI is the WiFi access-point/hotspot host

nava.local -> pi@ 
-> This Raspberry PI is configured to connect to the above access-point

A. Setup or configure WiFi SSID on Raspberry (pi@nava.local)

Link: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Connect the raspberry Pi to the WiFi access point. Edit the wpa_supplicant file with the new SSID and Password.

Alternately you can use raspi-config

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
sudo ifdown wlan0
sudo ifup wlan0

B. Change the hostname using raspi-config or using /etc/hosts & /etc/hostname file  (pi@nava.local & pi@navx.local)

Install avahi with the following commands on all the Raspberry Pi’s: https://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/

sudo apt-get install avahi-daemon
# Update boot startup for avahi-daemon
sudo insserv avahi-daemon
sudo update-rc.d avahi-daemon defaults

Install Bonjour on windows for access, discovery and then configure IPv6 on raspberry PI’s

# Enable IPv6 on RPi 
sudo modprobe ipv6

Add ip6 entry on a new line in /etc/modules file

# Apply the new configuration with:
sudo /etc/init.d/avahi-daemon restart

Raspberry PI’s should now be addressable from other machines as navx.local,

ssh pi@navx.local
ssh pi@nava.local


C. Stop the static IP and connect back to WiFi on wlan0 (pi@navx.local)

In case you are connected to another WiFi with internet access before moving to this configuration. A quick way to connect back to that WiFi is below.

Disable, stop DHCP server and reboot

sudo update-rc.d hostapd disable
sudo update-rc.d isc-dhcp-server disable
sudo service hostapd stop
sudo service isc-dhcp-server stop

Move the previous network config to the current setup

cp /etc/network/interfaces.backup /etc/network/interfaces

Revert the interfaces file on Rpi rasbian by copying the content of backup to the interfaces. The backed up content is shown below.

(cv3) pi@navx:~ $ cat interface.dyninternet.backup
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug intwifi0
iface intwifi0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

D. Start the static IP configured DHCP server for the access point (pi@navx.local)

Start the DHCP server and enable the service

sudo service hostapd start
sudo service isc-dhcp-server start

sudo update-rc.d hostapd enable
sudo update-rc.d isc-dhcp-server enable

sudo reboot

Scan the wlan0 for SSID “NavxStation

sudo iwlist wlan0 scanning essid NavxStation

Connect from the raspberry (pi@nava.local) as described in section A


E. Provide fixed IP address on the host dhcp server (pi@navx.local)


The “HWaddr” or “ether” value is the MAC address. In this example say “c7:35:ce:fd:8e:a1

ifconfig wlan0

Edit the /etc/dhcp/dhcpd.conf file and add the following towards the end for fixed assignment.

host machine1_nava {
  hardware ethernet XX:XX:XX:XX:XX:XX;

Check the currently leased connections

cat /var/lib/dhcp/dhcpd.leases

Also, you can verify connected devices using

sudo iw dev wlan0 station dump 
sudo arp





Navio2 with Raspberry Pi 3 B+ for the Ardupilot flight controller setup

Load the Raspberry Pi Image provided by Emlid which has ROS and ardupilot pre-installed.

Controller Setup

Component/Part Name Documentation/Link Description
NAVIO2 Kit Ardupilot Navio2 Overview Sensor HAT for Pi
CanaKit Raspberry Pi 3 B+ Pi & Navio2 Setup Compute for flight
DJI F330 Flamewheel (or similar ARF Kit) Copter Assembly guide Frames, Motors, ESCs, Propellers
Radio Controller (Transmitter) Review of the RC products RC Transmitter
ELP USB FHD01M-L36 Camera ELP USB Webcam 2MP



(cv2) pi@nava:~/workspace/cnaviz/imcol $ ps -eaf | grep ardu
root 1909 1 0 16:36 ? 00:00:00 /bin/sh -c /usr/bin/arducopter $TELEM1 $TELEM2
root 1910 1909 15 16:36 ? 00:15:48 /usr/bin/arducopter -A udp:


Setup a Python 2 environment and clone Navio 2 repository

sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev
mkvirtualenv cv2 -p python2
pip install smbus-cffi
git clone https://github.com/emlid/Navio2.git
cd Navio2
Run tests
(cv2) pi@nava:~/Navio2/Python $ emlidtool test
2018-08-20 19:03:23 nava root[2337] INFO mpu9250: Passed
2018-08-20 19:03:23 nava root[2337] INFO adc: Passed
2018-08-20 19:03:23 nava root[2337] INFO rcio_status_alive: Passed
2018-08-20 19:03:23 nava root[2337] INFO lsm9ds1: Passed
2018-08-20 19:03:23 nava root[2337] INFO gps: Passed
2018-08-20 19:03:23 nava root[2337] INFO ms5611: Passed
2018-08-20 19:03:23 nava root[2337] INFO pwm: Passed
2018-08-20 19:03:23 nava root[2337] INFO rcio_firmware: Passed
Ardupilot should be stopped while running the Navio2 tests
sudo systemctl stop arducopter
(cv2) pi@nava:~/Navio2/Python $ python Barometer.py
Temperature(C): 39.384754 Pressure(millibar): 1010.329778
Temperature(C): 39.333014 Pressure(millibar): 1010.368464
(cv2) pi@nava:~/Navio2/Python $ python AccelGyroMag.py -i mpu
Selected: MPU9250
Connection established: True
Acc: -2.442 +9.428 +0.958 Gyr: -0.030 +0.011 -0.010 Mag: -3489.829 +30.680 +0.000
Acc: -2.504 +9.596 +1.063 Gyr: -0.023 +0.004 -0.012 Mag: -55.946 +6.677 +31.255
Acc: -2.346 +9.495 +0.924 Gyr: -0.023 +0.007 -0.007 Mag: -57.394 +5.955 +31.255
Acc: -2.370 +9.567 +1.020 Gyr: -0.030 +0.006 -0.014 Mag: -55.765 +6.497 +30.731
(cv2) pi@nava:~/Navio2/Python $ python GPS.py
Longitude=0 Latitude=0 height=0 hMSL=-17000 hAcc=4294967295 vAcc=4082849024
Longitude=0 Latitude=0 height=0 hMSL=-17000 hAcc=4294967295 vAcc=4083043328
(cv2) pi@nava:~/Navio2/Python $ python ADC.py
A0: 5.0100V A1: 0.0440V A2: 0.0160V A3: 0.0160V A4: 0.0180V A5: 0.0220V
A0: 5.0370V A1: 0.0440V A2: 0.0180V A3: 0.0140V A4: 0.0160V A5: 0.0240V
A0: 5.0370V A1: 0.0440V A2: 0.0160V A3: 0.0140V A4: 0.0160V A5: 0.0240V
(cv2) pi@nava:~/Navio2/Python $ sudo python LED.py
LED is yellow
LED is green
LED is cyan
LED is blue
LED is magenta
LED is red
LED is yellow
LED is green
LED is cyan