Merge pull request #11 from sixfab/dev

Tracker HAT added to the ppp installer
This commit is contained in:
saeedjohar 2019-10-09 13:59:49 +03:00 committed by GitHub
commit 3b7326a85f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# Sixfab_PPP_Installer # Sixfab_PPP_Installer
Repository of Sixfab PPP Installer Tool Repository of Sixfab PPP Installer Tool
Sixfab offers Shields for Raspberry Pi which provides cellular Internet connection anywhere with the availability of mobile network coverage. These shields are: Sixfab offers Shields/HATs for Raspberry Pi which provides cellular Internet connection anywhere with the availability of mobile network coverage. These shields are:
* [Raspberry Pi GSM/GPRS Shield](https://www.sixfab.com/product/gsmgprs-shield/) * [Raspberry Pi GSM/GPRS Shield](https://www.sixfab.com/product/gsmgprs-shield/)
@ -11,6 +11,7 @@ Sixfab offers Shields for Raspberry Pi which provides cellular Internet connecti
* [Raspberry Pi Cellular IoT HAT ](https://sixfab.com/product/raspberry-pi-lte-m-nb-iot-egprs-cellular-hat/) * [Raspberry Pi Cellular IoT HAT ](https://sixfab.com/product/raspberry-pi-lte-m-nb-iot-egprs-cellular-hat/)
* [Raspberry Pi Tracker HAT ](https://sixfab.com/product/raspberry-pi-gprs-gps-tracker-hat/)
Each of these shield can be connected to Internet via PPP(Point to Point Protocol). For this tutorial we have written an script to install and perform required steps. Each of these shield can be connected to Internet via PPP(Point to Point Protocol). For this tutorial we have written an script to install and perform required steps.
@ -50,12 +51,14 @@ Then it asks if your carrier needs username and password.
`Enter username` `Enter username`
If yes then it will ask for user name. If yes then it will ask for user name.
`Enter password`
Then it will ask for password.
Once you type the username asks for password. Once you type the username asks for password.
`Enter your PORT name` `What is your device communication PORT? (ttyS0/ttyUSB3/etc.`
In this step you will enter your PORT. For 3G, 4G/LTE Base Shield it will be ttyUSB3. In this step you will enter your PORT. e.g For 3G, 4G/LTE Base Shield it will be ttyUSB3.
`Do you want to activate auto connect/reconnect service at R.Pi boot up?` `Do you want to activate auto connect/reconnect service at R.Pi boot up?`

View File

@ -10,6 +10,7 @@ echo "${YELLOW}1: GSM/GPRS Shield${SET}"
echo "${YELLOW}2: 3G, 4G/LTE Base Shield${SET}" echo "${YELLOW}2: 3G, 4G/LTE Base Shield${SET}"
echo "${YELLOW}3: Cellular IoT App Shield${SET}" echo "${YELLOW}3: Cellular IoT App Shield${SET}"
echo "${YELLOW}4: Cellular IoT HAT${SET}" echo "${YELLOW}4: Cellular IoT HAT${SET}"
echo "${YELLOW}5: Tracker HAT${SET}"
read shield_hat read shield_hat
case $shield_hat in case $shield_hat in
@ -17,6 +18,7 @@ case $shield_hat in
2) echo "${YELLOW}You chose Base Shield${SET}";; 2) echo "${YELLOW}You chose Base Shield${SET}";;
3) echo "${YELLOW}You chose CellularIoT Shield${SET}";; 3) echo "${YELLOW}You chose CellularIoT Shield${SET}";;
4) echo "${YELLOW}You chose CellularIoT HAT${SET}";; 4) echo "${YELLOW}You chose CellularIoT HAT${SET}";;
5) echo "${YELLOW}You chose Tracker HAT${SET}";;
*) echo "${RED}Wrong Selection, exiting${SET}"; exit 1; *) echo "${RED}Wrong Selection, exiting${SET}"; exit 1;
esac esac
@ -59,7 +61,7 @@ if [ $? -ne 0 ]; then
echo "${RED}Download failed${SET}" echo "${RED}Download failed${SET}"
exit 1; exit 1;
fi fi
:'
while [ 1 ] while [ 1 ]
do do
echo "${YELLOW}Do you have updated kernel? [Y/n] ${SET}" echo "${YELLOW}Do you have updated kernel? [Y/n] ${SET}"
@ -74,7 +76,7 @@ do
*) echo "${RED}Wrong Selection, Select among Y or n${SET}";; *) echo "${RED}Wrong Selection, Select among Y or n${SET}";;
esac esac
done done
'
echo "${YELLOW}ppp install${SET}" echo "${YELLOW}ppp install${SET}"
apt-get install ppp apt-get install ppp
@ -143,23 +145,28 @@ do
case $auto_reconnect in case $auto_reconnect in
[Yy]* ) echo "${YELLOW}Downloading setup file${SET}" [Yy]* ) echo "${YELLOW}Downloading setup file${SET}"
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_service -O reconnect.service wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_service -O reconnect.service
if [ $shield_hat -eq 1 ]; then if [ $shield_hat -eq 1 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_gprsshield -O reconnect.sh wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_gprsshield -O reconnect.sh
elif [ $shield_hat -eq 2 ]; then elif [ $shield_hat -eq 2 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_baseshield -O reconnect.sh wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_baseshield -O reconnect.sh
elif [ $shield_hat -eq 3 ]; then elif [ $shield_hat -eq 3 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot_app -O reconnect.sh wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot_app -O reconnect.sh
elif [ $shield_hat -eq 4 ]; then elif [ $shield_hat -eq 4 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot -O reconnect.sh wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_cellulariot -O reconnect.sh
elif [ $shield_hat -eq 5 ]; then
wget --no-check-certificate https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/reconnect_tracker -O reconnect.sh
fi fi
mv reconnect.sh /usr/src/ mv reconnect.sh /usr/src/

View File

@ -0,0 +1,30 @@
#!/bin/sh
gpio -g mode 23 in #status
gpio -g mode 24 out #powerkey
gpio -g mode 17 out #disable
# enabling the power of the HAT
gpio -g write 17 1
sleep 1
gpio -g write 17 0
while true; do
if [ $(gpio -g read 23) = "0" ]; then
echo "Power up"
gpio -g write 24 1
sleep 2
gpio -g write 24 0
sleep 2
else
ping -q -I ppp0 -c 1 8.8.8.8 -s 0 >/dev/null
if [ $? -ne 0 ]; then
echo "Connection down, reconnecting..."
sudo pon
fi
fi
sleep 10
done