Contributions

Contributions are appreciated and used to host this site. Thank You for your support.

Feature Products
  • Raspberry Pi with Java: Programming the Internet of Things (IoT)
    Raspberry Pi with Java: Programming the Internet of Things (IoT)
  • Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU
    Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU
  • Premium Clear Case for Raspberry Pi 2 Model B Quad Core and Raspberry Pi Model B+ (B PLUS)
    Premium Clear Case for Raspberry Pi 2 Model B Quad Core and Raspberry Pi Model B+ (B PLUS)
  • Edimax EW-7811Un 150 Mbps Wireless 11n Nano Size USB Adapter with EZmax Setup Wizard
    Edimax EW-7811Un 150 Mbps Wireless 11n Nano Size USB Adapter with EZmax Setup Wizard
  • Getting Started with Raspberry Pi
    Getting Started with Raspberry Pi
  • Raspberry Pi User Guide
    Raspberry Pi User Guide
  • PiBrella LED Add On Board
    PiBrella LED Add On Board
  • Diversitech® WS-1 - Wet Switch Flood Detector
    Diversitech® WS-1 - Wet Switch Flood Detector
  • Onsite Pro FS1NPTW Whole Home Wireless FloodStop with 1 Inch Valve
    Onsite Pro FS1NPTW Whole Home Wireless FloodStop with 1 Inch Valve
  • Floodstop Washing Machine Valve Shutoff Kit
    Floodstop Washing Machine Valve Shutoff Kit
  • Onsite Pro FS3/4H Washing Machine FloodStop with Straight Valves
    Onsite Pro FS3/4H Washing Machine FloodStop with Straight Valves
  • Floodstop Individual Water Appliance Additional Water Sensor XS-01
    Floodstop Individual Water Appliance Additional Water Sensor XS-01
  • Aqua Managers - FS 1 1/4-NPT - Floodstop for Water Heaters Water Leak Detection System - White - 1.25 in. pipe
    Aqua Managers - FS 1 1/4-NPT - Floodstop for Water Heaters Water Leak Detection System - White - 1.25 in. pipe
  • Furman MP-20 Power Relay Accessory, 20 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
    Furman MP-20 Power Relay Accessory, 20 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
  • Furman MP-15 Power Relay Accessory, 15 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
    Furman MP-15 Power Relay Accessory, 15 Amp, Two Outlets, Remote Turn-on from Momentary or Maintained Contact Switches
  • Metra 70-2002 Radio Wiring Harness for Saturn 00-05
    Metra 70-2002 Radio Wiring Harness for Saturn 00-05
  • Metra Reverse Wiring Harness 71-2002 for Select 2000-2005 Saturn Vehicles OEM Radio
    Metra Reverse Wiring Harness 71-2002 for Select 2000-2005 Saturn Vehicles OEM Radio

Entries by Robert Savage (60)

Wednesday
Dec052012

Raspberry Pi - John Jay's 8 LED & Button Breakout Board

Overview

In a previous article I demonstrated how to build your own Raspberry Pi GPIO testing board that included buttons, slide switches, and LEDs.  Since that time, I learned about a retired engineer in Georgia named John Jay who is producing awesome little companion electronic boards and kits for the Raspberry Pi.  The boards are available as DIY kits and/or fully assembled boards.   The kits are very reasonably priced and are available now on eBay.  Click here to see John Jay's eBay listings.  One of Mr. Jay's kits is an 8 button / 8 LED GPIO button breakout board.  Using this kit is certainly easier than acquiring all the individual electronic components and building the board on your own.  
I made one slight modification to the kit so that I could connect the breakout board to my Raspberry Pi via a 26 pin ribbon cable. 

Shopping List

Parts for Optional Ribbon Cable & Connector (below)

Tools

Assembly


Assembly instructions can also be found on John's website: http://mypishop.com/Pi%208%20LED%20&%208%20Button.html

