Bop It! Pi is a game made for the Raspberry Pi, built on the Processing Programming Language and that makes use of the board's General Purpose Input and Output (GPIO) pins. It was inspired by Bop It! Smash, a toy made by Hasbro.
The game consists on trying to get the greatest score you can without losing your lives on doing it. The LEDs will flash like a ball bouncing from side to side. You need to press two keys on your keyboard or press both of the connected push buttons to catch it. The yellow and red LEDs make you lose a heart, while the blue LED (the one in the center) recovers one. The score you get for each catch also depends on the color of the LED where the "ball" stops on. Ideas for a new game mechanic? Questions? You can report them to me here!
- A Raspberry Pi of any model (the one shown in the tutorial will be the Raspberry Pi Model 2 v1.1);
- A double-sided breadboard*;
- 2 red LEDs**;
- 2 yellow LEDs**;
- 2 green LEDs**;
- 1 blue LED**;
- 7 330ohm resistors;
- 11 male to female jumper wires (3 of them are optional);
- 9 male to male jumper wires (2 of them are optional);
- The Processing code available here;
- 2 push buttons (optional).
* You can manage to build the circuit on a single-sided breadboard as well, but the explanation will be based on a double-sided one.
** The LEDs don't need to necessarily be red, green, yellow and blue. The only thing that matters is wether not you arrange them properly. You can also edit the code to add more LEDs to the project, remove some of them if the ones you have aren't enough or maybe even edit their conections with the GPIO interface.
Circuit images made with Fritzing. You can click them to see them in full screen or you can see all of the tutorial files here.
1. Be sure your Raspberry Pi is working, turn it off and grab your breadboard. | |
2. Simetrically place the LEDs on the bottom side of your breadboard with their anode legs (the short ones) to the right. | |
3. Using a male to female jumper wire, make a connection between any ground pin on your Raspberry Pi and the negative (blue) column on your breadboard. | |
4. Use male to male wires to connect the anode legs (the ones on the right) of the LEDs to the negative column of the breadboard. | |
6. Use all of the 7 resistors to connect the cathode legs (the ones on the left) of the LEDs to any hole on the line on top of the one where your LED cathode is connected to on your breadboard. | |
5. On the same lines, connect the resistors to your Raspberry Pi in the following order (go from the extreme left resistor to the extreme right one):
| |
7. Once you have the Processing code on your computer, make sure you've installed Processing for Pi and run the files for the game itself. Alternatively, if you don't want to edit the code anytime soon, you can run the exported application available here without needing to install Processing itself. | |
8. It's done! Congratulations, you did it! I hope you enjoy it a lot! Feel free to make a question and to help me develop this project even more! If you need help playing the game, check out the how to play section! |
If you want to, you can use push buttons instead of keys to play the game. Below is a tutorial showing you how to put them on your circuit.