Capacitive Touch Baby Mobile

by AnishaKundu123 in Living > Decorating

734 Views, 4 Favorites, 0 Comments

Capacitive Touch Baby Mobile

Screen Shot 2023-03-26 at 1.25.26 PM.png
IMG_7986.MOV
IMG_8003.MOV

Baby Mobile


I made a fun, interactive, baby mobile! I noticed that most baby mobiles were made to be played with by touching it. However, very few mobiles responded to the touch. I created this mobile to light up in the same color as the fish that the person touched. Additionally, various different beach sounds play when each fish is touched. Enjoy!

Supplies

Boxes

Screen Shot 2023-03-26 at 10.40.04 AM.png
Screen Shot 2023-03-26 at 10.40.15 AM.png

Laser-cut two acrylic boxes

  • One large box with no front or back panel
  • Make 12 small holes on the top of the box for each of the threads to go through
  • Make a small rectangular hole in the back for the LED strip wires to go through
  • One small box with no bottom
  • For the top of the box to hide the wires
  • Box Generator

Ring

Screen Shot 2023-03-26 at 10.42.16 AM.png

Laser cut a ring out of thick wood and attach wire to the ring so it can rotate

  • Measure the LED strip and make the circle's circumference the same length as the strip using the equation 2(pi)(r) and finding r
  • Wrap wire around 4 points of the ring so that it is stable

Fish

Screen Shot 2023-03-26 at 10.50.48 AM.png

Laser-cut fish in different colors

Copper Tape

Screen Shot 2023-03-26 at 10.51.22 AM.png

Apply copper tape to the edges of each fish

Thread

Screen Shot 2023-03-26 at 10.52.57 AM.png

Glue conductive thread to the top of the fish

  • Make sure that the copper tape is touching the conductive wire

Hang Ring

Screen Shot 2023-03-26 at 10.56.02 AM.png

Attach the ring and strings to the large box

  • Using the 12 holes, thread each of the strings through each of their respective holes corresponding with the touch pad and lights
  • Use the last 3 holes to secure the ring to the box by threading the wires through

Wiring

Screen Shot 2023-03-26 at 10.57.09 AM.png
Screen Shot 2023-03-20 at 4.33.27 PM.png
Screen Shot 2023-03-20 at 3.44.40 PM.png
Screen Shot 2023-03-20 at 11.04.20 AM.png

Wire up touchpad, speaker, and LED strip to the breadboard

  • Use the wiring diagrams above

Hang Fish

Screen Shot 2023-03-26 at 11.01.15 AM.png

Attach the fish to the ring by wrapping the string around the ring and tape the LED strip to the ring with double-sided tape

Beach Sounds

Record the beach sounds

  • Record the beach sounds using audacity and save them to a file on the Rasberry Pi Pico W

Code

Screen Shot 2023-03-26 at 11.02.27 AM.png
Screen Shot 2023-03-26 at 11.02.34 AM.png

Code!

  • Here are some pictures of my code
  • Here is my code:


#baby mobile

import board, time, neopixel

import adafruit_mpr121, digitalio, audiomixer, audiocore

from adafruit_debouncer import Button

from audiopwmio import PWMAudioOut as AudioOut

from audiocore import WaveFile


audio = AudioOut(board.GP15)


BLACK = (0, 0, 0)

PINK = (255,90,100)

MAGENTA = (199,21,193)

CRIMSON = (250,50,53)

ORANGE = (255, 40, 0)

DGREEN = (0,250,0)

LGREEN = (21,250,52)

TEAL = (0, 255, 120)

NAVY = (32,42,200)

YELLOW = (255,233,0)


# We often use these colors, but be sure to check colors used when taking exams

colors = [PINK, MAGENTA, CRIMSON, ORANGE, DGREEN, LGREEN, TEAL, NAVY, YELLOW, BLACK, BLACK, BLACK]


strip = neopixel.NeoPixel(board.GP16, 30)


i2c = board.STEMMA_I2C()

touch_pad = adafruit_mpr121.MPR121(i2c)


pads = []

for t_pad in touch_pad:

  pads.append(Button(t_pad, value_when_pressed=True))


def play_sound(filename):

  with open(path + filename, "rb") as wave_file:

    wave = WaveFile(wave_file)

    audio.play(wave)

    while audio.playing:

      pass


#make list of songs/noises for the path

path = "beach-sounds/"

beats = ["dolphin.wav", "dripping-water1.wav", "general-beach1.wav",

"orca1.wav", "seagull1.wav", "sipping-cold-drink1.wav", "water-drop1.wav",

"wave-crash1.wav", "wind1.wav", "wind1.wav", "wind1.wav", "wind1.wav"

]



num_voices = len(beats)


mixer = audiomixer.Mixer(voice_count = num_voices, sample_rate = 8000, channel_count=1, bits_per_sample=16, samples_signed=True)

audio.play(mixer)


for i in range(len(beats)):

  wave = audiocore.WaveFile(open(path+beats[i],"rb"))

  mixer.voice[i].play(wave, loop=True )

  mixer.voice[i].level = 0.0

time.sleep(1.0)


strip.fill(BLACK)


while True:

  #touched = False

  for i in range(len(pads)):

    pads[i].update()

    if pads[i].pressed:

      strip.fill(colors[i])

      mixer.voice[i].level = 0.5

      #print({i})

    if pads[i].released:

      strip.fill(BLACK)

      mixer.voice[i].level = 0.0


Small Box on Large Box

Screen Shot 2023-03-26 at 11.08.38 AM.png

Secure the small box on top of the larger box to keep wires compacted

Finishing Touches

IMG_7986.MOV

Finishing touches

  • Tape extra wires down
  • Secure speaker to the large box