Programming your Pi

Just like the ATXRaspi, the MightyHat can issue a reboot/shutdown to your Pi. The way this works is via 2 GPIO connections from/to the Pi:

  • BOOTOKfrom MightyHat’s A6 to Pi’s GPIO8 (pin #24). This pin allows the MightyHat to know your Pi’s status and when your Pi has fully booted.
  • SHUTOFF¬†from Pi’s GPIO7 (pin #26) to¬†MightyHat’s A3. This pin allows the MightyHat to request either a reboot (short HIGH pulse) or shutdown (permanent HIGH) to the Pi.

To allow this functionality to work you need to install a script that run’s on the Pi after boot is complete and does two things:

  • asserts BOOTOK signal to HIGH so the MightyHat knows the Pi is booted OK and ready for a reboot/shutdown command
  • listens to SHUTOFF for a reboot or shutdown from the MightyHat

The required script for the Pi is the same as the one used in ATXRaspi. If you use the PiGateway install, there is a step which allows you to install the script automatically (MightyHat should be connected to the Pi at that time). Otherwise please check this ATXRaspi guide page for installation steps with a standalone MightyHat (without or after the PiGateway setup).

The physical button with integrated red/green LEDs on the MightyHat, can control all of this functionality as seen in the MightyHat sketch. It can enable power to flow to the Pi, issue the reboot/shutdowns (if BOOTOK=HIGH) and forcefully cut off power even if the BOOTOK is LOW. The default behavior of this button is as follows:

  • reboot the Pi – press and hold for less than 1 second. Button red LED starts to blink and waits until Pi reboots and BOOTOK=HIGH, at which point it becomes green again.
  • shutdown the Pi – press and hold for more than ~2 seconds. Button red LED starts to pulse and waits until BOOTOK=LOW, then cuts power shortly afterwards.
  • a short button press (re)powers the Pi.