Camble / GBZ-Power-Monitor_BG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GBZ-Power-Monitor v1.0a

BangGood/Generic edition

Background

Currently in the GBZ, the power switch works like a normal On/Off switch. The only problem is when you cut the power, it's kinda hard on the system. There's no clean dismounting of the drives. It's really just like yanking the power out. And that's been known to cause corrupted files and disks.

Required Hardware and Components

  • Raspberry Pi Zero (or Model B+, Raspberry Pi 2 and Pi 3)
  • A BangGood/GearBest power supply module or alternative
  • Safe Shutdown PCB (BangGood Edition)
  • A mini DPDT slide switch (SK-22H07 included with Safe Shutdown PCB) or an original DMG slide power switch.

Dependencies

  • Retropie 3.7+ or latest Raspbian
  • Python 2.7 and Python Module RPi.GPIO (comes installed with Retropie 3.7)
  • omxplayer (comes installed with Retropie 3.7)
  • Must be run as a sudoer user (the default Pi user on Retropie 3.7 is a sudoer)

Installation

You will need to connect the PI Zero to Wifi and from another computer on the same WiFI network, SSH in (or use Putty on PCs):

ssh pi@retropie.local

Default password is 'raspberry'. At the command prompt, edit the /boot/config.txt file:

sudo nano /boot/config.txt

Add the following line:

dtoverlay=gpio-poweroff,gpiopin=22,active_low="y"

Press Ctrl+X to exit, hit Y to save and press return.

Next at the command prompt, copy this monitor and the video assets with the following command:

cd ~;git clone https://github.com/Camble/GBZ-Power-Monitor_BG.git

Now, launch the Monitor manually and test that it's working properly

python ~/GBZ-Power-Monitor_BG/gbz_power_monitor.py

Once you are satified that the monitor behaves properly, add the monitor to the startup process to complete the installation and then reboot to make it live.

echo "@reboot /usr/bin/nice -n 19 /usr/bin/python ~/GBZ-Power-Monitor_BG/gbz_power_monitor.py" >> mycron; crontab mycron;rm mycron

Keeping Up-to-Date

You can make sure you have the latest updates by issuing this command

cd ~/GBZ-Power-Monitor_BG;git pull origin master

Video Examples

https://www.youtube.com/watch?v=TRkEfD04unk Low Battery Warning

https://www.youtube.com/watch?v=nRJ42oSrIg4 Power Switch test

Links

More detail can be found on this thread: http://sudomod.com/forum/viewtopic.php?f=8&t=97

Pre-order thread for Safe Shutdown Switch: http://sudomod.com/forum/viewtopic.php?f=3&t=1293

Guide to creating a Safe Shutdown Switch of your own: http://sudomod.com/forum/viewtopic.php?f=22&t=1059

Feel free to contact me on the Sudomod forums (www.sudomod.com/forum) or on the Sudomod Discord channel (https://discordapp.com/channels/188359728454303744/188359728454303744)

About


Languages

Language:Python 100.0%