Pac-Man Inspired Arcade Game With CircuitPython Raspberry Pi Pico W

by eliotmoose in Circuits > Raspberry Pi

397 Views, 3 Favorites, 0 Comments

Pac-Man Inspired Arcade Game With CircuitPython Raspberry Pi Pico W

pacman title page.jpg
Fun Pac-Man Inspired build with Raspberry Pico W (CircuitPython)

This Pac-Man inspired arcade game incorporates sounds and characters from the original Pac-Man game! Recreate your favorite situations that Pac-man may find himself in like chomping on a delicious strawberry, eating up a ghost after a power-up, getting an extra life from eating some cherries, or accidentally running into one of the dreaded ghosts! Happy Building!

Supplies

Electronics

  • CircuitPython Raspberry Pi Pico W
  • Strip of 60 LED Lights
  • A portable charging battery pack to power the Pico
  • Series of Pin-to-pin and alligator-to-pin wires
  • 4 external buttons
  • External speaker

Materials

  • Two panels of 1/8th inch birch wood
  • 5 colors of 1/8th inch acrylic

Tools and Consumables

  • Laser cutting machine (capable of engraving and cutting)
  • Scissors
  • Hot glue gun
  • Soldering Iron
  • Clear tape

Coding

PacManCode.PNG

My coding process first imported the necessary libraries to enable the functionality of a speaker, time, wav player, buttons, and external light strip. Then, I initialized all four external buttons so that they each uniquely responded when pressed. I created four individual functions that would later be called for each of the four buttons, all assigned their own direction. Essentially, each function matched up with a symbol from the game. For example, one would be Pac-man running into a ghost and play the appropriate death sound and light animation. Each of the animations were hard coded mostly using for loops and can be found in my attached code.

Downloads

Downloading and Mixing Sounds

My sounds were all downloaded from open-domain free sound file sources online and I then had to mix them in the program Audacity in order to compress their size, make their volumes relatively equal, and ensure the audio was clear. All wav files used are attached in the file pack and down below.

Box File Download & Laser Cutting

ArcadeModel.PNG

My build was modeled after the retro arcade box found at https://www.festi.info/boxes.py/Arcade?language=en . I ultimately downsized the box to save wood and increase the portability of the device, but any size arcade box works. I modified the original file slightly to add a wooden "screen" and extra piece to hide and secure my electronics beneath the buttons. Be sure to conduct a test cut with cardboard to make sure the holes are properly fitting in their respective slots. I also added four holes into the top center piece of wood for the buttons to fit into. These holes were made slightly larger than the base of my buttons so that I could add four wooden rings that snugly fit onto my buttons so they would be elevated off the board and be aesthetically pleasing.

Engraving Wood & Acrylic

Pac Blue Ghost JPG.jpg
Pac Cherries.jpg
pac ghost.gif
Pac Strawberries.jpg
pacman outline.png
pacman no background title bw.jpg

The Pac-Man logo was first engraved using the laser cutter in two places, on the upper back wood piece of the machine and on the front center piece just below the buttons. Unique colors of acrylic were used for each different symbol and cut into circles, with Pac-man being the largest in the center. All images used to engrave are attached.

Assembly

Symbols.jpg

Assembling the box is the next best step, however be sure to hot glue your acrylic symbols onto the wooden "screen" piece first for simplicity. The arcade game box file is relatively straightforward on matching up holes with their respective slots to create a final product. It is smart to apply hot glue or wood glue to the connections of wood for structural integrity.

Wiring Pico & Adding Lights

Pico.jpg

I used a soldering iron to permanently attach my four external buttons to their wiring. My pico was then wired to support all four buttons with signal and ground, my external speaker with signal and ground, and finally my 60-LED light strip with power, signal, and ground. I then taped down my lights around the inner base of the arcade box. All of the wiring, speaker, and battery pack is internally housed beneath the buttons on the box so that it remains both hidden and secure for the player.

Playing

Ensure your speaker is turned on and your battery pack is powering your Pico, and you are ready to play! Enjoy the sounds and lights as you control Pac-Man on his journey dodging ghosts and collecting power-ups.