Raspberry Pi : WiFi Hotspot for the Garden!

Background

It's been a while since I wanted to solve my WiFi issue outside of my house. When outside, you always need connectivity : checking mails, working from home, streaming music during parties with family and friends, ... there are a lot of use cases. But, how to solve this ? You can add multiple WiFi repeaters but this is not handy.

Let's WiFi

I had the opportunity to receive a new Raspberry Pi 3 and I already knew that "Sky is the limit" with those berries. Indeed, there is a way to make another good use of the Pi and convert it as a WiFi hotspot.

Here is the physical setup in my garage :


On the left, the lab that I've tried and on the right the packaged version in a sealed electrical box.


Perfectly sealed, no problem with dust/water or whatsoever.

BOM
  • Raspberry Pi (mine is Pi 3 B - with built in WiFi);
  • PLC module (mine is a devolo 500 mbps, chose the one you like);
  • Network cable (of course...)
Software
  • Raspbian (I'm running v 4.14);
  • Raspap
  • RaspAP-WebGui
  • lighthttpd
  • git
  • php
  • dnsmasq
  • configuring relevant iptables
Step 1 - Get a functional LAN point

This is the reason why I have a PLC module in my garage, to be sure to be connected to my LAN. In order to do that, you need to have an electrical point which is not on a PDU but a direct outlet attached to your electrical circuit. I don't know why a PDU does not work, but this is clearly stated in the PLC adapter's documentation. Once you have it synced with the rest of your PLC LAN, you are good to go.

Step 2 - Setup RaspAP

Be sure to have LAN connectivity, and access your Raspberry via ssh and switch to the root user. Luckily, the process is automated with minimal interaction, enter the below command to setup RaspAP :

root@raspberrypi:~# wget -q https://git.io/voEUQ -O /tmp/raspap && bash /tmp/raspap


 888888ba                              .d888888   888888ba
 88     8b                            d8     88   88     8b
a88aaaa8P' .d8888b. .d8888b. 88d888b. 88aaaaa88a a88aaaa8P
 88    8b. 88    88 Y8ooooo. 88    88 88     88   88
 88     88 88.  .88       88 88.  .88 88     88   88
 dP     dP  88888P8  88888P  88Y888P  88     88   dP
                             88
                             dP

The Quick Installer will guide you through a few easy steps

RaspAP Install: Configure installation
Detected Raspian 9.0 (Stretch)
Install directory: /etc/raspap
Lighttpd directory: /var/www/html
Complete installation with these values? [y/N]: y
RaspAP Install: Updating sources
Get:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15,0 kB]
Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25,3 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11,7 MB]
Get:4 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [34,0 kB]
Get:5 http://raspbian.raspberrypi.org/raspbian stretch/contrib armhf Packages [56,9 kB]
Fetched 11,8 MB in 9s (1.196 kB/s)                                                            
Reading package lists... Done
RaspAP Install: Installing required packages
Reading package lists... Done
Building dependency tree     
Reading state information... Done
git is already the newest version (1:2.11.0-3+deb9u3).
hostapd is already the newest version (2:2.4-1+deb9u1).
lighttpd is already the newest version (1.4.45-1).
php7.0-cgi is already the newest version (7.0.30-0+deb9u1).
dnsmasq is already the newest version (2.76-5+rpt1+deb9u1).
0 upgraded, 0 newly installed, 0 to remove and 44 not upgraded.
RaspAP Install: Enabling PHP for lighttpd
already enabled
Run "service lighttpd force-reload" to enable changes
[ ok ] Restarting lighttpd (via systemctl): lighttpd.service.
RaspAP Install: Creating RaspAP directories

# Defaults from Raspberry Pi configuration
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname

# RaspAP-WebGui wireless configuration
interface wlan0
static ip_address=10.3.141.1/24
static routers=10.3.141.1
static domain_name_server=1.1.1.1 8.8.8.8
RaspAP Install: Cloning latest files from github
Cloning into '/tmp/raspap-webgui'...
remote: Counting objects: 250, done.
remote: Compressing objects: 100% (220/220), done.
remote: Total 250 (delta 26), reused 169 (delta 19), pack-reused 0
Receiving objects: 100% (250/250), 1.56 MiB | 1.38 MiB/s, done.
Resolving deltas: 100% (26/26), done.
RaspAP Install: Changing file ownership in web root directory
RaspAP Install: Moving configuration file to '/etc/raspap'
RaspAP Install: Setting up hostapd
echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP: Line already added
iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP: Line already added
RaspAP Install: symlinked wpa_supplicant hooks for multiple wlan interfaces
ln: failed to create symbolic link '/etc/dhcp/dhclient-enter-hooks.d/10-wpa_supplicant': File exists
RaspAP Install: Sudoers file already patched
RaspAP Install: Installation completed!
The system needs to be rebooted as a final step. Reboot now? [y/N]: Y

Once restarted, simply access http://<your-raspberry-ip>

Step 3 - Configuring RaspAP via web UI

The default credentials of the RaspAP UI is admin / secret. Once on the main screen, you see the dashboard. Jump to the "Configure hotspot" section and set your SSID and pre-shared key.


Specify your SSID, Wireless Mode and channel, save settings, stop hotspot and start hotspot. You should be able to see it and connect with the PSK specified in the Security tab.

Step 4 - Enjoy Wifi !

Indeed, once the setup is completed, this is a real revolution ! I often work from home and being in on the terrasse in the summer time with a decent WiFi is really amazing.

Final though

If you want to enhanced the connectivity with faster Wifi, you can always make a good use of the USB connectors of the Raspberry and add an external USB WiFi dongle. There are plenty on the market supporting the Raspberry and Raspbian. Just make sure you need it.

Correctly secure your WiFi ! Indeed, if the goal is to be accessible outside, anyone can potentially access it. So, the strongest encryption and the longest key is the rule here.


Comments

What's hot ?

ShredOS : HDD degaussing with style

Mac OS X : Display images in-line with terminal