Creating music is always fun, but making it with your own DIY musical instrument is much better !! Now if you have one of the BOSEBuild speaker cube and have access to a 3D printer, then this project is something you should try. In addition to a 3D printer and conductive filament, you will also need a few electronic components which include the Raspberry Pi Zero W and Adafruit's Capacitive touch Pi Hat.
The build uses Alligator clips to connect the black conductive filament tabs to the Adafruits capacitive touch Raspberry Pi hat, as you see in the picture above. And this makes the build easy to assemble with the 3D printed side panels, and is ideal for kids to experiment and learn about the concept of capacitive touch sensing ..
Follow the steps below to download and 3D print the STL files attached, and instructions/commands to setup the Raspberry Pi Zero W to trigger beats via the pads as you see in the video above.
I would also like to thank my friend’s son for lending me his BOSEBuild speaker for a couple of weeks to complete this project. And also wanted to mention, that this project was inspired, after watching build demo of Bluetooth LE MIDI Controller on 3D Hangouts by Noe and Pedro Ruiz.
Step 1: Collect the Things You'll Need
In addition to the BOSEbuild speaker cube , here are the list of electronic components you will need to complete the build
- Raspberry Pi Zero W
- Adafruit Capacitive Touch HAT for Raspberry Pi - Mini Kit - MPR121
- USB Audio Adapter
- Tiny OTG Adapter
- Micro SD card to run the Rasbian operating system
- Micro USB cable to power the Raspberry Pi
- Alligator Clip
And for 3D printing you will also need access to a 3D printer
- PLA filament, in mycase I am using Red Transparent filament and Green PLA
- Conductive filament, here I am using Proto-pasta's conductive filament
Step 2: 3D Print Speaker Box Plates
Using your favorite PLA filament , download and 3D print the STL files attached below. In my case I am using Makerbot Red translucent 1.75mm PLA filament to print the speaker plates. And using green Hatchbox 1.75mm filament to print the clips which will hold the speaker plates together
I am using a Flashforge creator pro to print the files attached and using Slic3r to slice my files, and here are the slicer setting I used
- Layer height 0.3mm (you can drop this down to 0.2mm)
- Infill - 40 %
- Nozzle Temperature - 205 C
Step 3: 3D Print Pads Using Conductive Filament
Now once you’re done 3D printing the panels, load up Proto-Pasta’s conductive filament and print the pads. I added the pad STL four times to the slicing software as you see in the picture above.
And here are the slicer setting I used
- Layer height 0.2mm
- Infill - 80 %
- Nozzle Temperature - 210 C
Step 4: Setup Your Raspberry Pi and Test the Conductive Sensor
Using your computer flash the latest version of Raspbian-lite img on an SD card (Download link for the img file https://www.raspberrypi.org/downloads/raspbian/). And then add the SD card to the Raspberry Pi and connect your Pi to the your WiFi router and make a note of the IP address, then SSH into your Pi or while your connected to Pi via HDMI run the following commands.
Start by running the two commands below to update and upgrade the packages on the Pi, this could take a couple of minutes so be patient, and is basically dependent on your internet connection.
sudo apt-get update sudo apt-get upgrade
Now, git clone and install the Adafruits MPR121 python library using the following commands
sudo git clone href="https://github.com/adafruit/Adafruit_Python_MPR121 cd Adafruit_Python_MPR121 sudo python setup.py install
And, then to test that you are able to trigger the pads with touch, connect the alligator clips to the pads and the capacitive pi hat, and run the following command
cd examples sudo python simpletest.py
Step 5: 3D Print Raspberry Pi Zero
This is more of an optional step and involves 3D printing a holder for your Raspberry Pi Zero W which you can add to the side of your speaker as shown in the picture above. But, if your using a Raspberry Pi 3/2/B+ you can find STL files on thingiverse.com/myminifactory.com. Select a model which gives you access to the header pins because you will have to connect Adafruit's Capacitive touch hat to the Pi's header pins.
And here are the slicer setting I used with Slic3r for my Flashforge creator pro.
- Layer height 0.3mm (you can drop this down to 0.2mm)
- Infill - 30 %
- Nozzle Temperature - 200 C
Step 6: Putting Beat Speaker Box Cube Together
Now for the fun part, thread the alligator clips through the left 3D printed part. And then add the pads to the 3D printed parts using hot glue as shown in the picture above. As a suggestion before you add hot glue attach the alligator clips so that you can get a sense of the spacing.
Add the green clips to hold all the 3 panels together , and then connect the other ends for the alligator clips to the Capacitive touch Pi hat.
Step 7: Running the Code on the Pi
Just before the final setup we will run the following command to test the sounds triggered by each pad, using the following command
sudo python playtest.py
If you would like to change the mapping of the sounds to the pads, modify the SOUND_MAPPING section in playtest.py file.
Now to make this a little more permanent, we will create a systemd service , which will automatically run the program when the Pi restarts.
sudo nano bosebeat.service
and copy the lines below to the file and press ctrl+X to save.
#!/bin/sh [Unit] Description=Pi BOSEBuild Beat box [Service] ExecStart=/usr/bin/python /home/pi/Adafruit_Python_MPR121/examples/playtest.py StandardOutput=null [Install] WantedBy=basic.target Alias=bosebeat.service
put the file bosebeat.service in /lib/systemd/system/ and enable the service
cp bosebeat.service /lib/systemd/system/bosebeat.service systemctl enable bosebeat.service systemctl start bosebeat.service
to check the status of the service , and to confirm that it is in the running status use
systemctl status readouts.service
And , finally reboot your Pi to check that the services is started automatically and your are able to hear beats when you strike the pads.