Introduction: Capacitive Touch Baby Mobile

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

Step 1: Boxes

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

Step 2: Ring

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

Step 3: Fish

Laser-cut fish in different colors

Step 4: Copper Tape

Apply copper tape to the edges of each fish

Step 5: Thread

Glue conductive thread to the top of the fish

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

Step 6: Hang Ring

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

Step 7: Wiring

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

  • Use the wiring diagrams above

Step 8: Hang Fish

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

Step 9: Beach Sounds

Record the beach sounds

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

Step 10: Code

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


Step 11: Small Box on Large Box

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

Step 12: Finishing Touches

Finishing touches

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