piNet

At some point in the not too distant future, I’m going to need a much longer range WiFi connectivity between my piPAD and piDrones so that I can test the GPS tracking in the local field where the piDrone and piPad may be separated beyond the range of the current direct WiFi signal.  This is a problem because I need connectivity even though the piDrones are autonomous as I always need to be able to press the remote kill switch.

I considered for a second or two hunting down a longer range radio system, but then wondered whether this is doable by using multiple Zero-W’s instead: the concept of piNet was born.

The idea is that these Zero-W’s are all in their own private network (piNet) using their inbuilt WiFi.  The Zero-Ws are phone charger battery-bank powered, and are scattered  around the test field.  Each Zero-W also has a USB WiFi dongle configured to connect to the piDrone WAP network.  The piNet and iDrone networks are bridged together.  My piPad is also in the piDrone and piNet networks.  That means I should be able to access the piDrone network via piNet even if the piDrone is outside of the range of the piPad WiFi: I should be able to remote login to the iDrone from my piPad via piNet.

This feels like it could work with the piDrone clients bridged to the piNet, but there’s lots of details I have no idea about.  More thinking to do.

Precise, concise installation instructions

I ended up doing a complete reinstall from scratch to upgrade Zoe to my new Pi-Zero-W, so here’s my latest set of installation instructions.  I recommend printing these off so you can refer to them easily as you do the installation.

These work for any version of Raspberry Pi running the latest Raspian Jessie Lite.

I can confirm that the Pi-Zero-W inbuilt WiFi does support WAP / soft-AP.

Annoyingly, I messed up soldering the GPIO connection onto the Pi-Zero-W, so I have another one on the way.

Who broke my WAP?

In the previous post, I’d reported that a single hostpad now worked with both the RealTek and Broadcom drivers.  I’m sure I tested this otherwise I wouldn’t have said it, yet one day later, my WAP stopped working with both WiFi dongles; my iPad can not longer connect to Zoe.  Layer 2 MAC connection are working fine with either WiFi dongle, but Layer 3 IP connections no longer connect.  Until I’ve resolved this, all testing of the camera motion has stalled.

As a result blogging is likely to stall for a while, rather than me blogging frustrated swearing online!

White WAP

All that’s required to get Zoe running on a post May 2016 kernel is to disable the new method of configuring interfaces:

sudo apt-get remove dhcpd5
sudo apt-get remove raspberrypi-net-modes

The just follow the standard instructions being careful about which driver you point hostapd at for your WiFi adapter.

‘m not going to give full instructions for how I switched Zoe’s WAP on as they are mostly unchanged from last time.

Only two minor changes were required:

  1. In /etc/network/interfaces, comment out the section related to wlan0.
  2. In /etc/dhcpcd.conf add
    interface wlan0
    static ip_address=192.168.42.1/24
    static routers=192.168.42.1
    static domain_name_servers=192.168.42.1

With this, I could connect to Zoe from my iPad – the iPad was assigned an IP address in the range configured in udhcpd.conf so I took her outside for a flight.  It was rather jittery compared to how she flew prior to the move to Jessie lite so I have some investigation to do there, but I don’t think it can be WAP related.

One oddity that remains, and that’s gating me on investigating the above is that although the iPad connects perfect, neither my PC nor my main Raspberry Pi connect – the WiFi connection is fine, but (I think) no IP address is assigned by udhcpd, which means extracting diagnostics is hard to download.  More digging required.


Further investigation reveals that the iPad is working because it has a static IP address configured for accessing Zoe; The PC and other Raspberry Pi don’t work because the DHCP server (udhcpd) is not running when it should be. I have no idea why, so for the moment, I’ve reverted Zoe to the January release of Jessie. Very frustrating 🙁

Zoe the Zero – 4 – WAP

Normally, I’d turn on the wireless access point last of all as it removes access to the internet and therefore access to software updates.  But having proven the Quadcopter code runs fine now, its another step I can take pending the arrival of the new PCB.

But first, there’s one more app to install to allow file transfer between the Quadcopter and other computers in the wap network.

sudo apt-get install ftp

WAP relies on installation of the host access point daemon, hostapd.  The official Raspberry Pi WiFi dongle uses the Broadcom  BCM43143 chipset which is supported by hostapd in the Raspian Jessie distribution.  Many other WiFi dongles, especially those from EDUP, Edimax, TP-Link and most other far-eastern brands use RealTek RTL8188CUS chipset.  This is not supported by the default hostapd, so you need to download their enhanced version of the hostapd source code from here and compile it.

