"He's a Keeper" is my first electrical engineering project. As a huge fan and player of soccer, it's been tough to deal with COVID 19 restrictions that limit us from playing with others. While some may still be able to kick the ball around, goalkeepers especially are having a hard time training on their own. So, using the basics that I learned in ENGI301, I built a simple goalkeeper reflex training game based on the classic Whac-a-mole game.
Game Summary:Upon the start of the game, the display and buzzer will give the user a countdown from 3. Then, one of the five buttons will light up randomly. The goal is to hit the randomly lit button as quick as possible. The game won't move on to the next round until the correct button is hit. After 20 rounds, the display will show the average time taken to hit the correct button. Best of luck!
Hardware for He's a Keeper Game:Building the He's a Keeper game involves connecting 5 arcade buttons, LEDs, a buzzer and a 4 x 7-segment display to a PocketBeagle building a complete I/O system. Use the configure_pins.sh file (code attached) and the pin diagram below to connect all devices to the PocketBeagle.
Each of the 5 buttons is embedded into a simple PLA 3D-printed enclosure with suction cups attached to the bottom using hot glue. This allows the user to attach buttons on vertical surfaces too, as long as it's smooth.
Connecting Arcade ButtonsConnecting the buttons can be a little bit tricky. Each button comes with 4 pins. 2 pins connected to the grey plastic are what read the button status, and the other 2 on the side control the LED output. The buttons require a 1kOhm pull-up resistor to function properly. Make sure to check the anode and cathode of the LEDs aren't swapped!
I recommend using the following code in the command line to check if the button is connected properly. Insert the appropriate gpio number in XX
Button:
cd /sys/class/gpio/gpioXX
echo "in" > direction
cat value #returns 1 by default, 0 when pressed
LEDs:
cd /sys/class/gpio/gpioXX
echo "out" > direction
echo "1" > value #turns the LED on
Once the PocketBeagle is communicating with the buttons, all you have to do is put it in the enclosure. Putting the enclosure together should be pretty straightforward.
1) Insert button through hole on top, screw in from other side.
2) Pass 2 quick-connect wire pairs through the slit designed for wires.
3) Connect quick-connect wire pairs to button pins and LED pins.
4) Slide in the bottom lid and twist to lock!
Each button is connected to the PocketBeagle through arcade button quick-connect wires then jumper wires. The buttons are placed close together in the demonstration video for visibility. But, depending on the user's wingspan or to adjust the difficulty of the game, users may attach extra male-female jumper wires to position the buttons further away from each other. Be careful to not pull the wires with force as it may undo jumper wire connections.
Instructions for Playing He's a Keeper Game:1) Plug the PocketBeagle microUSB into a power source (either a laptop or 5V USB adapter)
2) Wait for the PocketBeagle to boot
3) Unless you set the game to auto-run, move to the directory of the Whack-a-Mole game code and use the run script which will configure the pins and start the game.
Code Setup:All code is attached in the repository. All code is written in Python.
Software Setup:
- Unzip the software packages into a directory
- Make sure to save project_01, buzzer, and ht16k33 folders in the same directory.
- Change the permissions on the run script:
chmod 755 run
chmod 755 configure_pins.sh
- Run the game:
sudo ./run
Comments
Please log in or sign up to comment.