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:
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
#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.
interface wlan0 # The device uDHCP listens on.
opt domain local
# opt dns 184.108.40.206 220.127.116.11 # 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
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
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
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.
ARGS="-q -f -u0 -d10 -w -I"
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
Check, double check, and triple check that you’ve done all the above steps, and then finally
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.