Assuming you have a dongle that does not require a revised hostpad, the first step is to install the software

sudo apt-get install hostapd udhcpd

Configure hostapd by creating /etc/hostapd/hostapd.conf “sudo vi /etc/hostapd/hostapd.conf” and add the following, choosing the RealTek driver rtl187xdrv if your dongle uses the RealTek chipset:

interface=wlan0
#driver=rtl871xdrv
drive=nl80211
ssid=MyWAPSSID
channel=1
wmm_enabled=0
wpa=1
wpa_passphrase=MyWAPPassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

Now to configure the WAP static IP address – “sudo vi /etc/network/interfaces”, adding the static IP address for wlan0 and commenting out anythign related to the dynamic address.

iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
#allow-hotplug wlan0
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

We next need to configure dhcp for the clients accessing the network to  provide their IP addresses – edit /etc/udhcpd.conf adding:

start 192.168.42.20 # This is the range of IPs that the hostspot will give to client devices.
end 192.168.42.254
interface wlan0 # The device uDHCP listens on.
remaining yes
opt domain local
# opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
opt subnet 255.255.255.0
opt router 192.168.42.1 # The Pi's IP address on wlan0 which we have set up.
opt lease 864000 # 10 day DHCP lease time in seconds

Note the dhcp address range starts at 192.168.42.20 allowing some space for static addresses 1 – 19.
In the same file, delete or comment out “#” any other lines as these are just example settings.

Enable dhcp by editing /etc/default/udhcpd thus to comment out the line

#DHCPD_ENABLED="no"

Add the dhcp leases file by typing

sudo touch /var/lib/misc/udhcpd.leases
sudo chmod 666 /var/lib/misc/udhcpd.leases

Enable hostapd by editing /etc/default/hostapd thus, adding

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Edit /etc/hostname to ensure the domain name is included – in my case, the domain is called local, and the hostname is wappi, so /etc/hosts reads

wappi.local

Next assign static IP address for the server in /etc/hosts

192.168.42.1 wappi wappi.local

Turn off the ifplugd (pluggable interface daemon) for the WiFi dongle as it seems to cause conflict between hostapd and udhcpd – edit /etc/default/ifplugd

# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION.  When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES=""
HOTPLUG_INTERFACES=""
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Finally (and I don’t know if this was necessary), update /etc/resolv.config to local domain name resolution rather than relying on an external DNS

domain local
search local
nameserver 192.168.1.254

Check, double check, and triple check that you’ve done all the above steps, and then finally

 sudo reboot

I’ve written a set of notes containing all the above which I find useful to have open on the screen while I’m configuring the WAP.

Jessie James

With the main installation completed, and run

sudo python ./qc.py --tc 1 -h 220

and seen the props spin, it seems all is well.

Finally step is to WAP her, which then isolates her from the internet and makes any further changes a bit of a faff.

I followed my own instructions to do this, with 2 minor changes:

  1. I’m still using the RealTek USB dongles, so I needed an updated hostapd; I got this from here, downloading to my B2, compiling, copying the revised hostapd to a USB stick, plugged it into Chloe and then replaced her default /usr/sbin/hostapd with this one.
  2. I also had some new problems as wpa-supplicant is no longer used.  I had to use the GUI app to configure all the information for wlan0 in there too – IP address (192.168.42.1), netmask 255.255.255.0, and everything else 192.168.42.1

With those two changes, I now have Chloe’s WAPping again, and once more she’s ready to fly, but this now with Jessie.

Unwapping presence

Phoebe did her job beautifully at the Cotswold Jam on Saturday, so I’m giving her a rest, and going to play a bit more with Chloe. First step is to get her on the internet and update her software, firmware and kernel hence I need to convert her back from being a wireless access point (WAP). Luckily, it’s not as complicated as making her a WAP was in the first place, but I’ve had a Post-It note floating around the office for months with the 7 simple steps. Before I accidentally throw the critical Post-It away, I’m blogging it for perpetuity.

These are the settings for WAP and the instructions what to do to regain internet access.

  1. /etc/default/ifplugd – swap the commented and uncommented lines for internet access
    INTERFACES=""
    HOTPLUG_INTERFACES=""
    
    # INTERFACES="all"
    # HOTPLUG_INTERFACES="auto"
  2. /etc/default/udhcpd – uncomment this line for internet access
    # DHCPD_ENABLED="no"
    
  3. /etc/default/hostapd – comment this line out for internet access
    DAEMON_CONF="/etc/hostapd/hostapd.conf"
    
  4. /etc/network/interfaces – swap the commented and uncommented lines
    # auto wlan0
    # allow-hotplug wlan0
    # iface wlan0 inet manual
    # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    
    iface wlan0 inet static
    address 192.168.42.1
    netmask 255.255.255.0
    
  5. /etc/resolve.conf – I use to swap domain from “home” to “local” here but it no longer seems necessay
  6. /etc/hosts – remove this line for internet access
    192.168.42.1	hog hog.local
    
  7. /etc/hostname – remove “.local” for internet access
    hog.local
    

But this time, after a

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get raspberrypi-net-mods

and undoing the above changes, WAP didn’t resume.  After digging around and swearing, it turned out I had to configure the static IP address for the WAP using the new GUI app as well as just in /etc/network/interfaces.  I need to find out where the GUI app has stored it.  But anyway Chloe’s up to date, and is now flying well, and showing the same increasing drift as Phoebe did as the battery charge reduces.  I do need to cough up for 4S batteries after the next pay day to see if they last longer.

BYOAQ-BAT VII: Networking

If you haven’t already, please read the previous BYOAQ-BAT articles first – just search for the BYOAQ-BAT tag.


HoG needs to be its own WAP to allow it to be controlled out of range of any domestic WiFi router.  I’ve left adding the WAP support until after all necessary software is installed; once HoG is a WAP, there is no internet access, and updating software requires backing out some of the WAP changes temporarily.

The information below is based on this link and this link and this link, but is customized to give exactly what HoG needs: a secure WLAN / VPN with no internet access using a statically configured fixed IP address.


WARNING: Depending on the USB WiFi dongle you are using, you may need to update the WAP software (hostapd).  More specifically, anything using RealTek drivers is likely to need these changes.  To find out whether you have such a dongle type

lsusb

and look for RealTek in the response.  If you are, I refer you to the Dave Conroy and Jens Segers links above.  I’ve used both, and both work well.

There is also the minor point that some WiFi dongles don’t even support hosting a WAP.  Be very careful when you are shopping that the description mentions WAP or soft-AP support.


