Multiple Piezo discs thru Mux to make E-drum

I'm using 2 Piezo discs to start making an E-drum with Arduino Pro Micro. In the end I want to have 11 Piezo discs so I'm using a 16-Channel Analog Multiplexer. Now I have 2 Piezo discs wired-up with each a resister and connected my Arduino with MIDIUSB plugin to a Logic Pro drumset and gave each Piezo it's own note. But when I tap Piezo disc 1 it plays both notes, the same for Piezo disc 2. Is it possible that the 16 inputs in the Analog Multiplexer are always read together?

This is my Arduino code:

#include "MIDIUSB.h"

const int muxAnalogPin = A0;

const int s0 = 2;
const int s1 = 3;
const int s2 = 4;
const int s3 = 5;

const byte SNARE_CH = 11;
const byte KICK_CH  = 3;

const int snareNote = 34;
const int kickNote  = 42;

const int threshold = 70;

int peakSnare = 0;
int peakKick  = 0;

bool snareHit = false;
bool kickHit  = false;

void setup() {
  pinMode(s0, OUTPUT);
  pinMode(s1, OUTPUT);
  pinMode(s2, OUTPUT);
  pinMode(s3, OUTPUT);
}

void loop() {
  handleSnare();
  handleKick();
  delay(2);M
}

void handleSnare() {
  selectMuxChannel(SNARE_CH);
  delayMicroseconds(5);
  handlePiezo(muxAnalogPin, snareNote, peakSnare, snareHit);
}

void handleKick() {
  selectMuxChannel(KICK_CH);
  delayMicroseconds(5);
  handlePiezo(muxAnalogPin, kickNote, peakKick, kickHit);
}

void selectMuxChannel(byte channel) {
  digitalWrite(s0, channel & 0x01);
  digitalWrite(s1, (channel >> 1) & 0x01);
  digitalWrite(s2, (channel >> 2) & 0x01);
  digitalWrite(s3, (channel >> 3) & 0x01);
}

void handlePiezo(int pin, int note, int &peak, bool &isHit) {
  int value = analogRead(pin);

  if (value > peak) {
    peak = value;
  }

  if (value > threshold && !isHit) {
    isHit = true;
    peak = value;
  }

  if (isHit && value < threshold / 2) {
    int velocity = map(peak, threshold, 900, 40, 127);
    velocity = constrain(velocity, 40, 127);

    noteOn(note, velocity);
    delay(5);
    noteOff(note);

    isHit = false;
    peak = 0;
  }
}

void noteOn(byte pitch, byte velocity) {
  midiEventPacket_t event = {0x09, 0x90, pitch, velocity};
  MidiUSB.sendMIDI(event);
  MidiUSB.flush();
}

void noteOff(byte pitch) {
  midiEventPacket_t event = {0x08, 0x80, pitch, 0};
  MidiUSB.sendMIDI(event);
  MidiUSB.flush();
} 

This is my setup:


Please tell me you haven't simply stuck those Dupont connectors through the holes and expected the electrons to magically jump over the air gap between the pin and the side of the hole.

Maybe I did, i'm not the best at Arduino and it's my first time using an Analog Multiplexer, so any tips would help..

Excuse me?

Did you, or didn't you?

I've read on other topics that there are other people with the same problem as me, and they most likely connected their multiplexer correctly, so the real problem probably doesn't lie there, because mine works, it only reads all the 16 channels at once (i think..) and not the channel with the piezo that is being hit.

Since you are so knowledgeable on the subject, I'll leave you to it.

This is known as cross-talk, and to be expected when using high impedance sensors
(I assume you have a 1Megohm resistor across each piezo).

The only way to fix this is by buffering each piezo with an opamp.
Use a general purpose quad opamp like the LM324.
Leo..

Solder the header pins to the board.

Yes, one problem is lack of soldering the connectors.

No, it does not...

Solder your pin headers.

Did your board even come with pin headers?

(The three spiky looking things in the photo.)

No it did not, but i have some laying around i think

Should it be soldered like this?

Yep. Then plugged into the breadboard and connections made from there.

thank you guys for all the tips and help! much appreciated! I soldered the header pins to the Mux. Now Piezo 1 has a clearly snare sound and piezo 2 has a clearly kick sound, but there is still some cross-talk. sometimes piezo 2 gives also some snare and piezo 1 sometimes some kick.

The disadvantage of using piezo sensors. Have you tried to lay them on a bit of foam so they don't vibrate together ?

What value bleed resistor did you use across the piezo.
1Meg is common when used as microphone, but you can lower sensitivity and cross-talk with lower values. Try 100k or even 10k.
Leo..

Edit: I think I see resistors in series with the piezo. They must be in parallel.

resistor is connected to the GND with one leg and the other leg to the piezo. other leg from the piezo goes to a channel on the Mux.

Now I connected the piezo's with each a 1Meg-ohm in parallel. When tapping the snare piezo soft it gives only snare sound, but when I tap it normal it gives also kick with it. The same for the kick piezo. I tried blocking out the weak signal and only giving the strongest thru but that still doesn't solve the problem

Did you try lowering those resistor values? (post#15)

Yess. I lowered the resistor values to 100k resistors and when 2 piezo's were wired up the so-called cross-talk was gone, but when i wire up all the 11 piezo's there is back cross-talk.