How to setup a RTL881cu USB Wifi adapter with the Raspberry Pi 4

Despite the Raspberry Pi 4 having built-in dual-band WiFi, many of our customers choose to purchase Dual-band USB WiFi adapters to improve their range or locate the ariel on an enclosure or similar.

Whilst many USB WiFi adapters are supported by drivers already installed within the Raspberry Pi OS, some newer drivers require manual setup.

Both of our dual-band WiFi adapters use the RTL881cu driver, and here's how you can get them working on a Raspberry Pi 4.

Setting up a RTL881cu USB Wifi adapter with the Raspberry Pi 4

Turn your Raspberry Pi on, connect to WiFi, open a new terminal window and follow the steps below. Don't plug the USB adapter in yet!

1. Update your Raspberry Pi

Make sure your Raspberry Pi is up to date before beginning, by using the following commands:

sudo apt-get update

sudo apt-get upgrade

2. Install the required software

You may already have the following packages installed, however it's best to check. Enter the following commands in your terminal window:

sudo apt install git

sudo apt install bc

sudo apt-get install dkms

3. Create a directory

Create a new directory for the driver by using the following command:

mkdir usbwifi

4. Access the directory

Access your new directory using the following command:

cd usbwifi

5. Download the repository

We'll be using a github repository for this install, which includes the driver we need. Enter the following command:

git clone https://github.com/whitebatman2/rtl8821CU

6. Access the downloaded repository

Enter the following command to access the downloaded driver repository:

cd rtl8821CU

7. Edit the driver before installing

We need to amend one of the install files to ensure the driver will work for the Raspberry Pi 4 (or 3). This is also described in the GitHub repo.

Enter the following command to open the file for editing:

sudo nano Makefile

If you're using a Raspberry Pi 4, you need to ensure the following lines are set correctly with y/n as per below:

CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y
CONFIG_PLATFORM_ARM_RPI3 = n

If you're using a Raspberry Pi 3, then it should be set like this:

CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = n
CONFIG_PLATFORM_ARM_RPI3 = y

Once you've made those changes, hit ctrl + X and select 'y' to save the changes

8. Install the driver

Enter the following commands to install the driver. This part can take a few minutes so allow each command run:

make

(note: if it looks like the install gets stuck here after a few minutes, hit enter and see if the terminal moves on)

sudo make install

sudo modprobe 8821cu

9. Plug in the adapter

Once the install is complete, plug the adapter in to a USB port. If you now click on the WiFi icon, you should see both the internal (wlan0) wifi interface available, and the USB (wlan1) interface next to it.