Skip to content

Instantly share code, notes, and snippets.

@castironclay
Last active May 21, 2021 20:59
Show Gist options
  • Save castironclay/a23c92e30d53fa8685d0f22a3d554afd to your computer and use it in GitHub Desktop.
Save castironclay/a23c92e30d53fa8685d0f22a3d554afd to your computer and use it in GitHub Desktop.
Raspberry pi waveshare gsm/gprs/gnss/bluetooth
# Pi Setup
apt update -y
apt upgrade -y
## Install Dependencies
apt install gpsd gpsd-clients wget curl screen vim wireguard
## Modify /etc/default/gpsd
DEVICES="/dev/ttyUSB0"
## Modify /lib/systemd/system/gpsd.sock
## Reboot may be needed
rm /lib/systemd/system/gpsd.socket
cat << EOF >> /lib/systemd/system/gpsd.socket
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets
[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=0.0.0.0:2947
SocketMode=0600
[Install]
WantedBy=sockets.target
EOF
systemctl enable gpsd
## Kismet install Debian Buster
wget -O - https://www.kismetwireless.net/repos/kismet-release.gpg.key | sudo apt-key add -
echo 'deb https://www.kismetwireless.net/repos/apt/release/buster buster main' | sudo tee /etc/apt/sources.list.d/kismet.list
apt update
apt install kismet -y
## Reboot
reboot
## Check gps
systemctl status gpsd
cgps
## Add board power on file
rm /root/board_power.sh
cat << EOF >> /root/board_power.sh
#!/bin/bash
if [ ! -e /sys/class/gpio/gpio4 ]; then
echo "File exists."
echo "4" > /sys/class/gpio/export
fi
echo "out" > /sys/class/gpio/gpio4/direction
echo "0" > /sys/class/gpio/gpio4/value
sleep 2
echo "1" > /sys/class/gpio/gpio4/value
EOF
## Add provider file
rm /etc/ppp/peers/provider
cat << EOF >> /etc/ppp/peers/provider
# /etc/ppp/peers/provider
/dev/ttyS0 115200
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/chatscripts/chat-connect -T Wholesale'
# The close script
disconnect 'chat -s -v -f /etc/chatscripts/chat-disconnect'
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
persist
# Debug info from pppd
debug
# If you want to use the HSDPA 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
# For sanity, keep a lock on the serial line
lock
modem
dump
updetach
# Hardware flow control
nocrtscts
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 30
# Ask the peer for up to 2 DNS server addresses
usepeerdns
EOF
## Raspi-config modify
raspi-config
- Interface options
- Serial
- no to shell
- yes to serial
## Setup ppp
## https://sixfab.com/ppp-installer-for-sixfab-shield-hat/
wget https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_install_standalone.sh
sudo chmod +x ppp_install_standalone.sh
./ppp_install_standalone.sh
## Start/Stop
pon
poff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment