I took EDES 301 during the fall semester of my senior year at Rice. As a Business major who freshly wrapped up the major the semester prior, I wanted to try something new and different outside of my major. While I have worked with python before, it was exclusively in data analytics and financial calculations.
Going into this project, I had very low expectations to what I could do. I ended up picking something that I thought would be more on par with my hardware and software skill: a basic game similar to Dance Dance Revolution. While the entire project did not work out, I was able to create a working driver for the joystick (details towards the end) that people could use in their projects with joysticks.
The idea was simple: 4 separate lines of LEDs, each representing a direction with falling "notes". The joystick would be the main input, and when the input matches the expected input, points are awarded and displayed on a seven-segment display. One of the buzzer will keep track of tempo, and the other will buzz whenever the play missed a note.
While the finalized design is quite different from the initial system block diagram, the idea is still more or less the same. There wasn't enough space on the solderless board for 4 rails of light, so the design turned into only left and right.
After receiving the joystick (link), it consisted a ground pin, a +5v, X axis, Y axis, and button press pin. After taking an embarrassing amount of time, I finally figured out that the X axis and Y axis pins should be plugged into the AIN 1.8V headers on the pocket beagle and not the GPIO pins. Looking back, it makes sense that the axes functions like a potentiometer, and it took some gaming on my own controller for me to finally realize that.
Kicking off the build, I wired up all the generic LEDs, it wasn't too difficult, and the test script from the class confirmed that they all work.
Next up, the buzzers and the display. The buzzers were straightforward to wire after following the guide provided in the class materials. The 7 segment display was difficult to position so that it can face the right way. There were a few revisions on placement and wiring.
I thought about having 2 displays so that one display can keep score and the other one count down the remaining game time, but after some experimenting both displays run on 0x70 and I could not get the other one to run on 0x71 so they display different things. So now we are working with only one display.
Now that the hardware is done, time to switch over to making the software.
It can't be that hard, I said to myself.
Cloud9:
Absolutely nothing was working for a week straight, errors after errors.
From me not being able to figure out how to mass configure all the pins I need to be in the right mode, to it running into an error loop that I can't get the software to stop itself. With no clue how to make a proper game logic, I asked AI for help just for it to start hallucinating up hardware that I don't have.
After many revisions, I was able to get a script that auto configures all the necessary pins to what they needed to be, and a working driver for the joystick that works very well.
A note on that specific joystick, the input works great by plugging into any 3.3v header, I plugged it into P1_14. The press can be plugged into any GPIO headers. However, the actual X/Y, since it had to go into a 1.8v AIN, should have some resistors (according to chatGPT) like below.
VRy ----[ 4.7k ]----+----> AIN0 (P1_19)
|
[ 5.1k ]
|
GND
A thing to keep in mind, it worked well for my case.
Here is a brief demo of the device with the program launching, pins configuring, and the joystick functioning. The min BPM limit was set to 60 and the max at 300. The long press works, and after pressing and "starting the game," the game stops working.









_3u05Tpwasz.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)
Comments