I changed my idea to a drum sample glove to a general MIDI controller glove which you can use with any software synthesizer (DAW).
Parts
I also bought felt, sewing supplies, and a soldering iron.
The Process
I tested the piezo elements with my Arduino Uno using this simple program, and they all work correctly.
I tried putting the piezos inside the glove, to hide the wires, but it made the glove too impractical and uncomfortable to wear.
Sewing the piezos onto the glove:
After soldering and using heat shrink tubing to add the 1M-ohm resistor to the piezo wires, I found that none of the circuits worked (they kept reading 0 in the Serial Monitor). I assumed this was because of my poor soldering skills, but it turns out the resistors were the problem – once I removed them, the analog values registered. So I started all over again and stripped the wires, soldering them directly to the FLORA.
Finally, once everything was connected, I tested the FLORA with Arduino software. This was where the real technical problems began (see Challenges). Once I managed to get Arduino to recognize the FLORA library, I tested the glove with a program that associates the knocks from the piezos to keyboard letters.
I imported the Teensyduino add-on for Arduino, which converts analog input to MIDI signal for the Adafruit FLORA. It worked perfectly. I then sewed the FLORA to the glove, and tested the new MIDI device with Garageband!
Code:
Challenges
Configuring the Arduino application to the FLORA was by far the most challenging task. Upon adding the third-party FLORA board to my Arduino boards library, I kept getting this compile error:
…Arduino15/packages/arduino/hardware/avr/1.6.11/cores/arduino/CDC.cpp: In function ‘bool CDC_Setup(USBSetup&)’:
…Arduino15/packages/arduino/hardware/avr/1.6.11/cores/arduino/CDC.cpp:104:29: error: ‘MAGIC_KEY_POS’ was not declared in this scope
uint16_t magic_key_pos = MAGIC_KEY_POS;
^
…Arduino15/packages/arduino/hardware/avr/1.6.11/cores/arduino/CDC.cpp:129:34: error: ‘MAGIC_KEY’ was not declared in this scope
*(uint16_t *)magic_key_pos = MAGIC_KEY;
^
Error compiling.
It took several downloads of previous versions of Arduino, along with multiple installations of different versions of the FLORA board library, and a lot of desperate Internet searching until it finally worked.
Then, Arduino wouldn’t recognize the Serial USB port connected to the Flora, which I discovered was because of Mac 10.9 Yosemite not having the correct FDTI drivers. This required additional installation of drivers and even more Googling.
Demo
coming soon