Raspberry Pi with 3G

How to use Raspberry pi 3 model B connect to internet via usb 3G or 4G.

Equipments :

Software Lists:

  • Sakis3g is a script which creates an Internet connection using 3G modems.
  • UMTSkeeper : keep your UMTS/GPRS/GSM connection alive automatically. now include the Sakis3G script with the UMTSkeeper download.

First check that you have ppp installed
sudo apt-get install ppp

Now download the Sakis3g package
sudo wget “http://www.sakis3g.com/downloads/sakis3g.tar.gz” -O sakis3g.tar.gz

Then unzip the file
sudo tar -xzvf sakis3g.tar.gz

Make the file executable
sudo chmod 755 sakis3g

And finally launch it
./sakis3g –interactive

Install UMTSkeeper read here http://mintakaconciencia.net/squares/umtskeeper/

cd ~
mkdir umtskeeper
cd umtskeeper
wget “http://mintakaconciencia.net/squares/umtskeeper/src/umtskeeper.tar.gz”
md5sum umtskeeper.tar.gz
tar -xzvf umtskeeper.tar.gz
chmod 755 sakis3g umtskeeper

plug usb modem into raspberry pi usb port.

use command lsusb to check.

pi@raspberrypi:~ $ sudo lsusb
Bus 001 Device 011: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
Bus 001 Device 012: ID 05ac:0304 Apple, Inc. Optical USB Mouse [Mitsumi]
Bus 001 Device 009: ID 0461:0010 Primax Electronics, Ltd HP Keyboard
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $

write down ID xxxx:xxxx in example is 12d1:1506

we will use this ID in command line argument.


/home/pi/umtskeeper/umtskeeper –sakisoperators “USBINTERFACE=’0′ OTHER=’USBMODEM’ USBMODEM=’12d1:1506‘ SIM_PIN=’0000′ APN=’CUSTOM_APN’ CUSTOM_APN=’internet’ APN_USER=’0′ APN_PASS=’0′” –sakisswitches “–sudo –console” –devicename ‘Huawei’ –log –silent –monthstart 8 –nat ‘no’ –httpserver &>> /home/pi/umtskeeper/error.log &

if you want start UMTSkeeper automatically after boot. Put a command above into /etc/rc.local ( /etc/rc.local has to be edited by the root user. ex. sudo vi /etc/rc.local).

  • the next setting is config vpn between pi and server. The setup instruction is in digitalocean tutorial.

How to share internet and wifi access point on 3G/4G Aircard with Raspberry pi 3 (pocket wifi)

Read instructions here https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/ but replace iptables options with this commands (because we connected to internet via ppp0 not eth0) :

sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE  
sudo iptables -A FORWARD -i ppp0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT  
sudo iptables -A FORWARD -i wlan0 -o ppp0 -j ACCEPT  


Speed test by nuttcp

wait and see. 😉 will be soon.

On server side:

Software lists:

Working step

  1. Make Network Connection
  2. Make VPN Connection
  3. Scheduling Test by crontab
  4. Testing (shell script)
  5. Convert to JSON (text parsing)
  6. POST to web application by curl
  7. Insert to Database (php + mysql)


  1. Read from Database
  2. Convert to Array (JSON)
  3. Display Graph by Google Chart API

Future work

Convert data to RRD by RRDTool