BerryGPS-GSM Using GPS and Connecting via 3G/2G using PPP

BerryGPS-GSM and Raspberry Pi Zero

Using GPS on BerryGPS-GSM

The GPS used on the BerryGPS-GSM is the same as the GPS module used on the BerryGPS-IMU.
The guide used for BerryGPS-IMU can also be used for BerryGPS-GSM;
https://ozzmaker.com/berrygps-setup-guide-raspberry-pi/

If the BerryGPS-GSM is sitting on top of the GPIO pins of the Raspberry Pi, you can continue to use /dev/serial0 for the modem device  which is mentioned in the above guide.
However, if you are streaming the GPS data through the GSM module, then you will need to use /dev/ttyACM3

Using the 3G/2G cellular modem - PPP

This section shows how to create a PPP Internet connection using the GSM module on the BerryGPS-GSM.

Update apt-get and then install PPP

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install ppp

We now need to create a chat script.  A chat script defines the conversation needed between the Pi and the GSM modem to create a PPP session.
Create a new directory

pi@raspberrypi ~ $ sudo mkdir /etc/ppp/chatscripts/

Create a new script

pi@raspberrypi ~ $ sudo nano /etc/ppp/chatscripts/mobile-modem.chat

Copy this content into the empty file;

ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
TIMEOUT 12
REPORT CONNECT
"" AT
OK ATH
OK ATZ
OK ATQ0
OK AT+CGDCONT=1,"IP","hologram"
OK ATDT*99***1#
CONNECT ''

Line 15 above should have you carrier's APN. For this guide, we are using a Hologram SIM. If you are not using a Hologram SIM, then you will need to add the APN for your provider.

Configure the settings used by PPP;

pi@raspberrypi ~ $ sudo nano /etc/ppp/peers/provider

Locate the below line;

connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T ********"

Delete it or comment it out by placing a '#' at the start of the line.
And then add this line just below;

connect "/usr/sbin/chat -v -f /etc/ppp/chatscripts/mobile-modem.chat -T hologram"

Place your APN at the end, here we are using hologram. If you are not using a Hologram SIM, you would need to use the APN for your provider.

You now need to add the serial device used by the GSM modem. This should be /dev/serial0
Just below this line;

#/dev/modem

add

/dev/ttyACM0

To manually start a PPP connection, use;

pi@raspberrypi ~ $ sudo pon

And to close a PPP connection, use;

pi@raspberrypi ~ $ sudo poff

Verification can by done by seeing if the Pi has a ppp0 interface and it has an IP.

pi@raspberrypi ~ $ sudo ifconfig

Below is the output from the above command, with ppp0 highlighted showing an active connection.
ifconfig

You can also monitor the syslog while bringing up ppp

pi@raspberrypi ~ $ tail -f /var/log/syslog

 

Start PPP on boot

Add the user Pi to the dialup group;

pi@raspberrypi ~ $ sudo adduser pi dip

Create a new script to start ppp;

pi@raspberrypi ~ $ nano ~/pppStart.sh

copy in the below lines;

#!/bin/bash
sleep 5
pon

The pause above is there to give the Pi time to boot before we try and make a PPP connection.

Make the script executable;

pi@raspberrypi ~ $ chmod +x pppStart.sh

We will use cron to start the script every time the Pi boots;

pi@raspberrypi ~ $ crontab -e

Add the below line to the bottom

@reboot /home/pi/pppStart.sh &

Other Guides and Tutorials for BerryGPS-GSM

Blip, blop, bloop…