Instructables

Pandora's Box - An Internet Radio player made with a Raspberry Pi!

FeaturedContest WinnerContest Winner

Step 7: Connecting the Pushbuttons

Picture of Connecting the Pushbuttons
Front1.jpg
Each of the six pushbuttons needs a GPIO pin connection. The schematic shows a circuit that needs to be duplicated for each pushbutton. This circuit is useful since when the pushbutton is open, this arrangement does not drain any power. However, a logic "1" will be read on the GPIO pin, which is important to note. Also, the 1kOhm resistor on the GPIO pin is important in case the pin is set to output mode when the button is pressed. This would overdraw current on the pin, possibly burning it out. 

On the Revision 2 Pi, the six pushbuttons will connect to GPIO pins 2 (SDA), 3 (SCL), 4, 17, 27, and 22 (in order of vertical appearance on the Pi T-Cobbler). These pins are different for the Revision 1 boards; the pin changes can be found at the low-level peripherals link from the previous step.

EDIT: Since pins 2 and 3 on the Revision 2 board have pull-up resistors on them, the circuit I have shown is unnecessary (and may not function properly). You can simply connect the pushbutton between the GPIO pin and GND. 

The box has six buttons. In the picture, they they are attached from left to right in the pin order given above. The functions are:
1) Change Song
2) Change Station
3) Volume Down
4) Volume Up
5) Pause/Play
6) Menu/Shut Down

Button six has a dual function. If pressed momentarily, it brings up a Menu. If held for more than two seconds, it shuts down the Operating System. Once the Menu is open, new button functions are available. They are:
1) Like the current song
2) Dislike the current song (also skips to the next song)
3) Display the Pi's IP
4) Nothing (yet...)
5) Nothing (yet...)
6) Exit the Menu

Displaying the IP was added to make SSH access easier.
 
Remove these adsRemove these ads by Signing Up