Saturday, January 19, 2013

GPIO Bit extender: Playing With Buttons

Overview

My background is pure software.  To be able to manipulate the virtual world (software) using the physical world (hardware), for me is exciting and new.  I wanted to share my experiences and get some feedback.

Goal

Manipulate relays using buttons.
Button 1 - activates relay 6
Button 2 - activates relay 7
Button 3 - deactivates all relays

Preparing your Raspberry Pi

  1. Download and install the latest Raspbian distro.
  2. Follow the instructions here.
  3. Connect your MCP23017 like here and test basic functionality using i2cdetect.
Nathan Chantrell does an excellent job of expaining how to use the MCP23017 here.

Schematic

For the sake of simplicity of the diagram I used LEDs, but my actual circuit used an 8 channel relay module where channel 6 and 7 are connected in place of the LEDs.


Script