Raspberry Pi - John Jay's 8 LED & Button Breakout Board
Overview
Shopping List
Parts for Optional Ribbon Cable & Connector (below)
- 1 @ 26P ribbon cable (1 meter or less)
- 2 @ 26P female IDC connectors (press-fit)
- 1 @ 26P box header IDC male sockets (right angle or straight)
Tools
- Wire snips (Hakko CHP170 Micro Cutter, 16AWG Clean Cut)
- Solder Iron (Weller WLC100 40-Watt Soldering Station)
- Solder (lead-free)
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.