This project is in tandem with the efforts of Open Learning Exchange in setting up the Raspberry Pi server via USB tethering from an Android device. It is but one leg on the greater project which will be here.
Current documentation until it gets added here verbosely.
Raspberry Pi scripts are available inside /extra
Download and run the scripts on your Raspberry Pi all at once with the following commands, or follow the steps in the documentation that follows:
wget 'https://raw.githubusercontent.com/zeivhann/piiper/master/extra/piiper-prep.sh'
sudo bash piiper-prep.sh
You will want your Raspberry Pi to be configured to automatically accept USB tethering. This will enable you to headlessly use your device.
NOTE: You may also download this script to automatically do these steps for you. Just
cd
into where you downloaded the file and runsudo ./auto-usb-tethering
sudo nano /etc/network/interfaces
Add this to the end of the file to add in the entry for usb0 and allowing automatic USB tethering.
# Enable automatic USB tethering
allow-hotplug usb0
iface usb0 inet dhcp
Then restart the Pi or restart the networking service with:
sudo /etc/init.d/networking restart
Test your connection with ifconfig
to check if usb0 is up and running with a valid IP and try a ping -c 3 google.com
.
Your RPi is now ready for automatic USB tethering.
NOTE: You may also download this script to automatically do these steps for you. Just
cd
into where you downloaded the file and runsudo ./piip-install
.
This should return proper ip address, or if the third part is left out ( the grep
call), we can generate a list of each one:
# Creates the RPi IP and assigns it to a variable
PIIP=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e' | grep 192)
# Make the variable an environmental variable so that child shells may use it
export PIIP
Alternatively, create a script:
#piip.sh
PIIP=$(ifconfig | perl -nle 's/dr:(\S+)/print $1/e' | grep 192)
echo $PIIP
And then to make the system available on the system, we can do the following commands:
sudo cmod 755 piip
sudo mv /path/to/script.sh /usr/local/bin/piip
You can now universally use the piip
command to return the proper IP address of the Pi you need for SSH. This can be very beneficial when testing.
☑️ Detect if USB tethering is turned ON
☑️ Obtain IP address of the RaspberryPi
☑️ Connect automatically to it with the push of a button via SSH
☑️ Send custom commands from app and show output from console
🔳 Keep SSH session open and consistent like a standard terminal
🔳 Add more sophisticated listener for tethering detection
🔳 Improve and clean up simple UI
🔳 Automate prescripted SSH commands to complete setup process (OLE - RPi)