Electronics, Software

Raspberry Pi WiFi Router

When I was moving houses a few months back I needed a second wifi router to connect several surveillance cameras to while we were not living in the new place. The problem was that during the pandemic I was not sure if a new wifi router would arrive on time. Thankfully I had a spare Raspberry Pi that could be used to set up a temporary router.

This was only possible because of an open-source project called raspap-webgui which transforms the Raspberry Pi into a capable WiFi Router. Using the Pi also has its advantages over a traditional router because I can set up a remote VNC connection to manage the WiFi from anywhere in the world.

Setup

Flash The SD Card

First, we need to download the new pi os desktop 32bit image (the smaller one) off of the official raspberry pi web site

Raspberry Pi OS 32bit with Desktop

Next, you need to write the OS to the SD card. This can be done using the balena Etcher software

balena Etcher Software

The process is very simple, just insert your SD card, select the OS zip that you downloaded, and your sd card, then just hit Flash!

Once the SD Card has finished flashing, re-insert it as we need to add a file to enable SSH into the device.

Create a blank file named ssh and add it to the boot folder.

Starting Up The Pi

Insert the SD card into the Raspberry pi and attach the ethernet cable and the power the Pi with a suitable power supply, preferably something with enough amperage for whatever Raspberry Pi you are using.

Now we need to ssh into the Raspberry Pi over our network. Run this command in your terminal for Linux and Mac OS

ssh pi@raspberrypi.local

On Windows download an SSH client like Putty to use SSH

Pi Config

With a prompt into the Raspberry Pi we can run the config wizard to set up different interfaces and change the default passwords and pi name.

sudo raspi-confg

First, we need to change the password for the “pi” user. Pick something that you will easily remember.

Next start raspi-config up again and navigate to the Network Options and then Hostname. I chose pihotspot just to be descriptive as I have a few raspberry pis.

Next navigate to the Localization Options and Change the WLAN Country.

We will also set up VNC as I wanted to be able to connect to the Pi remotely using RealVNC. So next we will navigate to the Interfacing Options, and then VNC Enable.

Now reboot the Raspberry Pi with

sudo reboot

RaspAP Install

Log back into the Raspberry Pi with the new host name

ssh pi@pihotspot.local

Update the OS

sudo apt update
sudo apt upgrade

In order to make sure that the Pi WiFi interface is available to start the access point we need to modify the wpa_supplicant file. So first we want to make a copy of it just in case.

sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.sav

sudo cp /dev/null /etc/wpa_supplicant/wpa_supplicant.conf

You can use nano or vim to modify the file just make sure to use sudo.

sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

Add this to the file

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

Now we can finally start installing the RaspAP software, this can be done easily with the quick installer.

curl -sL https://install.raspap.com | bash

After the installation is finished shutdown the Pi

sudo poweroff

Connect the Pi directly to the Internet modem like you would with a normal WiFi router and plug the Pi back in, to power on.

RaspAP Setup

Once the Pi is finished powering on we can connect to the WiFi hotspot via raspi-webgui SSID with password ChangeMe.

Now that we are connected open up a browser tab to

10.3.141.1

Enter the default user name and password

admin
secret

The web application should come up, showing the RaspAP Dashboard

Once logged in, go to Hotspot to change the SSID name to personalize the WiFi name. You can also change the Wireless Mode, WiFi Channel, and the particular hardware interface the hotspot should use if there are multiple connected to the Pi.

Next chage the tab to security and change the PSK which will be the hotspot password.

You should also change the admin password as well by selecting the Authentication tab entering the old password “secret” and your new password.

Remote Access VNC

Now that the main WiFi Router software has been installed and we can access it via the browser I want to configure the VNC so that I can remotely access the device from anywhere. To do this we need a free RealVNC account and configure the Pi as one of our devices.

SSH back into the Pi and start VNC

vncserver

If this asks you for a password, enter a password for the VNC connection

Download the RealVNC Viewer application so that we can connect to the VNC server that is now running on the Pi. You can download it for your machine here:

RealVNC Viewer

Connect to the VNC locally by entering in the IP:1 into the RealVNC Viewer connection bar

10.3.141.1:1

Enter pi for the user and either the VNC password you have chosen or your pi user password.

Now that we are connected locally we can set up the RealVNC application to allow us to connect remotely from the internet as well as our local network.

Open a terminal and run the RealVNC License application

vnclicensewiz

This will open up a GUI window where you can enter your RealVNC Account details to activate the device for remote access.

Now we should be able to open up the VNC Connect server and see the green checkmark indicating that our account is connected.

From here you can now connect to the Pi via the VNC Viewer Application on your PC Mac or even your smartphone. I like to use my smartphone to check the internet connection to the Pi as I can just disconnect from my local network and use LTE to connect if everything is working correctly.

Conclusion

The software was super easy to install and get up and running. I was able to take the Pi to my new place, directly connect it to my Internet Modem via Ethernet, and get internet access. It was then a simple matter of connecting my security cameras to the new access point.

I think this could act as a secondary wifi router, in the event that your primary one stops working, or as a travel router that you could take on the go with a battery.

The RaspAP also provides a multitude of features that can extend the Pi’s capabilities such as VPN, Ad Blocking, or special networking preferences, giving you the option to set up the device any way you like.

Helpful Links

https://github.com/billz/raspap-webgui

https://howtoraspberrypi.com/create-a-wi-fi-hotspot-in-less-than-10-minutes-with-pi-raspberry/

4 thoughts on “Raspberry Pi WiFi Router”

  1. Thanks for a marvelous posting! I actually enjoyed reading it, you happen to be a great author.I will be sure to bookmark your blog and will often come back in the foreseeable future. I want to encourage you to definitely continue your great work, have a nice holiday weekend!

  2. Heya i抦 for the primary time here. I found this board and I in finding It truly helpful & it helped me out much. I hope to present one thing again and aid others like you helped me.

Comments are closed.