Last summer I was learning how to use an Arduino and was fascinated by how button and LED matrices work; I wanted to use them in a cool project.
This year I came across nnmoadev's reBloc game which used the Adafruit Trellis to create a pattern memory game. I wanted to expand upon nnmoadev's game (made using the Tessel microcontroller and written using Javascript) to include two player functionality.
OverviewAfter starting up the game, the user will be guided to choose a two player or one player game mode by the LCD display. They can then choose the length of the patterns (between 4 and 10 presses).
In the one player mode, a pattern is randomly generated and the player will have to guess the pattern after being shown it briefly.
In the two player mode, one player will set a pattern while the other guesses it. After the guesser's attempt, the setter and guesser will swap. If the guesser successfully guesses the pattern, they will get the point. Otherwise, the setter gets the point.
Both players will duel until one of them reaches a score of 5
Demonstrationnote: In the videos, the "winning" score was set to 2. When you play it, it will be 5
One player demo
Two player demo
Setting Up The PocketBeagle1) Flashing the PocketBeagle
Download the following file: bone-debian-10.11-iot-armhf-2022-02-03-4gb.img.xz
With a programmable SD card inserted into your PocketBeagle, use an SD cad flasher like Etcher to flash the PocketBeagle with the file
2) Installing libraries
Follow the instructions on this page to connect your PocketBeagle to the internet
Check out the project's README file for step-by-step instructions on installing the required libraries and dependencies
Building the Game1)Buttons
Connect each button to the PocketBeagle as shown in figure 1. The resistor should be connected to Ground. The jumper wire to the GPIO pins should be connected to the button in parallel with the resistor
Connect the jumper wires to the following PocketBeagle pins:
Select Button: P2_22
Right Button: P2_20
Left Button: P2_18
Power rail: P2_23 (3.3V line)
Ground rail: P2_21
Test the functionality of the buttons by running the Button driver file
2)LCD Display
Connect the LCD Display to the PocketBeagle according to the diagram below:
It should end up looking like this:
Test the LCD by running the LCD Driver file
3) 7 Segment LEDs
Connect the first LED as shown below in Figure 4
Connect the SDA and SCL cables to the following PocketBeagle pins:
SDA: P2_11
SCL: P2_09
Power Rail: P2_23 (3.3V line)
Ground Rail: P2_21
Wire 2.2k Ohm pull-up resistors in parallel to the jumper wires. The resistors should be connected to the Power rail
Solder the A0 address on the second LED to "short" the connection so you can use the same I2C bus as shown in Figure 5
Connect the second LED's SCL and SDA pins in parallel with the jumper wires connecting the first LED's SCL and SDA pins as shown in Figure 6
Test the LEDs by running the LED Driver file
4)Trellises
Solder the LEDs onto both Trellises (be sure to solder the anodes and cathodes to the correct holes!).
Solder Jumper wires to the connection "fingers" on the trellises as shown in Figure 7.
Connect the jumper wires of Trellis 1 to the following PocketBeagle pins:
SDA: P1_26
SCL P1_28
5V: P1_14 (3.3V line)
GND: P1_16
Short the A0 address of Trellis 2 with solder as shown in Figure 8
5) Power
Connect the 5V power source to the PocketBeagle. The game will start when the PocketBeagle boots up. I hope you enjoy playing it :)
Current Project Drawbacks/bugsThe main bug with this project is the input I/0 error that occurs with the Trellis. This could be the an issue with the solder connections. Try to insulate your connections as much as possible to prevent shorting.
The use of the LEDs to display multiple pieces of information (pattern size, score etc.) can be confusing for new players.
The display of the messages on the LCD is not perfectly synced to the game
Future PlansI plan on designing a nice enclosure for the game and all the components in the near future. I will upload the CAD files here so stay tuned.
Give me feedback on any improvements that can be made to the game as well as additional features you would like to see; I will try implementing those too.
Comments
Please log in or sign up to comment.