Interactive Box for Jack

by kaufmamf in Workshop > Tools

228 Views, 2 Favorites, 0 Comments

Interactive Box for Jack

Letter Box, Physical Computing

This is a 3D printed Letter-Box for Jack.

It has 2 capacitive touch fields, they play sounds if you touch them.

Have Fun

MAX

Supplies

3D Printer (some sort of Box)

Speaker

CPB (Circuit Python Bluefruit)

Battery Pack for CPB

4 Alligator Clips

Super Glue

Drill

Wood Panel

Print Letter-Box

IMG_20211206_215236.jpg

First, we have to find a Box, that fits our CPB and the speaker.

You could also connect the Speaker outside the Box, but inside looks cooler.

Step 1: Drill Holes for Speaker and Cables

IMG_20211207_203637.jpg
IMG_20211207_203634.jpg

I drilled 2 holes for the speaker. The one to get access to the on/off switch of the speaker and the other hole to get access to the speaker charging outlet.

In addition, I drilled holes so, that the sound of the speaker finds a way to get out of the box.

Step 2: Write Code, Connect, Set Parts

IMG_20211207_215634.jpg
IMG_20211207_215629.jpg

I'll put the Python code to the end of the instructable

I glued in all parts, but you could use any other method

2 alligator clips are connected to the box (AUDIO & GND)

2 alligator clips at A1 and A2, the other end will be connected to the aluminum fields

Step 3: Create Capacitive Touch Fields and Connect

IMG_20211207_210017.jpg

I glued aluminum foil to the lid of the box. Then I connected alligator clips to the backside of the lid.

I made two touch fields. Every field plays an individual sound.

Step 4: Finish

IMG_20211207_222838.jpg
IMG_20211207_222849.jpg

Glue on the Lid, make sure all parts are in the right place.

Screw/glue the box to a wood panel.

Place the battery pack somewhere. (I used zipper so that changing batteries is made as simple as possible)

Code

#Maximilian Kaufmann #Your Electric Capacitive Touch import board import neopixel import time import digitalio import touchio #setup board pixels_pin=board.NEOPIXEL pixels_num_of_lights=10 pixels=neopixel.NeoPixel(pixels_pin, pixels_num_of_lights,brightness = 0.5, auto_write= True) #setup speaker from audiopwmio import PWMAudioOut as AudioOut from audiocore import WaveFile #configure speaker = digitalio.DigitalInOut(board.SPEAKER_ENABLE) speaker.direction = digitalio.Direction.OUTPUT speaker.value = True audio = AudioOut(board.SPEAKER) #path where sound file can be found path="game_sounds/" def playfile(soundfile): with open(path + soundfile,"rb") as wave_file: wave=WaveFile(wave_file) audio.play(wave) while audio.playing: pass playfile("on.wav") pad=[board.A1,board.A2] touchpad=[] sounds=["jack1.wav","cheer.wav"] for i in range(len(pad)): touchpad.append(touchio.TouchIn(pad[i])) while True: touched=False for i in range(len(touchpad)): if touchpad[i].value: playfile(sounds[i]) touched=True

Downloads