Officially, the Linux drivers/software that comes with this 4G/LTE USB adapter doesn’t support Raspbian or any non-standard Linux distributions, but based on two separate guides, I was able to make this work for myself.
Equipment used:
- Raspberry Pi 3 Model B+
- D-Link DWM-222 4g LTE USB adapter
- 4G SIM card from Telia Norway
- Raspbian Stretch or later (I used the Lite image)
You’ll also need an alternative Internet connection, either wired or wireless, to install the required software.
Heads-up
Before you start up your Raspberry Pi, you should plug in the DWM-222 unit, as well as your USB keyboard. When I had everything started up, and plugged in the DWM-222 while everything was powered on, I experienced an on-screen warning about “Under-voldate detected”, at which point, my keyboard stopped working. If this happens, unplugging the keyboard from the USB port and plugging it back in reset this issue.
All commands below implies either using sudo in front, or being logged in as the root user.
Installing required software
apt install git ppp libusb-1.0-0-dev wvdial
I also suggest installing the full vim editor, if you plan on using vim, since the vim edition that comes pre-installed is lacking (vim-tiny). If you do NOT plan to use vim, replace the “vi” commands below with your favorite text editor.
Install sakis3g
We also need sakis3g for connection management to the USB dongle. We also need to update one of the downloaded files before we can compile it.
Run the following commands:
git clone https://github.com/Trixarian/sakis3g-source.git
cd sakis3g-source
vi dependencies/usb-modeswitch/usb_modeswitch.h
We need to change the following line:
#include <libusb.h>
Into this:
#include <libusb-1.0/libusb.h>
This is usually on/around line 26 in that file.
Now, run the following:
./compile
cp build/sakis3gz /usr/bin/sakis3g
cp files/sakis3g.conf /etc/
This compiles, installs, and prepares the sakis3g software for use.
Configure wvdial
Now, edit /etc/wvdial.conf, and make sure it includes the following config:
[Dialer defaults]
Modem = /dev/ttyUSB1
Init3 = AT+CGDCONT=1,”IP”,”telia”
Phone = *99#
Stupid Mode = 1
Username = ” ”
Password = ” “
If you’re not using Telia in Norway, replace “telia” in the line for Init3 with either “internet” or your carrier’s APN.
Now, run the following command to fill in the rest of the settings:
wvdialconf
You can do a test on this by running wvdial, and check if you get any IP address information. However, this alone doesn’t provide a proper Internet connection.
Configure sakis3g
Find your hardware ID type:
lsusb
It should be the device listed as from D-Link. On my system, the device line appears like this:
Bus 001 Device 007: ID 2001:7e35 D-Link Corp.
The hardware ID in this case is “2001:7e35” for the DWM-222 device.
This is information we can put into /etc/sakis3g.conf, along with a few other options:
USBDRIVER=”option”
OTHER=”USBMODEM”
USBMODEM=”2001:7e35”
USBINTERFACE=”1″
Additionally, based on a previous run, I can also include the the following line for Telia Norway:
APN=”internet.netcom.no”
Interactive menu in sakis3g
If you don’t add any of the above lines into /etc/sakis3g.conf, and just leave it as it is with its default, running sakis3g will prompt you for each of these when trying to connect.
Please select modem type | 1. USB device |
Please select USB modem | 5. Mobile Connect |
Please appropriate interface | 1. Interface #1 |
Please select APN | 1. NetCom (internet.netcom.no) |
After the first 3 menu selections, sakis3g will try to auto-detect (via the modem) which APNs might be available to your SIM card.
Quick Note: “NetCom” is the old name for Telia in Norway, before their name change (and before they were acquired by the TeliaSonera group).
Connecting to 4G Internet
If you’ve configured your preferred settings in /etc/sakis3g.conf, then from now on, you can start up the 4G connection with the following command:
sakis3g connect
Alternatively (as an alias):
sakis3g start