Piezo midi drum trigger module with Teensy 4.1

Status
Not open for further replies.

Lestra

Active member
Hy everyone, Lestra here, 59 year old drummer who wants to build piezo/drum trigger module (to get midi output from piezo) but I am so scared :confused: because I know almost nothing about using Teensy so please be gentle.

What I have so far

  1. Teensy 4.1 (new) and recommended Accessories: USB Cable, Pins 24x1 (2), 8MB PSRAM, USB Host Cable, Ethernet Kit
  2. Protoboards, power supply 3.3V/5V, soldering iron...
  3. Piezzo, resistors, capacitors, diodes, op-amps...
  4. Don't have osciloscope, only Digilent Waveforms software in combination with soundcard (EMU 1820M)...

Trigger module will be connected to PC via DIN Midi, USB Midi or via LAN if possible, whatever gives lower latency. On the PC side, soundcard can go down to 2ms latency with no problem.

Watched many videos and read some topics here on forum so it is time to start with project.

My first question is about Piezo Signal Conditioning. This video:
https://youtu.be/y2Lmbts9IIs
show how to build piezo conditioning circuit with some resistors, caps, diodes and LM324 as a buffer but someone comment that this is an old 80's style solution and sugest:

"This is not a great way to do Electronic drums. Maybe in the 80's. Considering you have a teensy 4 it's best to do all that stuff in software and use advanced filtering so you can do waveform analysis and do positional sensing and whatnot. There is a lot of information that you lose by not giving the teensy a proper AC signal...The teensy 4 can easily do one million ADC reads per second and you can do advanced filtering (bessel, chebyshev, etc) and a bunch of other stuff while it's waiting for the ADC reads to finish...You can find everything you need on the teensy forum. I suggest looking for the ADC library where you can set more advanced ADC settings."

Here is schematic from video:

signal-conditioning.jpg

Is this approach any good or is there better way to condition piezo signal for Teensy 4.1? That is my starting question. I am so happy to be here and thank you so much in advance.
 
You can certainly have much simpler interfacing to the piezo sensors and do more signal processing in software instead - this reduces
hardware cost and complexity, which for mass production is a no-brainer, but if you are building a one-off its arguably better to do
what's easiest for you (if you are new to DSP the opamp approach might be much easier).

Piezo elements are basically ceramic capacitors that act as current sources when flexed (actual ceramic caps also behave the same,
but are harder to flex(!)).

Thus their voltage is ill-defined unless a resistive path is provided, and you don't want to negative voltages on your ADC pins, so the
simplest interface circuit is:
piezo_if.JPG
10k protects the input pin from excess current if the voltage goes too high or low, and the value R needs to be chosen to set the
sensitivity (lower values give lower sensitivity, perhaps try 100k first). The two R value resistors act as a voltage divider putting the
input at halfway between the supply rails for maximum signal swing.

In software you'd subtract off the baseline voltage to provide a bipolar signal - then perhaps taking the absolute value to be able to
detect either polarity of impulse from the sensor.
 
Thanks Mark. I already tried op-amp circuit and output it to soundcard for testing (did not played with Teensy yet). It was easy job but I worry is it fast enough. I would like to get max 5ms roundtrip latency (from piezo to loudspeaker).

Please tell me does your circuit eliminate negative voltage from signal and is Vcc in your schematic power supply for Teensy actually?
 
Thanks Mark. I already tried op-amp circuit and output it to soundcard for testing (did not played with Teensy yet). It was easy job but I worry is it fast enough. I would like to get max 5ms roundtrip latency (from piezo to loudspeaker).
Reduce capacitor values for faster response perhaps? 10nF does seem very high to me.
Please tell me does your circuit eliminate negative voltage from signal and is Vcc in your schematic power supply for Teensy actually?

Yes and yes, that's exactly the point - swing around mid-rail, the supply rails are typically known as Vcc and ground, many other names exist,
for the T4 that means 3.3V and 0V.

I also would like to know is it possible to write code for different velocity curve types?
You'd have to explain that in detail. Piezo impact sensors will usually have response amplitude and speed strongly
correlated so there may be several ways to measure "velocity" from the transient signal.
 
You'd have to explain that in detail. Piezo impact sensors will usually have response amplitude and speed strongly
correlated so there may be several ways to measure "velocity" from the transient signal.


Thanks Mark. Velocity curves have to be implemented for dynamic response control (not in conditioning circuit). Here is example:

curves.png



Please note that I am looking to this project from musician point of view, sorry.
 
Last edited:
Ah, I see what you mean - a mapping between input value and MIDI velocity? That's all going to happen after you've detected a transient
and its amplitude/strength/whatever in the processing of the sensor input. All you need is a function(s) to implement the mapping(s).
 
Great, thank you Mark!

Piezo sensors will be mounted on acoustic drums and there will be a lot of vibrations and crosstalk issues. Do you think highpass filter in conditioning circuit will be good solution?
 
Status
Not open for further replies.
Back
Top