Piezo-to-MIDI electric drum kit using simple/cheap components

Thread Starter

adavea

Joined May 9, 2016
2
Hi all,

I've been working on and off on an electric drum project for almost a year now. Progress has been slow but rewarding in terms of what I've learned about electronics and sound. However, it is taking quite a while, and I'm to the point where I am really ready to have some drums to bang on (my accoustic set is taunting me from my closet as we speak, but I can't play it as I'm in an apartment, ack!), so I'm hoping someone on here can help me finish this project up. I am a pretty proficient programmer, so I should (hopefully) be able to handle all of the programming parts once I get a reliable set of square/sine waves piping into my microphone port, but I'm happy to consider pretty much any alternative approach to getting this done. I'm hoping to keep things very cheap... probably $5 max per component if I need an IC or two, though usually more like $0.10 per component would be ideal. I might just break down and buy some arduino components if there's no easy way to do what I'm going for here with basic components and ICs.

---Ideal design---

In my mind a single drum head strike should work like this:
1) I strike a practice pad that has a piezo microphone taped to it
2) The piezo vibrates and generates a pulse
3) The pulse triggers a square wave generator
4) The square wave is output to an audio cable
5) The audio cable runs into my laptops microphone port
6) I use lingot or another program to read in audio signals in real time, and translate them into midi signals
7) I pipe the midi signals to a virtual midi device such as ez drummer 2
8) The virtual midi device outputs drum sounds from my speakers

The only differences for multiple drums would be:
1) Each drum head triggers a square wave of different frequency
2) The software that reads the square waves must be able to differentiate between these frequencies
3) The square waves must be sent together across a single output cable
4) Once the software figures out which frequency wave it is looking at, it must output a different MIDI note for each different frequency that it is seeing to the virtual midi device, so that every drum head doesn't result in the same drum sound being played

I may also need help:
1) Converting the square waves to sine waves, so that my computer doesn't detect all of a square waves odd harmonics along with the square wave itself. This would make the programming part a lot easier, though I'm pretty sure it isn't 100% necessary

My main sticking point at the moment is getting a clear audio signal to be generated from the piezo strike.

---Failure #1---

My initial approach was to use a 555 timer in astable oscillator mode (e.g. http://www.electronics-tutorials.ws/waveforms/tim47.gif) in order to produce a stable square wave. I piped the square wave into the collector of an NPN transistor where it was blocked from going any further until a current was applied to the base of the transistor. I then used a piezo disk as a microphone, ran its current through an audio amplifying IC (this might not have been necessary I'm not sure), then ran the amplified piezo signal up into the base of the transistor. This way, the piezo and the transistor acted as a switch that would only allow the square wave to travel through the transistor right after the piezo was hit. I attached the emitter of the transistor to an audio output cable, and plugged the audio cable into my laptop.

When I fired up my laptop and used "lingot" to figure out what frequencies I was getting, I unfortunately saw pretty much every frequency being activated at once. I am not sure why it happened (I'm really new to electronics), but I suspect this is because a bunch of current was being transmitted through the base->emitter path of the transistor and into my computer's microphone port every time I hit my piezo microphone. It could also be that the 555 timer wasn't actually doing anything until the transistor gave its electrons a path to go through, so once the transistor allowed electrons to flow it created that "pop" that often happens when unplugging audio equipment. If anyone knows what it was please let me know :)

After all the frequencies / the "pop" were detected, I tried piping my 555 timer's output directly into my microphone port instead of using the transistor as a gate, and in lingot I was able to see a square wave and it's harmonics, like so:

|
|
Db|
| | | |
|___|____|____|___
Hz
(My courier new formatting is not sticking here... basically this graph shows equally spaced frequencies of sound being picked up)

So, I know the square wave was probably making it through based on the fact that it was being detected correctly if I removed the transistor, but I still don't know what to do about there being so much interference with this design. After this first attempt/failure I decided to try something different...

---Failure #2---

The second design I tried was based on two 555 timers. One timer was basically just there to take a pulse from a piezo and to turn it into a "high" pulse that a second 555 timer could pick up. This first part was based on this: http://support.codeandcopper.com/hl/img/midi-cpu/midi-cpu-piezo-npn-555.png. I used the output of this 555 timer to basically act as the power supply for a second 555 timer in astable oscillator mode. The oscillating 555's output was then sent into an audio cable that connected to my computers microphone input. Oddly, in this design I also ended up with a lot of "noise" in lingot. It looked something like this:

|
|
Db|
|| |||||| |||| |
|||||||||||||||||
Hz
(My courier new formatting is not sticking here... basically this graph shows pretty much every frequency in a typical guitar's range being picked up all at once)

In other words, there was really no way to tell what square wave was being produced in lingot at all due the the amount of noise being added to the audio output. It's pretty much the same thing that happened in the previous design.

--Suspicions--

I know almost nothing about electronics, so this might sound ridiculous, but when I combine two separate circuits, am I getting some weird backflow or something from the ground wire that I'm connecting everything into? Should I run these two-parter circuits on two separate batteries or something?

--Conclusion--

So just to reiterate, I'm stuck on this drumset and don't really know where to go from here. If anyone wants to help but can't really wrap their head around this without diagrams, do you know of any good diagramming software I could use for this? I've used circuits.io in the past, but they are somewhat limited in that you can't use a piezo as a microphone in their simulator, otherwise I probably would have included some diagrams in here. Anyways, any and all help would be appreciated!

Thanks all,
Dave
 
Last edited:

Colin55

Joined Aug 27, 2015
519
"I know almost nothing about electronics, "
You don't need to know anything about electronics to design electronic circuits.
Just keep fiddling.
"Enough monkeys with enough typewriters will type the Bible. "
 

Thread Starter

adavea

Joined May 9, 2016
2
Ironically, it turns out that my second attempt actually worked great, I just needed to reinstall the software that I was using to detect the frequency that was being generated by the square wave, and also to turn down my microphone input a bit. Even more ironically, I left my circuit unplugged accidentally today when I was continuing my work, and the circuit turned out to keep working even without a 9V batter attached (lol). Apparently the piezo generates enough current to power the circuit long enough for the frequency to be generated and picked up by my laptop. So cool! Happy hacking everyone!
 
Top