14 Aug 2018
Sixfab’s Raspberry Pi GSM/GPRS Shield is a nice little IoT modem to connect the Pi to the internet in remote locations via a 2G mobile network.
Serial Port Configuration
- In
/boot/cmdline.txtremove theconsole=serial0,115200part. - Add this lines to
/boot/config.txt:enable_uart=1 dtoverlay=pi3-disable-bt - Disable the serial-getty service:
systemctl stop serial-getty@ttyAMA0.service systemctl disable serial-getty@ttyAMA0.service - Power-off the Pi.
- Connect the Sixfab GSM/GPRS Shield to the Raspberry Pi’s GPIO pins.
- Make sure the physical switch on the Shield is set to “Pi” (not USB!)
- Power-on the Pi.
PPP
- Install the
ppppackage:apt-get update apt-get install -y ppp - Create directories:
mkdir -p /etc/chatscripts /etc/ppp/peers - Create
/etc/chatscripts/quectel-chat-connectfile: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 OK AT+CGDCONT=1,"IP","\T",,0,0 OK ATD*99# CONNECT - Create
/etc/chatscripts/quectel-chat-disconnectfile:ABORT "ERROR" ABORT "NO DIALTONE" SAY "\nSending break to the modem\n" "" +++ "" +++ "" +++ SAY "\nGoodbye!\n" - Create
/etc/ppp/peers/gprs/dev/ttyAMA0 115200 connect 'chat -s -v -f /etc/chatscripts/quectel-chat-connect -T <$APN>' disconnect 'chat -s -v -f /etc/chatscripts/quectel-chat-disconnect' hide-password noauth debug defaultroute noipdefault novj novjccomp noccp ipcp-accept-local ipcp-accept-remote local lock modem dump nodetach nocrtscts remotename 3gppp ipparam 3gppp ipcp-max-failure 30 usepeerdns
Usage
- To power-up the Shield using the GPIO pins, use this Python script:
#!/usr/bin/env python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(26, GPIO.OUT) GPIO.output(26, True) time.sleep(2) GPIO.output(26, False) GPIO.cleanup() - Initiate GPRS call to connect to the internet:
pppd call gprs &
Optional
- Make the PPP connection the default route (optional):
route del default route add default dev ppp0 - Disconnect the PPP connection:
kill -9 `pidof pppd`
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.