Here are the steps I’ve taken from HoG’s console still connected via WiFi to the home network.

  • ping www.google.com just to be certain of your internet access
  • install WAP and DHCP software:
    sudo apt-get install hostapd udhcpd
  • Update the hostapd software if you are using a dongle with the Realtek chipset as per the links at the top
  • Configure hostapd by creating /etc/hostapd/hostapd.conf “sudo vi /etc/hostapd/hostapd.conf” and add the following:
    interface=wlan0
    driver=rtl871xdrv
    ssid=HoGWAP
    channel=1
    wmm_enabled=0
    wpa=1
    wpa_passphrase=HoG3.141592654
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP
    auth_algs=1
    macaddr_acl=0
  • Now to configure the WAP static IP address – “sudo vi /etc/network/interfaces”, replacing the existing entry for wlan0 with the following
  • auto wlan0
    iface wlan0 inet static
    address 192.168.42.1
    netmask 255.255.255.0
  •  In the same file, comment out (# at the start of the line) the following if present
    #allow-hotplug wlan0
    #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    #iface default inet dhcp
  • We next need to configure dhcp for the clients accessing the network to  provide their IP addresses – edit /etc/udhcpd.conf adding:
    start 192.168.42.2 # This is the range of IPs that the hostspot will give to client devices.
    end 192.168.42.20
    interface wlan0 # The device uDHCP listens on.
    remaining yes
    opt domain local
    # opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
    opt subnet 255.255.255.0
    opt router 192.168.11.1 # The Pi's IP address on wlan0 which we have set up.
    opt lease 864000 # 10 day DHCP lease time in seconds

    Note the dhcp address range starts at 192.168.42.20 allowing some space for static addresses 1 – 19.

  • In the same file, delete or comment out “#” any other lines as these are just example settings.
  • Enable dhcp by editing /etc/default/udhcpd thus to comment out the line
    #DHCPD_ENABLED="no"
  • Add the dhcp leases file by typing
    sudo touch /var/lib/misc/udhcpd.leases
    sudo chmod 666 /var/lib/misc/udhcpd.leases
  • Enable hostapd by editing /etc/default/hostapd thus, adding
    DAEMON_CONF="/etc/hostapd/hostapd.conf"
  • Edit /etc/hostname to ensure the domain name is included – in my case, the domain is called “local”, and the hostname is “hog”, so /etc/hosts reads
  • hog.local
  • Next assign static IP address for the server in /etc/hosts
    192.168.42.1 hog hog.local
  • Turn off the ifplugd (pluggable interface daemon) for the WiFi dongle as it seems to cause conflict between hostapd and udhcpd – edit /etc/default/ifplugd
    # This file may be changed either manually or by running dpkg-reconfigure.
    #
    # N.B.: dpkg-reconfigure deletes everything from this file except for
    # the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
    # SUSPEND_ACTION.  When run it uses the current values of those variables
    # as their default values, thus preserving the administrator's changes.
    #
    # This file is sourced by both the init script /etc/init.d/ifplugd and
    # the udev script /lib/udev/ifplugd.agent to give default values.
    # The init script starts ifplugd for all interfaces listed in
    # INTERFACES, and the udev script starts ifplugd for all interfaces
    # listed in HOTPLUG_INTERFACES. The special value all starts one
    # ifplugd for all interfaces being present.
    INTERFACES=""
    HOTPLUG_INTERFACES=""
    ARGS="-q -f -u0 -d10 -w -I"
    SUSPEND_ACTION="stop"
  • Finally (and I don’t know if this was necessary), update /etc/resolv.conf to local domain name resolution rather than relying on an external DNS
    domain local
    search local
    nameserver 192.168.1.254
  • Check, double check, and triple check that you’ve done all the above steps, and then finally
     sudo reboot

That’s it done for the WAP side, but because there’s not internet connection and so no DNS, you’ll need to configure your clients with the HoG static IP address so they have access to HoGWARTS (HoG Wireless Access Remote Terminal Server!)

Add the static IP address to /etc/hosts in your clients:

192.168.42.1       hog.local

That’s it, job done!


When later you wish to update the RPi software, you’ll need to add an ethernet interface.  First, get a USB to Ethernet dongle – I use one by Pluggable which worked out of the box.  Then you need to re-enable the interface pluggable daemon:

# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION.  When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES="all"
HOTPLUG_INTERFACES="auto"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

You may also need to update /etc/hostname if there is a domain name specified like hog.local, rather than just the machine name.

You also probably will need to update /etc/hosts to remove the WAP host  hog.local

Connect an ethernet cable to your hub, and a reboot then should give you internet access – ping www.google.co.uk to check. From there you can do a “sudo apt-get update && sudo apt-get dist-upgrade”. Then reboot, revert /etc/default/ifplugd to

# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION.  When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES=""
HOTPLUG_INTERFACES=""
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Re-add the WAP domain into /etc/hostname if you changed it previously.  Likewise add back into /etc/hosts the WAP local address (192.168.42.1  hog.local hog)

Unplug the ethernet dongle and reboot. All should be back to how it was before with HoGWARTS.

P.S. Anyone spotted the link between HoG and her IP address?

P.P.S. The next article will be about calibration of the sensors.  This has radically changed in the last couple of weeks, but currently remains just theory due to the death of Zoë right at the point I was about to test the theory.  That’s actually the trigger for BYOAQ-BAT: I had to build a brand-new quadcopter to replace Zoë, and so it made sense to blog it live.  HoG has just completed the calibration, and is about to undergo the first few basic tests.  Only at that point will I know whether the new calibration works and therefore that I can blog about it.  I hope it does, because otherwise, this may well be the last post in the series!  More details about the new calibration will appear on the blog regardless, but outside of the BYOAQ-BAT articles.

Building the drone secure WAP VPN hub of activity

You’ve probably noticed me mentioning a TP-link powerline wireless access point (WAP) in my outdoor testing. It was the easiest way for me to get a decent WiFi signal outside the house.  But it does require a direct connection to the house ring-main to forward the IP traffic to the broadband router.  Good enough for testing, but useless for non-constrained live flying.  I knew at some point I needed the drone to be a Wireless Access Point in it’s own right, but I’ve been dodging the bullet for a while for a couple of reasons.  Here’s

  1. The drone is a headless model A so there’s no ethernet link to connect to the drone once it’s a WAP – that means I need to get everything I need installed before I turn on the WAP
  2. The WAP will not have bridging to the my broadband network; the drone will be using static IP addresses in its WLAN / VPN and will be secured; so again, another reason to get it right first time if at all possible
  3. My drone WiFi dongle uses the RealTek RTL8088 chipset which requires a modified host access point daemon (hostapd) and it’s only recently I’ve found a set of clear, concise, complete instructions how to set this up.

My aim here is to make the drone an isolated WAP (no access to the internet) which accepts secure client connections.  The clients need to be assigned IP addresses in the drone private nextwork, the the drone will run DHCP; the drone IP address will be static.  Since internet access is not required, no bridging, NAT or DNS services will be provided by the drone.

The information below is based on this link and this link, but is customized to give exactly what the drone needs: a secure WLAN / VPN with no internet access using a statically configured (constant) IP address.

The starting point is a Raspberry Pi, model A, newly flashed with the latest (Jun ’13) wheezy image; WiFi is working as a client to the main WiFi broadband hub and has internet access.

  • login (pi, raspberry), and start up LXDE (startx)
  • open an LXTerminal window
  • type “ping www.google.com” just to be certain of your internet access
  • open Midori browser and head here as a useful reference when making the changes below
  • type “sudo apt-get install hostapd udhcpd” to install the WAP and DHCP daemons
  • type the following to replace the standard WAP daemon with the Realtek version:
    wget http://www.daveconroy.com/wp3/wp-content/uploads/2013/07/hostapd.zip
    unzip hostapd.zip 
    sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
    sudo mv hostapd /usr/sbin/hostapd.edimax 
    sudo ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd 
    sudo chown root.root /usr/sbin/hostapd 
    sudo chmod 755 /usr/sbin/hostapd
  • Configure the revised hostapd by creating /etc/hostapd/hostapd.conf “sudo vi /etc/hostapd/hostapd.conf” and add the following:
    interface=wlan0
    driver=rtl871xdrv
    ssid=MyWAPSSID
    channel=1
    wmm_enabled=0
    wpa=1
    wpa_passphrase=MyWAPPassphrase
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP
    auth_algs=1
    macaddr_acl=0
  • Now to configure the WAP static IP address – “sudo vi /etc/network/interfaces”, replacing the existing entry for wlan0 with the following
    iface wlan0 inet static
    address 192.168.23.1
    netmask 255.255.255.0
  •  In the same file, comment out (# at the start of the line) the following if present
    #allow-hotplug wlan0
    #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    #iface default inet dhcp
  • We next need to configure dhcp for the clients accessing the network to  provide their IP addresses – edit /etc/udhcpd.conf adding:
    start 192.168.23.2 # This is the range of IPs that the hostspot will give to client devices.
    end 192.168.23.20
    interface wlan0 # The device uDHCP listens on.
    remaining yes
    opt domain local
    # opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
    opt subnet 255.255.255.0
    opt router 192.168.23.1 # The Pi's IP address on wlan0 which we have set up.
    opt lease 864000 # 10 day DHCP lease time in seconds

    Note the dhcp address range starts at 192.168.23.20 allowing some space for static addresses 1 – 19.

  • In the same file, delete or comment out “#” any other lines as these are just example settings.
  • Enable dhcp by editing /etc/default/udhcpd thus to comment out the line
    #DHCPD_ENABLED="no"
  • Add the dhcp leases file by typing
    sudo touch /var/lib/misc/udhcpd.leases
    sudo chmod 666 /var/lib/misc/udhcpd.leases
  • Enable hostapd by editing /etc/default/hostapd thus, adding
    DAEMON_CONF="/etc/hostapd/hostapd.conf"
  • Now at this point, you should be ready for a reboot, but when I did that, although other devices could see and connect to my WAP, dhcp was not assigning IP addresses and whatever I did failed – so I abandoned dhcp for the moment, and assigned static IP addresses for the various clients I was going to use to access the drone thus…
  • edit /etc/hostname to ensure the domain name is included – in my case, the domain is called local, and the hostname is wappi, so /etc/hosts reads
    wappi.local
  • Strike this – DHCP problem solved below: Next assign static IP address for the server in /etc/hosts
    192.168.23.1 wappi wappi.local
  • Turn off the ifplugd (pluggable interface daemon) for the WiFi dongle as it seems to cause conflict between hostapd and udhcpd – edit /etc/default/ifplugd
    # This file may be changed either manually or by running dpkg-reconfigure.
    #
    # N.B.: dpkg-reconfigure deletes everything from this file except for
    # the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
    # SUSPEND_ACTION.  When run it uses the current values of those variables
    # as their default values, thus preserving the administrator's changes.
    #
    # This file is sourced by both the init script /etc/init.d/ifplugd and
    # the udev script /lib/udev/ifplugd.agent to give default values.
    # The init script starts ifplugd for all interfaces listed in
    # INTERFACES, and the udev script starts ifplugd for all interfaces
    # listed in HOTPLUG_INTERFACES. The special value all starts one
    # ifplugd for all interfaces being present.
    INTERFACES=""
    HOTPLUG_INTERFACES=""
    ARGS="-q -f -u0 -d10 -w -I"
    SUSPEND_ACTION="stop"
  • Finally (and I don’t know if this was necessary), update /etc/resolv.config to local domain name resolution rather than relying on an external DNS
    domain local
    search local
    nameserver 192.168.1.254
  • Check, double check, and triple check that you’ve done all the above steps, and then finally
     sudo reboot

Because there’s no internet connection, there’s no DNS available, so the clients for the WAP need the WAP static IP address added to /etc/hosts:

192.168.23.1       wappi.local

Now that this works on my test WAP RPi, I still have a few steps remaining:

  • These instructions are for the Edimax Nano USB dongle -EW-7811Un (Realtek RTL8188CUS chipset) and that’s what I tested. But the drone uses a different RealTek device so I need to test that on wappi first Strike that: both the Edimax Nano dongle and the EDUP MS-15003 dongles work successfully as WAPs with the modified hostapd listed above.
  • Once that’s working, I need to follow my own instructions to get the WAP onto the drone itself. Strike that – all working as of this morning following my own blog details
  • And I’d better make sure the drone is set up as an FTP server / daemon as that’s the only way to transfer files to it once it’s a private WAP – I could use a USB stick, but since it’s a model A, that means unplugging the WiFi dongle.Strike that, I’ll use a USB drive or connect to a different network when I need updates. Strike 2 – I installed the FTP server so clients can FTP into the drone, as the clients also have internet access.

When later you wish to update the RPi software, you’ll need to add an ethernet interface.  First, get a USB to Ethernet dongle – I use one by Pluggable which worked out of the box.  Then you need to re-enable the interface pluggable daemon:

# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION.  When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES="all"
HOTPLUG_INTERFACES="auto"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

You may also need to update /etc/hostname if there is a domain name specified like phoebe.local, rather than just the machine name.

You also probably will need to update /etc/hosts to remove the WAP host  phoebe.local

Connect an ethernet cable to your hub, and a reboot then should give you internet access – ping www.google.co.uk to check. From there you can do a “sudo apt-get update && sudo apt-get upgrade”. Then reboot, revert /etc/default/ifplugd to

# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION.  When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES=""
HOTPLUG_INTERFACES=""
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Readd the WAP domain into /etc/hostname if you changed it previously.  Likewise add back into /etc/hosts the WAP local address (192.168.69.1  phoebe.local phoebe)

Unplug the ethernet dongle and reboot. All should be back to how it was before with just the WAP.

Outdoor test flight #1…

stayed firmly grounded: it just needed some tweaking of various parameters which should have only taken a few minutes, but then came a new problem: I couldn’t actually get a stable WiFi connection to the drone via SSH despite the WAP being only a couple of feet away.  I think I need to consider my antenna.

So I’ve chosen a new USB WiFi dongle and antenna base but to fit the antenna physically to the drone is another problem to be resolved.  To cut a long story short, the antenna is going to be dangling down between the legs of the drone (phnarr phnarr for any Viz readers).  And to do that will required a bit of remodelling how the breadboard attached to the shelf between the legs.  Which leads me to the point of this post: pictures of the breadboard layout so I know how to rebuild the circuits with the new antenna layout.

Drone breadboard v2

Drone breadboard V2

P.S. Look very closely and you’ll see a small wire hiding under the muRata switching regulator – it’s there so the V+ & GND are only separated by 0.1″ which matches the connector spacing from the battery.