Scripts based on this description:Setup wwan0 interface for 4G network
- Raspberry Pi 3B+
- Waveshare 4G hat SIM7600e-H
- SIM card (standard size 15 x 25mm preferable)
4G hat conneted to Raspberry via USB, the folowing devices are created:
/dev/ttyUSB1
- for communication with GPS part (NMEA protocol), 9600 bod default
/dev/ttyUSB3
- main communication port, AT commands, 115200 bod default
- scripts were tested with DietPi and Linux 4.19.75-v7+
- QMI driver is used to communicate with modem (packets
libqmi-utils
,udhcpc
) - packets
gpsd
,gpsd-clients
,python-gps
for the GPS use
start_lte.sh - bash script that disable WiFi interface and configures LTE as wwan0, also prints information configure_gps.py - Python 3 script that configure SIM7600 for GPS (uses pyserial module)
- Provider information
This part of script contains provider information ans should be changed to meet actual requirements (enter APN, Username and Password).
Example for Megafon (Russia):
sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='internet',username='gdata',password='gdata',ip-type=4" --client-no-release-cid
Example for TELE2 (Russia):
sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='internet.TELE2.ru',ip-type=4" --client-no-release-cid
NOTE: Many cellular operators block modem devices when that works with regual SIM cards. Please ensure that you're use proper plan and your SIM card suitable for modem use.
-
Run Python 3 script
configure_gps.py
to enable GPS output on SIM7600 -
Check that gpsd daemon is not running:
sudo lsof -i :2947 #find process that uses gpsd port
sudo lsof | grep ttyU #find process that uses ttyUSB
- One can disable startup service configuration for the
gpsd
on Raspberry Pi by
sudo update-rc.d gpsd disable #disable boot service
Reboot is needed after changing configuration.
- Run
gpsd
daemon with custom configuration. Please also check this guide
sudo gpsd -n -N -D9 -F /dev/ttyUSB1
This command prints debug output that you can check for possible errors. It uses standart input for PPS signal, but you can change it by
sudo gpsd -n -G -N -D9 -F /var/run/gpsd.sock /dev/ttyUSB1 /dev/pps0
and add this lines to /DietPi/settings.txt
file (not tested yet):
dtoverlay=pps-gpio,gpiopin=18 tp
where GPIO18 - Raspberry Pi pin for PPS signal. You can test PPS by command
sudo ppstest /dev/pps0 #(require packet pps-tools)
- View GPS information by
gpsmon /dev/ttyUSB1 # view GPS