Capacitive Touch Xylophone

When you touch the conductive fabric on the touchpads, the corresponding solenoid hits the key on the xylophone. If you do not remove your hand from the touchpad, the solenoid continues to fire at a set interval. This design aims to adapt the xylophone to make it accessible to young students with mobility constraints.
This project is built for Prof.G's Physical Computing class, and is an adaptation of a robotic xylophone on the Adafruit learn guide.
CircuitPython code for a capacitive xylophone
Supplies

xylophone $17.49 https://a.co/d/f6vrD93
Control system:
1 Raspberry Pi Pico 2 - RP2350 $5.00 https://www.adafruit.com/product/6006
1 Adafruit 12-Key Capacitive Touch Sensor Breakout - MPR121 - STEMMA QT $7.95 https://www.adafruit.com/product/1982
2 STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm $0.95 https://www.adafruit.com/product/4399
1 Adafruit I2C to 8 Channel Solenoid Driver $14.95 https://www.adafruit.com/product/6318
USB to Micro B connection cable
Helpful during prototyping:
Raspberry Pi Pico WH $7 https://www.adafruit.com/product/5544
Adafruit MPR121 12-Key Capacitive Touch Sensor Gator Breakout $6.95 https://www.adafruit.com/product/4830
Solderless Breadboard for Raspberry Pi Pico by Monk Makes $4.95 https://www.adafruit.com/product/5422
STEMMA QT / Qwiic JST SH 4-pin to Premium Male Headers Cable $0.95 https://www.adafruit.com/product/4209
jumper wires, alligator clips
Solenoids:
8 Mini Push-Pull Solenoid $4.95 - 5V https://www.adafruit.com/product/2776
8 JST male 2-pin cable
16 #0-80 screws https://a.co/d/7jawcvM
thread
Touchpads:
2 Knit Conductive Fabric - Silver 20 cm^2 $9.95https://www.adafruit.com/product/1167
1 BNTECHGO 22 Gauge Silicone Wire Kit 10 Color Each 10 ft $12.48 https://a.co/d/c1XjMt8
polyester filling
Frame/mounting/power:
4 M3 screws and nuts, 8 M2 screws and nuts
1/8 inch wood sheet
5 round wool felt
3xAA battery holder with on/off switch
AA Alkaline batteries
heat shrink tube
velcro tape
Equipment and tools used:
Precision screwdriver set $7.95 https://www.adafruit.com/product/424
needle file $11.57 https://a.co/d/jjB4fqr
utility knife, scissors, twizzer, wire stripper, soldering kit, 3D printer, Laser cutter, drill, clamp (provide by school)
Estimate cost ~$200 (USD)
Solenoids



Loosen the screws on the terminal block on the solenoid driver.
Connect the Stemma QT port on the solenoid driver to Raspberry Pi Pico pins: red to 3.3V, black to ground, blue to GP4, yellow to GP5. See the attached file for pin positions.
Get a 3xAA battery holder and 3 alkaline batteries to power Pico and solenoids in parallel, since both require 5V. Connect the red wire of the battery holder to VSYS on Pico and V+ at the center of the terminal block on the solenoid driver. Connect the black wire to any GND on Pico and the GND at the center of the solenoid driver.
the Alkaline batteries are 1.5V each, which adds up to 4.5V. You can also use a 4xAA battery holder with 4 NiMH batteries, each with 1.2V, adding up to 4.8V. But be careful not to use 4 alkaline batteries, as overcharging would damage the Pico board (solenoids probably would be okay). See the learn guide on batteries.
Connect a solenoid to a JST cable, then to the terminal block of the solenoid driver.
Tighten the screws.
Use the test code to check if the solenoid is working.
Use a USB to Micro B cable to load the code on Pico, then unplug it and let the system run on its own to make sure the battery power actually works.
Cut the 2-pin JST cables to desired lengths.
Downloads
Touchpads





Use a 3D printer to print out the touchpad cases. Two red, and one each for orange, yellow, green, light blue, dark blue, and purple. The STL file is attached below.
Cut a small opening at the corner of the case where the wire comes out.
Cut the conductive fabric into 10cm x 10cm squares.
Cut 1 meter (or your desired length) of the silicon wire for each color (2 red, 2 blue).
Strip the insulation on both ends.
Solder one end of the wires to the capacitive touch sensor, pin 0 through pin 7.
Solder the Stemma QT cable to the Pico: Cut the cable in half, strip out a bit of bare wire, and solder. Red to 3.3V, black to ground, blue to GP4, yellow to GP5. Plug into the Stemma QT port on the capacitive touch sensor.
Use the test code and touch the wires to see if it works.
Push the other end of the wires through the hole on the bottom of the case.
Cut small holes in one corner of the square fabric.
Split the wire into two strands, push them through the holes respectively, and tie a knot.
Pull the wire back down so that the connection between the fabric and the wire is hidden inside the hole in the case. Cut the extra wire if it is too long.
Test the code again, touching the fabric.
Cut off the 3 other corners after you make sure the connection is secure.
Stuff polyester fillings in the case.
Pull down the fabric from above and secure it with the 3D printed loop.
Test the code again.
Downloads
Assembly







Make a Y-splitter for the battery power. Use a heat-shrink tube to seal the connection.
Laser cut 1/8 inch wood sheet. Files attached below.
Stick 5 felt at the bottom, 4 on corners and 1 in middle.
Check that the solenoid can just hit the keys. I had to slightly adjust the frame and reprint it because it's very difficult to get the exact measurement of how high to place the solenoids, and I think the wood that I used was slightly thicker than 1/8 inch. That's why there's a modified file.
Connect the solenoid driver to the capacitive touch sensor with a Stemma QT cable.
Place the circuit on the wood base. Use a pencil to mark the location of the holes in the electronic boards. Drill holes on the base. Screw circuit on the base.
Secure the solenoids on the horizontal bar by first tying(sewing) them together with thread, then screw the #0-80 screws. The gap in the body of the solenoids is too small for the head of the screw or the nut, so it was impossible to fasten it only using screws.
Connect all eight solenoids to the solenoid driver.
Stick the battery holder to the base using velcro tape.
Put the xylophone in place. Then screw the frame together, using washer to make final slight adjustments to spacing.