My last weeks post involved, Controlling and Monitoring your 3D printer with BeagleBone and OctoPrint  and this week has involved, a lot 3D designing and 3D printing an enclosure for Pocket version of DIY Drum kit using the SparkFun's Capacitive touch key pad (https://www.sparkfun.com/products/12017) ,a couple of potentiometers(10K Ohms) and the BeagleBone black.

 

I had to name the blog post  -- "Pocket version"  of the DIY drum kit , as i could not come with something fancier . Basically, one of my buddies who is about, 6 feet and 4 inches tall, came over this weekend and suggested the name. And yes ! if you are wondering it did fit in his jacket pocket..

But, please leave a comment below, if you come up with a better name ..

 

IMG_0751.jpg

 

Here is a quick video of the Pocket Finger DIY Drum kit in action

 

Music in the Video from  Free Music Archive: Transient - Chiquesalunga (BirdSong)

 

In the video, the Yellow dial will be used to select a list of songs(currently I have two songs mapped to the potentiometer called BridSong.wav and CowPasture.wav). And the Blue potentiometer dial will be used, to select a different set of wav files to mimic sets of sounds/instruments, here I have mapped a simple drum set, bass guitar set and some fun funk beats to each of the 12 touch pads on the MPR121 capacitive touch sensor.

 

I am still working on the code, and will upload the .py files and the modified python library for interfacing with a MPR121 capacitive touch sensor in a few days.

 

Here are the steps followed to complete the build

#1  Designing 3D printed parts

The parts for 3D printing were designed in 123D design, and I had to go over a couple of iteration to

-snap fit the Capacitive touch key pad to the top

-and get the mounting holes for the BeagleBone to the correct size

Screen Shot 2016-03-20 at 7.05.42 PM.png

 

#2 3D printing the parts

For 3D printing the bottom and top STL files attached below , I used Hatchbox 1.75 mm Red PLA to match the Capacitive touch key pad.

Here are some suggested setting to 3D print the parts

  • Layer height - 0.2mm
  • Infill - rectelinear
  • Infill density - 25 %
  • Nozzel temperature if you are using the same Filament - 205 C

 

3D printing the file takes about 3.5-4 hours and depends on your printer and Slicer settings

 

IMG_0686.jpg

In the picture above the screw (6x32 - 1 inch )is used to hold the 3D printed parts together, this will make it easy to remove the BeagleBone for the next version of the DIY Drum Kit

 

#3 Soldering the Potentiometers

Solder the Pot's as shown in the picture below, basically the +ve of the pot''s will be connected to 1.8 V on the BeagleBone. And middle pins of the pots will be connected to the pin header P9 analog pins 33 and 35.

IMG_0705.jpg

 

#4 Adding the Capacitive touch key pad to 3D printed part

 

The Capacitive touch key pad -MPR121 should snap fit on the 3D printed part, but I have also used electrical tape secure the keypad to the 3D printed part.

IMG_0712.jpg

 

#5 Connecting Capacitive touch key pad and 2 Pot's to the BeagleBone

Once you have connected the USB sound card to the usb port, here are the list of connections you will have to make

Capacitive touch key pad -MPR121

  • Connect the VCC of the key pad to 3.3V , pin#3 on the P9 header
  • GND to GND to pin#3 on P9
  • SCL on the key pad to pin#19 on P9 header
  • and SDA to pin#20

Potentiometers

  • Connect +ve to 1.8V , that is pin #32 VDD_ADC on P9 header
  • Connect GND to GNDA_ADC , that is pin #34 on P9 header
  • Connect one pot to the analog pin #33 on P9 header
  • And the other to pin #35

 

IMG_0736.jpg

 

#6 Checking if the Capacitive touch key pad is detected by the BeagleBone

To validate the connection and to check if the MPR121 is detected on the BeagleBone's I2C bus 1, run the following command

root@beaglebone:~# i2cdetect -r 1

 

Here you should see the MPR121 detected as 5a , as shown in the screen shot below.

i2cdetectMPR121.png

 

 

#7 Testing the Potentiometers connections to the BeagleBone

 

To validate you potentiometers are connected and functional, create a new file using the command below, then copy paste the code and run it

root@beaglebone:~/testCode# nano analogread.py

 

Warning : Do not connect the potentiometers to 3.3V ,this could damage your BeagleBone, the analog reference voltage is 1.8V (that is pin #32 VDD_ADC on P9 header)

 

import Adafruit_BBIO.ADC as ADC

import time

 

ADC.setup()
analogPinBlue = "P9_35"
analogPinYel = "P9_33"
while(1):
        potValueBlue = ADC.read(analogPinBlue)
        potValYel = ADC.read(analogPinYel)
        print "Pot Value Blue : ",potValueBlue
        print "Pot Value Yellow :",potValYel
        time.sleep(5)

 

root@beaglebone:~/testCode# python analogread.py

 

Now when you rotate the pot's you should see the values change from 0.0 to 0.999(~1)..

IMG_0757.jpg

 

#8 Checking if the Audio sound card is detected

To check if your sound card is detected use the following command, in my case I am using Daffodil US01 USB External 7.1 Channel Sound Card ,which was purchased from Amazon.

root@beaglebone:~#lsusb

IMG_0753.jpg

Audio card is detected as C-Media Electronics,Inc. CM108 Audio Controller

lsusb.png

 

#9 Making sound with the MPR121 - Work in Progress

The blue potentiometer dial will be used, to select a different set of wav files to mimic sets of sounds/instruments, as the dial is moved.Here is the folder structure on the beaglebone(4 folders called basicDrum, bassGuitar, funk and  quicksDrum )

treeBBFolderStruct.png

And the Yellow dial will be used to  select a list of songs which you can add beats too, these wav files are stored in the tunes folder as shown in screen shot above.

If you are looking for music files under the creative commons license check out - Free Music Archive  or Soundcloud.com

Song files I am using are from the Album -Free Music Archive: Transient - Chiquesalunga  by Free Music Archive: Transient

Each of the wav files are played using ALSA -aplay and are called in code using python subprocess module.

 

To adjust the volume use command

root@beaglebone:~# alsamixer

alsamixer.png

 

In addition the python code will be invoked when the BeagleBone start (using the Crontab), which means i will not have have to SSH in to run the python program via the LAN cable.

 

 

#10 Using Adafruit 12-key Capacitive Touch sensor breakout -MPR121 - Work in Progress

As part of the next version, I plan on using Adafruit 12-key Capacitive Touch sensor breakout -MPR121(https://www.adafruit.com/products/1982 ) and Conductive PLA to experiment with touch sensing with one dual-printed 3D part.

IMG_0719 (1).jpg