How to properly setup an undefined numbers of piezos for drumming ?
I'm currently into a really cool project which gives me quite hard times. To begin, I'm a big noob in electronics, but I'm decent in programming. So i'm able to understand, learn or correct myself easily when it's about code, but I'm really in the dark for everything concerning electronics despite the fact that I read so much about it recently...
My goal is to make my own MIDI drum kit. Not a new idea, but the difference is that I want to use lot of pads. I bought some WII, XBOX and PS drum kits that I disassembled to get just de pads.
Then I bought an Arduino Uno, not a mega because I'm a beginner and I can totally start with a small amount of pads, also I wanted the perfect solution in terms of compatibility etc.
STEP ONE : 1 pad
So, I first made a prototype with 1 pad, which was very easy to do, since there is billion of officials and unofficials tutorials about how to connect a piezo to the Arduino. So basically, on my breadboard its like that (except im on A0 not A2) : http://learning.codasign.com/images/1/1e/Piezo_arduino.png
So I connected my pad to the Arduino with a 1 Mohm resistor in parallel and I made a program which function very very well. You can read it the : http://codeshare.io/VzUGn
The only challenge here was to set proper threshold and delay so the signal is clean when I hit the pad with a drumstick, to integrate the MIDI library and finally to find a software that makes the informations i send available in any of my favourites music softwares (Ableton Live, Maschine, ...), this software is Hairless Serial to MIDI, btw.
STEP TWO : X pads
It's when I'm getting troubles.
At first I believed that all I needed to do was to reproduce the same schematic but "duplicate it" x times. So I tried with 4 pads. I used the same strategy on my breadboard : each pad is connected in parallel with a 1 M ohm resistor, but all are connected to ground. You can see it there : http://oi57.tinypic.com/aymsli.jpg
The code, take the old one, but just loop on the 4 pins : http://codeshare.io/8Tb6z
So here are the 2 issues :
- The pad on the left is OK, like with my 1st program, the second one is still ok, the third one I have to hit a bit hard, the fourth one I have to hit VERY hard.
- When I hit a pad, it seems it send electricity in others pins, I say that because when i connect the Arduino to a music software, hiting a pad = having multiples notes at the same time.
For the hitting force issue, I'vre tried to play with resistances, puting higher or lower values and I got totally lost with that : nothing seemed to be better. About that "leaking" issue, I thought it could be useful to put some diodes, as i heard diodes are usefull when you want to make the current going in one way only, but when i watch some others schematics, i see no diodes and only 1 Mohms resistors everywhere, so I really don't know what is wrong and what to do.
Here is the MIDI xylophone someone made and posted on instructables : https://cdn.instructables.com/FB6/VMRG/H4AGICO1/FB6VMRGH4AGICO1.LARGE.jpg
I have no idea why this is working and why there is ground directly linked to these analog pins, and many other things i cannot understand.
Any help would be really appreciated ! :)