Raspberry Pi Power Switch Cap Installation

Power switch Shut down script

The ProdBoard has an onboard power switch using the the same design as Nanomesher Hackable Raspberry Pi Power Switch

For software installation, please one of the following:

Samples Code

Examples are here.

In order to use the examples, you will need to install the following dependent libraries.

Python GPIO

sudo apt-get install python-dev python-rpi.gpio

Luma.OLED Python Library – For OLED display

Hackable Pi Switch Cap uses i2c OLED display with ssd1306 driver.

Library Info: https://pypi.python.org/pypi/luma.oled
Install Instructions: http://luma-oled.readthedocs.io/en/latest/install.html

More display examples from Luma.OLED: https://github.com/rm-hull/luma.examples

LIRC library

LIRCDemo.py required LIRC to be installed.

To be able to run the example, do the following (assuming Raspbian):

  • Install LIRC

sudo apt-get install lirc

  • In /boot/config.txt, add/edit the following line
dtoverlay=lirc-rpi,gpio_in_pin=17
  • Setup for i2c communications with display and LIRC for infrared in /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.
i2c-dev
lirc_dev
lirc_rpi gpio_in_pin=17 
  • If using Raspbian Stretch, in /etc/lirc/hardware.conf , add/edit the following line

LIRCD_ARGS=”–uinput –listen”
LOAD_MODULES=true
DRIVER=”default”
DEVICE=”/dev/lirc0″
MODULES=”lirc_rpi”

  • If using Raspbian Stretch, in /etc/lirc/lirc_options.conf, add/edit the following line
[lircd]
nodaemon        = False
#driver          = devinput
#device          = auto
driver          = default
device          = /dev/lirc0
  • Copy files from https://github.com/nanomesher/Nanomesher_PiSwitchCap/tree/master/lirc to /etc/lirc/ 
cd ~

git clone https://github.com/nanomesher/Nanomesher_PiSwitchCap.git

cd ~/Nanomesher_PiSwitchCap/lirc

sudo cp -rT ~/Nanomesher_PiSwitchCap/lirc /etc/lirc
  • Reboot
  • Test your lirc set up with irw and pressing your remote buttons

 

  • Install LIRC python library: https://pypi.python.org/pypi/python-lirc/  or use this method if you dont want to use python-lirc.

#For python 3.x, Raspbian Jesse or earlier

sudo apt-get install python3-lirc

 

#For python 2.x, Raspbian Jesse or earlier

sudo apt-get install python-lirc

 

#For python 3.x, Raspbian Stretch
wget https://github.com/tompreston/python-lirc/releases/download/v1.2.1/python3-lirc_1.2.1-1_armhf.deb
sudo dpkg -i python3-lirc_1.2.1-1_armhf.deb

 

#For python 2.x, Raspbian Stretch
wget https://github.com/tompreston/python-lirc/releases/download/v1.2.1/python-lirc_1.2.1-1_armhf.deb
sudo dpkg -i python-lirc_1.2.1-1_armhf.deb

Examples

LEDDemo.py - Blink the onboard LED Twice
OLEDDisplayDemo.py - Display IP addresses on the OLED

Weather Pack

Weather Pack composed of two i2c sensors:

  • BOSCH BMP180 Pressure Sensor – Data Sheet
  • SENSIRION SHT31 Humidity and Temperature Sensor – Data Sheet

Solder the sensors as shown below:

These python libraries are recommended to read sensors values: