Create an AP to gain remote control of the Raspberry

Run through this step-by-step guide to set-up an access-point for a version 3.2 Realtek chipset wifi dongle on Raspian.

Used hardware:

Used software:

cat /etc/os-release
  • Linux 4.14.98+ #1200 kernel
uname -a

Software configuration

Check that your wifi dongle got recognized correctly after plugging it in.

lsusb
TP-Link TL-WN722N not recognized

The “manufacturer” is represented in the ID as 1d6b, the “Linux Foundation”. The nature of the bus is reflected in 0002, USB version 2.0.

As it is version 3.2 of the TP-Link TL-WN722N model, it means that we have a Realtek chipset which is not natively supported by Raspian. We need to build the driver on our system in order to have it working. If you have a better supported chipset, I recommend set-up guide.

Download the kernel header source to compile the driver later on. There is a good tool called rpi-source available . Follow the manual and run:

sudo apt-get updatesudo apt install git bc bison flex libssl-devsudo wget https://raw.githubusercontent.com/RPi-Distro/rpi-source/master/rpi-source -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source && /usr/local/bin/rpi-source -q --tag-updaterpi-source

Then clone the driver repository from :

git clone 

Follow the instructions from the repository:

sudo make all
sudo make install
sudo depmod
sudo modprobe 8188eu

If everything has run successfully, you should see rtl8188eufw.bin within /lib/firmware/rtlwifi

Further, you should see the module as well, when running lsmod

Now runsudo rebootand a new interface wlan1 should show up when running ifconfig.

Further, lsusb now also shows the device correctly

TP-Link TL-WN722N recognized

To set up the access point for the connection between the phone and raspberry, we will use . Follow the instructions there, no need to install OpenVPN during the process (if you do not need it).

curl -sL  | bash

In order to define the port for the RaspAP web-service you can do the :

sudo nano /etc/lighttpd/lighttpd.conf

Then change the following line:

server.port                 = 8081

Then let’s restart the lighttpd webserver:

sudo systemctl restart lighttpd.service

Then you can access the web-server on with the default credentials:

username: admin
password: secret

First, make sure that you change the default password within the user settings of the UI.

Then change the Hotspot settings to wlan1 in order to . You can then also define the SSID and security settings.

Since Raspbian Stretch, and no configuration is set-up. You will see this error when starting the hostapd service:

Failed to start hostapd.service: Unit hostapd.service is masked.

This can be fixed by unmasking:

sudo systemctl unmask hostapd
sudo systemctl enable hostapd

After running sudo reboot, the configuration for the access point has been filled by RaspAP. We can have a look with

sudo nano /etc/hostapd/hostapd.conf

It should look similar to this:

interface=wlan1
ssid=PiBoat
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
driver=r8188eu
ieee80211n=1
hw_mode=g
device_name=WN722N
manufacturer=TP Link

Now you can also set the configuration file by doing the following:

sudo nano /etc/default/hostapd

Replace DAEMON_CONF by running sudo nano /etc/default/hostapd

DAEMON_CONF=”/etc/hostapd/hostapd.conf”

Let’s now check if everything runs as expected after the last reboot:

sudo reboot

Check if you can still connect via ssh pi@raspberrypi.local. If it still works, you can still login by using the on-board wifi module of the Raspberry. If this is not the case, you should attach a keyboard to the Raspberry and look for errors in the logs. Have a look into journalctl -b -e if this is the case.

To be sure everything is configured correctly, you can run iw dev.

You can also check the status of both configured services:

sudo systemctl status hostapd.service
sudo systemctl status dnsmasq.service

If everything is running correctly, you can now connect to the network on your phone:

I hope this helps you converting your raspberry into a Wifi access point 😃.

You can also check out some of my other tutorials like using your Raspberry for 📝🤖.

Engineering Manager @ Babbel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store