Ever wanted to build a professional looking Access Point with a Raspberry Pi? The Pi 3 comes with Wi-Fi on board and getting this done has never been easier.
This article, published on the MagPi Issue 45, features the new Raspberry Pi 3 and the Pi Supply boards PaPiRus and Pi PoE. Remember that although we will be working with the Pi PoE, everything in this tutorial can also be achieved without it. This setup assumes that you are working on an updated version of Rasbian Jessie full and that you know your ways around nano and a few configuration files.
Building this Raspberry Pi Access Point with PaPiRus and Pi PoE is extremely easy. It requires minimal soldering and for the rest it is really just a question of stacking together the various components.
- Raspberry Pi 3
- PaPiRus with 2.7″ display
- Pi PoE
- 40 pin male header
- GPIO adapter (optional)
- TP-Link TL-POE150S or other PoE injector
The additional header is so that we can install the PaPiRus on top of the Pi PoE or as I did via the GPIO adapter.
In some cases your infrastructure will already be able to deliver Power over Ethernet but if you don’t you will need to use a PoE injector like the TP-Link TL-POE150S.
Connect everything up as shown on making sure that the flat cable for the PaPiRus is connected the right way around.
Once all is connected and ready to be fired, a long press on the switch of the Pi PoE module will power up the system.
For the initial preparation connect a monitor, keyboard, mouse, the Ethernet cable and start Rasbian.
Expand the filesystem via
Choose Expand filesystem. Wait before restarting.
As we are in raspi-config we’ll take the opportunity to enable SPI which we need for the PaPiRus later on.
Choose Advanced Options, SPI and accept to load the modules at boot.
Reboot then update the OS:
sudo apt-get update && sudo apt-get upgrade
At this point we are ready to install and configure hostapd that we will use to create the AP part of our system.
sudo apt-get install hostapd
then we need to create the configuration file as follows. Note that the file does not exist and that we are creating a brand new one.
This is the right time to download the supporting code for GitHub which also contains the templates for the configuration files.
git clone https://github.com/francesco-vannini/PaPiRus-AP.git
edit the hostapd.conf template file
sudo nano PaPiRus-AP/hostapd.conf
and replace the values below with your own
# This is the name of the network ssid=<your SSID> # The network passphrase wpa_passphrase=<wpa password>
copy the file hostapd.conf to the right directory
sudo cp PaPiRus-AP/hostapd.conf /etc/hostapd
At this point we need to edit the following file to make hostapd using the above configuration at startup
sudo nano /etc/default/hostapd
change it by adding
Lastly we start the service
sudo systemctl start hostapd
We really want this configuration not to depend on services that will automatically alter our network settings so we will disable dhcpcd.
sudo systemctl disable dhcpcd
Now we need to install bridge-utils that will allow us to merge the Ethernet and the Wireless interfaces.
sudo apt-get install bridge-utils
at this point we can configure our netwoking using the template provided
sudo nano PaPiRus-AP/interfaces
and change it
address <your AP IP address> netmask <your home/office network mask> gateway <your home/office gateway IP address> dns-search <your internal domain (delete this line if you don't have one)> dns-nameservers <your home/office DNS server (typically it will be the same as your gateway)>
backup your existing file
sudo mv /etc/network/interfaces /etc/network/interfaces.bck
and copy the new one
sudo cp PaPiRus-AP/interfaces /etc/network/
At this point you can reboot your Pi and if all is good you should find a new AP with the SSID you choose! You can now connect via the br0 IP that you specified.
The Access Point is ready. Devices connecting to it should get their IP from the DHCP on your home/office router and should be able to browse the internet. Great!
Whereas for the Pi PoE there are no software steps involved, for the PaPiRus we need to install drivers and packages which will also provide some ready made examples we could use to test all it’s working before turning to the code that will allow us to manage the AP.
To install the PaPiRus software execute the following command from your home folder, if uncertain of where you are just get back to your home directory by executing cd~ .
curl -sSL https://goo.gl/i1Imel | sudo bash
The installation should be fairly quick and resolve various dependencies for the packages required to use the PaPiRus screen.
This should be it. Run:
and if all is well you should see a nice clock on your PaPiRus. We are now nearly done and one step away from getting our AP ready for business.
We have created some demo code to display various information about the AP on the PaPiRus. By using the four switches you will be able to access network stats and basic information about the AP configuration.
sudo python PaPiRus-AP/APInfo.py &
Your PaPiRus screen should spring to life and display your SSID and AP IP address. By pressing switch 2 you get to see some bandwidth stuff and by pressing switch 3 you get a detailed view of the AP networking setup.
You now have a very nice and portable Access Point to carry with you at Raspberry Pi Jams or hackatons or wherever your Pi will take you next.
Difference between this AP and other configurations
There are a couple of methods that can be used to create an AP at the OS level. In our view it largely depends on what one considers an AP to be. Without dwelling on this at length we decided to implement the AP as an ISO layer 2 device which is a fancy way to say that there will not be any routing, firewall or NAT involved. The device will “merge” the Ethernet network card and the Wi-Fi into a bridge, it will only have one IP address and will in fact behave as a typical AP and not as a home Broadband Router.
Your home/office router needs to have a DHCP enabled
The AP will not serve as a DHCP so it essential that you have one enabled on your router. The first part of the setup also requires that the Pi receives an IP from the router in order to get all the packages required off the internet.