Teensy 2.0 Piezo Drum Help

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Teensy 2.0 Piezo Drum Help

Post by KyleMohr »

After being inspired by these two videos I decided to use 4 piezos to make midi drums:

https://youtu.be/aHDsutNMfXo
https://youtu.be/-4BPpfFGcIE

I combined the drum pad construction of the second video, with the wiring and circuitry of the first video as well as the code from the midi glove adafruit video. Since I was using a Teensy 2.0 instead of a FLORA I altered the code to match the first 4 analog inputs of the Teensy board. After soldering and putting it all together I get noting when plugging it into ableton live. The teensy is recognized as a MIDI controller, but no MIDI signal is being picked up. I will also note, that before soldering anything to the Teensy board, I was able to touch the 4 pin holes on the board and a midi signal for those four would be picked up from just my finger making a connection. Lastly, once everything was soldered and connected, the board got very warm.

My only assumptions at this point, is that, while I have a 1m ohm resistor running in paralell for each piezo, I should add a 10k ohm resistor at each pin on the teensy to reduce even more, or the hot glue I used on the piezos is preventing it from making direct contact with drumpad, or that I burned out the teensy pins because I didn't have additional resistors in place.

Any help at all would be great. Please see sketch and images below.
IMG_1188.JPG
IMG_1188.JPG (127.64 KiB) Viewed 678 times
Sketch:

Code: Select all

/*
  Piezo MIDI glove
  
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried, Phillip Burgess, & Becky Stern for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
  
*/
#define LED     11 // Pin for heartbeat LED (shows code is working)
#define CHANNEL 1  // MIDI channel number

int note;
const int indexFinger = A0; // the piezo is connected to analog pin 0 (aka F0)
const int middleFinger = A1; // the piezo is connected to analog pin 1 (aka F1)
const int thumb = A2; // the piezo is connected to analog pin 2 (aka F4)
const int pinkyFinger = A3; // the piezo is connected to analog pin 3 (aka F5)

const int pins[] = {thumb, indexFinger, middleFinger, pinkyFinger};

//char Keys[] =   {'z','x','c','v'};

boolean currentPressed[] = {false, false, false, false};

const int threshold = 40;  // threshold value to decide when the detected sound is a knock or not

void setup()
{
   pinMode(LED, OUTPUT);
  // We dont have Serial or Keyboard available in MIDI mode!!!
  //while (!Serial)
  //Serial.begin(115200);
  //Serial.println("start");
  //Keyboard.begin();
}


void loop()                    
{ 
  for (int i=0;i<4;i++) {
    delay(1);
    long total1 = 0;
    long start = millis();
    long total =  analogRead(pins[i]);

    // check if we are sensing that a finger is touching
    // and that it wasnt already pressed
    if ((total > threshold) && (! currentPressed[i])) {
      //Serial.print("Key pressed #"); Serial.print(i);
      //Serial.print(" ("); Serial.print(Keys[i]); Serial.println(")");
      currentPressed[i] = true;
      //Keyboard.press(Keys[i]);
       //note = LOWNOTE + (i & 0x0F) * 8;
      usbMIDI.sendNoteOn(60+i, 127, CHANNEL);
    } 
    else if ((total <= threshold) && (currentPressed[i])) {
      // key was released (no touch, and it was pressed before)
      //Serial.print("Key released #"); Serial.print(i);
      //Serial.print(" ("); Serial.print(Keys[i]); Serial.println(")");
      currentPressed[i] = false;
      //Keyboard.release(Keys[i]);
      usbMIDI.sendNoteOff(60+i, 0, CHANNEL);
    }
    
    delay(5);
  }
  while(usbMIDI.read()); // Discard incoming MIDI messages
}


Thanks,
Kyle

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Teensy 2.0 Piezo Drum Help

Post by adafruit_support_mike »

Post a photo showing your connections to the Teensy please. Nothing in the setup you've shown should make a board heat up.

User avatar
KyleMohr
 
Posts: 17
Joined: Wed Jul 29, 2015 11:49 am

Re: Teensy 2.0 Piezo Drum Help

Post by KyleMohr »

IMG_1204.JPG
IMG_1204.JPG (160.36 KiB) Viewed 638 times
Here you can see all using a common ground, also shared with an LED for power indicator, the LED goes to 220 OHM 1/4W 1% Metal Film Resistor then to the VCC. Each piezo's active line goes to analog 0, 1, 2, 3 respectively.

Besides the heating, my main concern is that no signal from the piezo is being read via MIDI.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Teensy 2.0 Piezo Drum Help

Post by adafruit_support_mike »

The two problems are probably related.

As a sanity check, measure the voltage between VCC and GND on the Teensy, and check continuity between the sense lines and VCC/GND.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”