The kit includes the following components:

  • 1 @ printed circuit board
  • 8 @ green LEDs
  • 8 @ momentary/normally-open pushbutton micro-switches
  • 2 @ resistor networks
  • 1 @ 26 pin PCB mount female header
    (not pictured)
  • 1 @ peel-and-stick on rubber bumper 
    (not pictured) 

 

 In addition to the parts provided in the kit, I also used a right-angle 26P male box header socket for connecting a 26P ribbon cable to the Raspberry Pi.

 

 


TIP
:  Click any image to enlarge and view a high-resolution photo. 

STEP 1 > Insert the 26P male header socket in the position at the edge of the board and then solder the pins in place on the bottom side of the board.  NOTE:  If you are not using this optional IDC box socket connector and you are using the supplied female header, then be aware that it should be mounted to the bottom of the board and soldered in place on the top.

  

 

STEP 2 > Insert one of the A102J resistor networks into the RP1 position on the top of the board.  Solder in place on the bottom of the board.  You can bend the pins over to help hold the component in place while you solder. 

 

STEP 3 > Insert the second A102J resistor network into the RP3 position on the top of the board.  Solder in place on the bottom of the board.  

 

STEP 4 >  Next we will install the 8 LEDs.  The LEDs have a short lead (cathode) and long lead (anode).  The long lead (anode) should be insterted into the hole closest to the 26 pin header connector.  See the photos below to make sure you have them in the correct orientation. 

 

Insert the 8 LEDs in position and then carefully flip the board and solder each LED in place.  TIP:  You may find it easier to solder just one lead of each of the LEDs and then check the LEDs from the top and adjust any for final positioning.    

After soldering each of the LEDs use a pair of wire snips to trim the excess lead wires. 

 

STEP 5 >  Next we will install the momentary buttons.  Each button has four pins that will insert into the board.  Press each switch in place firmly to fully seat the switch.  


Once the switches are placed, flip the board and solder each of the pins on all the switches. 

 

That's it.  Now you have a complete assembled board ready for use with your Raspberry Pi.  

Logic

The 8 LEDs are controlled by positive 3.3 VDC TTL voltage on each of the corresponding GPIO pins.  Setting a GPIO pin to HIGH will cause the LED to turn ON and setting a GPIO pin to LOW will turn the LED OFF.

When depressing one of the 8 input buttons, the closed circuit will provide a ground drain for the GPIO pin thus causing it to go LOW.  When an input button is not depressed the circuit on the GPIO pin will remain floating; therefore, each of the GPIO pins used with these buttons should be configured to set their internal resistors to pull up.  In software, this means that the button will remain in the HIGH state when it is not pressed and will go LOW while a button is pressed.

LED Wiring Diagram

The 8 LEDs are mapped to the P1 header on the Raspberry Pi as depicted in the diagram below.

Button Wiring Diagram

The 8 buttons are mapped to the P1 header on the Raspberry Pi as depicted in the diagram below.

GPIO Pin Cross-Reference Chart

Below is a cross reference chart to better help define the GPIO pin numbers used for each button and LED.

C Sample Program

If you are interested in native C sample code, please check out this article on Gordon's Project Blog:
https://projects.drogon.net/more-buttons-and-leds/ 

Gordon provides a sample program based on the WiringPi library.

Python Sample Program

The following Python source example was provided by John Scuteri
https://github.com/johnscuteri/OpenSourcedButtonBoardTest/blob/master/MyTestProgram.py

Java Sample Programs using Pi4J

Below is a sample Java program for monitoring the 8 buttons on this board. 

Below is a sample Java program for creating a cylon effect that cycles through the 8 LEDs on this board. 

Final Thoughts

Assembling this kit was simple and takes about 30 minutes.  This kit is a very convient tool to have on hand while testing and developing software for the Raspberry Pi.  This kit is also a very good educational kit to begin interacting with the Raspberry Pi's GPIO pins.