Capacitive Touch Rhythm Game!

by oneillgq in Craft > Art

42 Views, 1 Favorites, 0 Comments

Capacitive Touch Rhythm Game!

cover.jpg
IMG_2187.png

I made a capacitive touch rhythm game (code included)! This game includes RGBs that light up to indicate which buttons to press, as well as editable code to turn your favorite songs into fun games!


NOTE: You will need access to a laser-cutter and a soldering-kit along with the listed supplies!

Supplies

IMG_2165.png
IMG_2177.png
IMG_2156.png
IMG_2175.png
IMG_2176.png
IMG_2159.png
IMG_2179.png
IMG_2167.png
IMG_2174.png
IMG_2178.png
IMG_2182.png
IMG_2186.png


  1. 1/8 inch Birch Wood (not shown)
  2. Wood Glue (not shown)
  3. 1/8 inch Clear Acrylic (not shown)
  4. Wago 5-Connector Lever (2x)
  5. Bunch of Different Color Wires (14 or 12 AWG)
  6. Adafruit Flora Smart RGBs (4x)
  7. Wirecutter/Wirestripper
  8. Electrical Tape
  9. Soldering Kit (not shown)
  10. Foam Board
  11. Audio Cable
  12. Multimeter
  13. Capacitive Touch Tape
  14. Duck Tape
  15. Hot Glue Gun
  16. Adafruit CircuitPlayground Bluefruit (not shown)
  17. Screws + Washers (should fit through the holes of the CPB with extra space)

Cut Out Box Parts + Box Top

IMG_2158.png
IMG_2181.png

Using the Adobe Illustrator (AI) "rhythm_box" file listed below, laser-cut the box design out of 1/8 inch birch wood.

Use the "rhythm_box_top" file to laser-cut the top-section out of the 1/8 inch clear acrylic. The laser-cutter should also engrave the top to help with light diffusion (included in the file design)!

Assemble Box

IMG_2180.png

Using wood glue (the brand I used is in the picture), glue the top and all the sides. I would recommend these three sides together first, then glue the other sides EXCEPT FOR THE BOTTOM!


NOTE: the holes in the sides should both further away from the cross hole!

Wiring Connectors

IMG_2172.png
IMG_2170.png
IMG_2173.png

Cut four wire the same length shown in the picture, and snap them into the connector. Then, cut one wire that is much longer. Snap this one into the OUT part of the connector. Be sure to strip all the ends of the wire! Repeat again with a different color of wire. These will be our POWER and GROUND connections.

Tape these two parts together with electrical tape as shown in the picture.

Wiring RGBs

IMG_2171.png
IMG_2163.png

Cut out 3 more wires of a different color, and strip the ends. Make sure they are long enough to allow the LEDs to rest under each part of the cross (look at future pictures for guidance!). Cut out one much longer wire. This will be our connection to the CPB!

ALSO make sure the arrows follow one another STARTING AT THE LONG WIRE (long wire -> arrow facing away). All the "+"s should be facing outward and the "-"s on the inside.

Here is the tough part: You will need to solder all these connections 😅. You could just twist the wires, but there is no guarantee that the connections will be secure. Look at my picture for guidance!

Tape + More Wiring!

IMG_2161.png
IMG_2162.png

Place four strips of conductive tape on each side of the cross. Cut out four long wires, ideally of four different colors, I only had two! Strip the ends, curl them, then solder to the tape!

Cross Wires Go In!

FBGM7KPM2Q690LC.png
IMG_2164.jpg

Cut out a piece of foam that can fit inside the box. Make sure it is thin enough that light can shine through (test using the flashlight on your phone). Then cut a hole in the center of it. Thread the wires from the cross through that hole.

RGB Wires Go In!

IMG_2168.png
IMG_2169.png

Next, put in the soldered RGBs. Make sure they line up with the center points of the cross! Then duck tape the wires in as well as the foam to the box to make sure it is secure!

NOTE: from the gap we left with the WHITE wires connecting the RGBS, there should be room for the cross wires to snake through!

NOTE 2: the RGB with the longest wire connected to it will be the UP LIGHT!

Glue the Top!

IMG_2183.png

Hot glue the top to the box! Apply the glue to the outermost edges primarily, as the cross may be laying slightly above the center parts.

NOTE: the cross is larger than the hole to prevent it from being pushed through!

Wire to the CPB!

IMG_2188.png

Here is the other difficult part 😅. We need to make all the connections to the CPB! I used screws, as I wanted to be able to take it apart if I needed to work with the CPB again, but you are also free to solder! ALSO for the audio cable, be sure to strip the ends of the connection!


Here is a list of all the connections:

RGB DATA: A3

RGB POWER: VOUT

RGB GROUND: GND (look at picture!)

UP-BUTTON WIRE: A4

RIGHT-BUTTON WIRE: A5

DOWN_BUTTON WIRE: A6

LEFT_BUTTON WIRE: TX

AUDIO RED: AUDIO

AUDIO GND: GND (look at picture!)

FINISH BOX!

F4RG4AJM2Q6912O.png

Thread the audio cable out one hole, and the connection cable for the CPB out the other. Then close the box with the remaining wood piece. I would not glue that last part shut, just in case anything got messed up, or you want to see the inside in the future!

Now you are done! All that is left to do is load the following code and audio files on to your CPB! If everything is correct, pressing the UP-BUTTON should give a little introduction, LEFT and RIGHT should play songs + mappings that I have created, and DOWN should put you into TEST mode!

NOTE: if you are unfamiliar with CPBs, here is a good video for setting everything up!

CODING/FILES!

Rename the "rhythm_game" to "code" before putting it in the CPB, and put the mp3 files into a folder named "sounds". If you want to use your own sound files, be sure to follow these steps for audio conversion. Just be sure to change the parameters of the play_game()! To figure out when you want certain button presses to go, you can go into test-mode (make sure to change the TEST parameter to your song). This will output your presses/times to the screen to help with mapping!

When you know your mapping, you store it in a dictionary with a name of your choice where the keys and values are organized as such:

ex_mapping = {

timing : (directions, color, window * SEC),

...

}

where the timing is rounded to the tenth of a second, the directions are stored as a tuple of either one or two numbers (0 for up, 1 for right, 2 for down, 3 for left, two numbers for a multi input) and window is how long the player has to hit the note in seconds! Be sure to make the window time less than the time it takes to reach the next note, or else weird behavior may occur.

Have fun!

Videos!

Capacitive Touch Rhythm Game Explanation!
Capacitive Touch Rhythm Game Easy Song Demo!
Capacitive Touch Rhythm Game Hard Song Demo!