Settting up ppp interface using a GPRS shield in Raspberry Pi

Hi friends,
This is my first technical blogpost here. This particular problem of setting a ppp interface using a gprs shield took me 2 complete painful weeks. So I thought of compiling everything at one place so that it might be helpful.
  
First install ppp in Raspberry Pi

sudo apt-get install ppp
To configure the GPRS Shield as a dial-up modem

we basically need two files
 1) configuration file to tell ppp daemon where, how to find the shield and other parameters like baudrate etc.
 2) A chat script the chat with the gprs modem.

lets name the connection as gprs
so create a file in /etc/ppp/peers with name gprs and copy below configuration

debug
/dev/ttyUSB0
9600
connect 'chat -f /etc/ppp/chat/gprs'
defaultroute
noauth
lock
passive
usepeerdns


here we have used GL868-Dual V3 telit shield and the location and name of chat script is given above /etc/ppp/chat/gprs and the chat script for telit GL868 series is given below.

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT#SCFG=1,1,1500,0,60,50'
OK      'AT+CGDCONT=1,"IP","internet"'
OK      'AT#ENS=1'
OK      'AT+CGACT=1,1'
TIMEOUT 100
OK      "ATD*99***1#"
CONNECT ' '



now once these files are created now, just run

sudo pppd call gprs

some notes regarding chat scripts
 --> when chat scripts fails adjusting time-outs and try killing the process and restart
 --> better put a script in /etc/rc.local or crontab to check the internet connection and restart the modem.

now since ppp0 interface is not default we need to manually add this.

sudo route add default ppp0

for more details

http://ernstagn.home.xs4all.nl/GPRS-HOWTO/GPRS-HOWTO-6.html
https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd#.2Fetc.2Fppp.2Fchatscripts
http://www.tldp.org/HOWTO/PPP-HOWTO/manual.html



SECOND PART

In configuration file we have to give the device name like /dev/ttyUSB0 etc.
but this will change every time rpi restarts and you are not in control of it. This is called problem of USB-enumeration.

For more details about this problem refer above link


To find what usb

dmesg | grep ttyUSB   

To find vender id and product id
udevadm info --name=/dev/ttyUSB1(your usb name) --attribute-walk

Create a file /etc/udev/rules.d/99-usb-serial.rules with something like this line in it:

SUBSYSTEM=="tty", ATTRS{idVendor}=="1234", ATTRS{idProduct}=="5678", SYMLINK+="ttyGSM" (here include any name you like)

Load the new rule:

sudo udevadm trigger

To check

ls -l /dev/your_device_name

Comments

Popular Posts