Capybara Interactive Puzzle
I made a Capybara puzzle that lights up every time a puzzle piece is placed on the board. Once the puzzle is finished, a light animation plays!
Supplies
- CircuitPython
- Arduino Nano RP2040
- Adafruit MPR121 Capacitive Touch Board
- Breadboard
- LED light strand
- Alligator clips/Jumper wires
- Conductive tape
- ¼” Baltic Birch
- Laser cutter
- Adobe Illustrator
- Ipad - Procreate for illustration
- Etsy - puzzle.svg templates
- Paint
- Wood glue
- Tape
- Aluminum foil
Draw Your Capybara
I chose to draw a Capybara, but you can choose to draw whatever you would like to put on your puzzle! Once you have drawn it, upload it onto Procreate on your Ipad to trace so that you have a digital copy of it.
Laser Cut Your Puzzle and Box
I bought a puzzle.svg template on Etsy and uploaded it to Adobe Illustrator with my illustration on top to laser cut. Make sure that your illustration is in black on Adobe Illustrator so that it engraves while your puzzle template is in red so that it is cut out properly on the laser cutter. Next, laser cut your box as shown in the pictures above to hold your hardware in.
Set Your Capacitive Touch
Tape conductive tape to your alligator clips that are attached to your capacitive touch board. Attach more conductive tape to the back of the board as well. To make the puzzle piece conductive and receptive to the capacitive touch, you will need to put aluminum foil to the back of each piece. Then, you will need to attach conductive tape that connects this foil to the front of the piece as shown in the picture above. The capacitive touch board is only receptive to human touch, so it is imperative that the tape shows in the front and that your finger touch it when you place the piece on the board in order for the touch board to register a touch.
Code!
#Creator: Kristen Chung
import board, adafruit_mpr121, neopixel, time, random
from rainbowio import colorwheel
from adafruit_led_animation.color import (
AMBER, #(255, 100, 0)
AQUA, # (50, 255, 255)
BLACK, #OFF (0, 0, 0)
BLUE, # (0, 0, 255)
CYAN, # (0, 255, 255)
GOLD, # (255, 222, 30)
GREEN, # (0, 255, 0)
JADE, # (0, 255, 40)
MAGENTA, #(255, 0, 20)
OLD_LACE, # (253, 245, 230)
ORANGE, # (255, 40, 0)
PINK, # (242, 90, 255)
PURPLE, # (180, 0, 255)
RED, # (255, 0, 0)
TEAL, # (0, 255, 120)
WHITE, # (255, 255, 255)
YELLOW, # (255, 150, 0)
RAINBOW # a list of colors to cycle through
# RAINBOW is RED, ORANGE, YELLOW, GREEN, BLUE, and PURPLE ((255, 0, 0), (255, 40, 0), (255, 150, 0), (0, 255, 0), (0, 0, 255), (180, 0, 255))
)
INDIGO = (63, 0, 255)
VIOLET = (127, 0, 255)
colors = [RED, MAGENTA, ORANGE, YELLOW, GREEN, JADE, TEAL, BLUE, INDIGO, VIOLET, PURPLE, WHITE]
#20 - using light strand
strip = neopixel.NeoPixel(board.D7, 20, brightness = 1, auto_write = True)
i2c = board.I2C()
touch_pad = adafruit_mpr121.MPR121(i2c)
touchedpins = touch_pad.touched_pins
touched_list = []
strip.fill((BLACK))
while True:
touched = False
for i in range(9):
if touch_pad[i].value:
if i not in touched_list:
strip.fill((0,0,0))
strip.fill(colors[i])
touched_list.append(i)
print(touched_list)
touched = True
if len(touched_list) == 9:
print("You touched all the pads")
random_strip_light = random.randint(0, 19)
random_color = random.randint(0,255)
colorwheel_color = colorwheel(random_color)
strip[random_strip_light] = colorwheel_color
touched = True
if touched == False:
strip.fill((0,0,0))
Paint
Paint your box and puzzle pieces to your liking. I used wood stain for the box for a finished look, but feel free to use whatever you would like.
Put It All Together
Use sandpaper to sand the puzzle pieces so it fits smoothly together. Put your box together with all the hardware inside the box. Make sure to tape the alligator clips to the inside of the lid so that it is more secure for the capacitive touch to work better. Congrats! You made your interactive puzzle!