A very simple, silly utility which monitors the Bluetooth interface of a Pwnagotchi and cleanly shuts it down on receiving a command from a mobile phone.
Relies upon the Bluedot Python module and Android app to function.
What I was trying to do is shut my Pwnagotchi off without just yanking the power and gambling with corrupting the microSD card every time. Rather than shoehorn in a button to connect to the GPIO pins and figure out which ones weren't being used by the display I have I decided to make use of the Bluetooth interface on my mobile.
The instructions are simple:
- Install the Python 3 virtualenv utility.
sudo apt-get update
sudo apt-get install python-virtualenv
- Install the utility.
- Clone this repo onto your Pwnagotchi.
cd pwnagotchi-bt-power'
python3 -mvenv env
. env/bin/activate
pip install bluedot
- Set the utility to start up on boot.
- I use GNU Screen for this. I've included the
bluetooth-power.sh
script to make life easier for you. - Be sure that the startup script runs as the root user!
- I use GNU Screen for this. I've included the
- Pair your phone with your Pwnagotchi.
- RasPi
sudo bluetoothctl
- Type the following commands one at a time:
discoverable on
pairable on
agent on
default-agent
- Phone
- Settings -> Connections
- Make sure Bluetooth is turned on.
- Bluetooth (tap on the word not the switch)
- Tap on your RasPi in the list.
- RasPi:
- 'yes'
quit
- RasPi
- Reboot your Pwnagotchi.
To shut down your Pwnagotchi:
- Open the Bluedot app on your phone.
- Tap on your Pwnagotchi in the list.
- Tap the big blue button.