Assistive Basketball Game
by mcconnbb in Circuits > Microcontrollers
242 Views, 4 Favorites, 0 Comments
Assistive Basketball Game
My goal for this project was to figure out a way to make basketball more accessible. I initially wanted to make a sort of basketball video game, but found that it would be difficult given the tools available in this class. I also tried making an apparatus that would shoot a basketball using a servo motor, but also found that to be too hard. Then, Jen Gemski of the Campus School was gracious enough to gift me the Electronic Arcade Basketball game. This gave me a great starting point and a lot of tools to make a fun and easy to use basketball game.
Supplies
- 64x32 LED array
- HUB75 cable
- 5V adapter
- Electronic Arcade Basketball
- 2 continuous servo motors
- Dark blue 1/8 inch acrylic sheets
- 2 of: APDS9960 proximity sensor, VL53L1X time of flight distance sensor
- Hamburger speaker
- Drill
- Super glue
- Saw
- Acrylic paint
- Wire cutters
- Wire strippers
Prepare the Basketball Game
I understand most people don't have access to this exact game, but I think the process can still be helpful to anybody interested. I first sawed off part of the top to give a flat base for my LED array. I then drilled holes in the front and back of the game to put wires through. The underside of the game has a hollow part that allows for wires to go from back to front.
Paint the Plastic Boards
In talking with the vision therapist, I found that it was very important that the features of the game stand out. The orange hoop already did a good job in contrasting with the blue background, but the tan "floor" boards were not very visible. I tried to fix this by painting them with neon colors over a black background. It ended up turning out really well and really popped.
Attach the LED Array
I did this in two parts. First, I designed a small stand for it to go on that would fit in nicely on the top of the game. Then, I superglued the pieces together. It's a very flexible but also stable design that should last a long time.
Wire Up the LED Array
The first step is powering the array. The array comes with a power cord and an adapter, but the two don't fit together. I had to cut off the ends of the wire, strip them, and screw them into the adapter. I banded the two red wires together into the positive end and banded the two black wires into the negative end. I then attached this to the 5V adapter I purchased. For wiring it into the Pico, the HUB75 cable made it relatively easy. It plugged right into the input end of the array. I was able to find the correct pins to plug the other HUB75 ends into with some help from my friend Jack.
Design the Servo Stands and Arms
I wanted to make the servo stands easy to use for anyone who wanted to try. I ended up on a design of two small wood blacks attached to each other. Through testing, I found that the optimal servo height was 1.5 inches off of the ground. Kevin assisted me in using a nail gun to attach the wood blocks, and I superglued the servo onto them. For the extra arms, I just created small 1 x .25 inch rectangles of acrylic using the laser cutter.
Attach the Sensors
I placed the sensors directly below the hoop to hopefully catch movement when the ball falls through. I had to place the distance sensor slightly lower as it couldn't detect the difference between the ball and the bottom of the hoop. The proximity sensor was able to detect the movement of the back part of the hoop which made it easy. I wanted to use 2 proximity sensors, but unfortunately it's not easy to do without a multiplexor since the APDS9960 has a fixed address.
Wire Everything Together
The wiring for this project was relatively complex. I had to use the far left rail for ground, the far right rail for VBUS, and the second from the right rail for 3V3OUT. I also soldered the connections for my two switches onto pins. I found the HUB75 wiring online and wired it as follows:
- First brown - GP0
- First red - GP1
- First orange - GP2
- First yellow - GND
- First green - GP3
- First blue - GP4
- Purple - GP5
- Grey - None
- White - GP6
- Black - GP7
- Second brown - GP8
- Second red - GP9
- Second orange - GP10
- Second yellow - GP12
- Second green - GP13
- Second blue - GND
For the rest of the wires, I used the three rails I listed above and most of the pins on the right side of the breadboard:
- Distance sensor: red 3V3OUT, black GND, blue GP26, yellow GP27
- Proximity sensor: red 3V3OUT, black GND, blue GP16, yellow GP17
- Switch 1: red GP14, black GND
- Switch 2: red GP28, black GND
- Servo 1: red VBUS, black GND, orange GP15
- Servo 2: red VBUS, black GND, orange GP21
- Speaker: base to GND, tip to GP19
Create a Stand for the Pico (optional)
I created a little stand for the Pico to make it easier to keep all of the wires in place. This is completely optional, but I thought it helped a little bit.
Code the Game
The coding for this project doesn't seem very complicated, but the LED array portion took a while to learn. I begin by importing libraries and setting up objects for the various sensors and servos. I then set up the matrix using some code I found in the documentation. The code corresponds each of the pins in the HUB75 cable to a different aspect of the array. I then create a FramebufferDisplay object from the framebufferio library which all of the things I want to display will be added to. Next, I created my function for displaying bmp files with some help from my friend Jack. The functional part of the code starts by going through some text and the red and green colors to signal the game is starting. The while true loop contains most of the action code. It first checks each of the sensors to start the scoring sequence and displays the corresponding text based on which side won. It then checks if either of the buttons linked to the switches has been pressed, which start the servos.
Downloads
Prepare and Add Sound Files
I first found my favorite basketball soundbite, the announcer Mike Breen saying "Bang!" on YouTube. I then ran this through a YouTube to MP3 converter and put it into Audacity. I performed the usual steps for preparing a file for the Pico, like changing it to mono, lowering the Hz value, and changing it to 16-bit PCM. I then added this file to my Pico.
Prepare and Add LED Files
I created the background colors for the LED array using GIMP to create .bmp files. I made sure these were the right dimensions, then added them to the Pico.
Turn It on and Play!
The game has an initial pause for everyone to get ready until the light turns green. Once a player presses their button, their servo will start spinning and they can shoot. Then, the screen flashes some text when someone scores, pauses for a little bit, then starts again.