Skip to content

Instantly share code, notes, and snippets.

@seboudry
Last active April 1, 2020 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seboudry/3b66547328e54b053d2202e318e6ae25 to your computer and use it in GitHub Desktop.
Save seboudry/3b66547328e54b053d2202e318e6ae25 to your computer and use it in GitHub Desktop.
PluberryPi resource for shutdown and IR GPIOs

Setting up Shutdown and IR GPIOs

From PlusberryPi indiegogo uptade of Oct 24, 2015 at 10:02PM https://www.indiegogo.com/projects/plusberry-pi-media-box-running-on-raspberry-pi

There's also an Arch Linux AUR package https://github.com/sealor/aur-plusberrypi-shutdown

People are already getting their units, and ask about how to setup the GPIO connectors. Sorry for the "getting started" page not up and running yet, here are the instructions for now (the site will be up in the coming days).

Shutdown Pin

Basically, you can use any available input, but this example will use pin #24.

There is a connector with 3 wires (blue/black/green) coming from the left of the Plusberry board (it's labeled "UART").

Connect the BLUE wire to pin #24 according to the diagram -

plusberry-gpio-shutdown_iezy7mpsdipwftrklezu

When you press the power button (short press), the GPIO will go from high to low, signalling the RPi to shutdown.

Now, of course, you need to write a script to actually shutdown the RPi when getting the signal.

This is a sample script for OpenELEC, to put at /storage/.config/shutdown.sh:

#!/bin/bash

# monitor GPIO pin 24 (wiringPi pin 1) for shutdown signal
echo "24" > /sys/class/gpio/export
# export GPIO pin 24 and set to input with pull-up
echo "in" > /sys/class/gpio/gpio24/direction

# wait for pin to go low
while [ true ]; do
  if [ "$(cat /sys/class/gpio/gpio24/value)" == '0' ]; then
    echo "Raspberry Pi Shutting Down!"
    halt &
    exit 0
  fi
  sleep 1
done

Now, add it to autostart.sh, so the script will run when booting the system -

(
  /storage/.config/shutdown.sh &
)&

Setting up IR Remote

There are 3 wires (blue/black/green) coming from the IR sensor attached to the front of the box.

Connect these 3 wires according to the diagram -

plusberry-gpio-ir_qfaynuh5qjqzwamxv9lr

Now, setup the different key according to this tutorial http://wiki.openelec.tv/index.php/Guide_To_lirc_rpi_GPIO_Receiver

You can see a more complete list of key names here http://arnaud.quette.free.fr/lirc/lirc-nns.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment