Raspberry Pi runs PPP Dial-up with Quectel EC25 LTE Modem

This application is for Raspberry Pi Model B and Quectel EC series LTE chip. We dial PPP connection up for 4G/LTE USB Quectel EC25 Modem via Raspberry Pi. It’s useful to collect the GPS data and send it back via 4G/LTE network. Good to develop the embedded system.

Quectel EC25 supports GPS and LTE network, please refer more Chip Spec info from http://www.quectel.com/product/ec25.htm, we also sell the Quectel EC25-AU LTE modem, included GPS Antenna, LTE Antenna, 12V DC Adapter, USB cable, RS232 cable. Feel free to contact with service@enchose.com

1. Connect the USB LTE Modem into Raspberry Pi

2. Type sudo apt-get update to update list

3. Type sudo apt-get install rpi-update to install rpi-update

4. Type sudo rpi-update to update kernel
5. Type sudo reboot to reboot the Raspberry Pi
6. Type ls /dev after rebooting and logging well  to check ttyUSB3 is available or not(Note: Data Port: ttyUSB3, AT Command Port: ttyUSB2)

7. Create ppp-creator.sh with below script and put it into the Raspberry Pi

ppp-creator.sh:

#!/bin/sh

echo "install ppp"
apt-get install ppp

echo "creating directories"
mkdir -p /etc/ppp/peers

echo "creating script file : /etc/ppp/peers/quectel-chat-connect"
echo "
ABORT \"BUSY\"
ABORT \"NO CARRIER\"
ABORT \"NO DIALTONE\"
ABORT \"ERROR\"
ABORT \"NO ANSWER\"
TIMEOUT 30
\"\" AT
OK ATE0
OK ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2
# Insert the APN provided by your network operator, default apn is $1
OK AT+CGDCONT=1,\"IP\",\"\\T\",,0,0
OK ATD*99#
CONNECT" > /etc/ppp/peers/quectel-chat-connect


echo "creating script file : /etc/ppp/peers/quectel-chat-disconnect"
echo "
ABORT \"ERROR\"
ABORT \"NO DIALTONE\"
SAY \"\nSending break to the modem\n\"
\"\"  +++
\"\"  +++
\"\"  +++
SAY \"\nGoodbay\n\"" > /etc/ppp/peers/quectel-chat-disconnect


echo "creating script file : /etc/ppp/peers/quectel-ppp"
echo "
/dev/$2 115200
user \"\"
password \"\"
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/ppp/peers/quectel-chat-connect -T $1'
# The close script
disconnect 'chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect'
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# Debug info from pppd
debug
# If you want to use the LTE link as your gateway
defaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
# Hardware flow control
nocrtscts
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 30
# Ask the peer for up to 2 DNS server addresses
usepeerdns" > /etc/ppp/peers/quectel-ppp

echo "\n\nUse \"sudo pppd call quectel-ppp\" command and go internet"

 

##################################

8. Type chmod +x ./ppp-creator.sh

9. Type sudo ./ppp-creator.sh INTERNET ttyUSB3 (Note: INTERNET is your APN name)

 

10. Type sudo pppd call quectel-ppp persist to keep PPP connect up,from ifconfig we will find ppp0 up,in this time we type sudo ip route add 0.0.0.0/0 dev ppp0 to make all packets going via ppp0

 

11. If you want to disconnect PPP, just running killall pppd