/ Raspberry Pi

Using RTL8812 Wi-Fi Adapter with Raspberry Pi

Connecting Raspberry Pi to the WiFi network is very easy if the adapter is supported by the Raspbian. If it is not, the module that brings specific support to the Kernel should be installed.

The adapter that I've got is Edimax EW-7811UAC AC600 dual-band adapter. The adapter should work with rtl8812au module[1], which is not included in the Raspbian Lite. It need to be compiled from sources.

There are at least two versions of the driver available on github: rtl8812au[2] and rtl8812au_rtl8821au[3]. The rtl8812au_rtl8821au seems to be more advance: it partially support monitor mode, its newer than rtl8812au.

Before compiling the necessary tools and Raspbian sources should be installed:

$ sudo apt-get update
$ sudo apt-get install bc git
$ sudo wget "https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source" -O /usr/bin/rpi-source
$ sudo chmod 755 /usr/bin/rpi-source
$ rpi-source

Now clone the adapter's repository and cd to it:

$ # For rtl8812au
$ git clone https://github.com/gnab/rtl8812au
$ cd rtl8812au

$ # For rtl8812au_rtl8821au
$ git clone https://github.com/Grawp/rtl8812au_rtl8821au.git
$ cd rtl8812au_rtl8821au

Update target:

$ sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
$ sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile

For rtl8812au_rtl8821au comment the unsupported option in the Makefile:

$ vi Makefile
...
#EXTRA_CFLAGS += -Werror=incompatible-pointer-types
...

Build it:

$ make

Install:

$ sudo cp 8812au.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
$ sudo depmod -a
$ sudo modprobe 8812au

Check that new wlan interface appears:

$ ifconfig
...
$ iwconfig
...

Now configure interface options in /etc/network/interfaces:

$ sudo vi /etc/network/interfaces
...
allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    # up iptables-restore < /etc/iptables.ipv4.nat
    wireless-power off
...

And add known access points are in the file /etc/wpa_supplicant/wpa_supplicant.conf:

$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
...
network={
	ssid="Access Point Name"
	psk="secret password"
}
...

RPI should connect to the available networks automatically.


  1. https://wikidevi.com/wiki/Edimax_EW-7811UAC ↩︎

  2. https://github.com/gnab/rtl8812au ↩︎

  3. https://github.com/Grawp/rtl8812au_rtl8821au ↩︎

Alex Netkachov

Alex Netkachov

Alex Netkachov is a Senior Software Developer, currently working in Central London on new generation of energy trading solutions for brokers, traders and exchanges.

Read More

Why not to chat about this post? Join Telegram group Alex@Net or message on Twitter to alex_at_net. Alternatively, use the comments form below.