Simple diode compression circuit for piezo
I will try this to see if it gives me cleaning data.
Diode compression network...That's something I'm going to have to research. How does it work? I'm currently trying to figure out how to keep my piezo signal from going below -1.65v or above 1.65v.
Is it safe to assume I don't need any protection diodes between the op-amp and the ADC. The op-amp can't output voltage outside of the range of the two supply voltages, can it?
You can't be sure if you need all that filtering? I've basically turned a Teensy 3.2 into a digital scope and I send transient data to an application I coded and display the waveform on my screen. Here's a sample of a transient from a mesh drum pad. The signal is sampled every 50 microseconds.
View attachment 15049
If you power your op-amp with 3.3V, perhaps straight from Teensy's 3.3V pin -- well some supply filtering as suggested would be good -- you won't have to worry about having voltages outside of range of the ADC pins on the teensy, regardless of what comes in as a signal to the op-amp. Of course, you'll have to restrict the signal range coming into the op-amp to whatever voltages it's spec'ed to handle. That's what the diode compression network is for.
Enclosed below is a basic sketch of a simple diode compression piezo conditioning circuit that centers the signal around Vcc/2.
R1 & R2 should be set to the same value (say 1K) to get that halfway point. The piezo base (the brass plate) is attached to the centerline voltage point. R3 should be something like 100K. This resistor helps establish a DC bias path for that center voltage. The R4 resistor sets the "looseness" or "tightness" of the diode compression. If you set R4 to 0 ohms, then the voltage swings coming in from the op-amp are clamped to -0.7/+0.7 around the centerline (depending on the type of diodes used.) If you set R4 to something higher, say 22 ohms, then it loosens up the swings to higher voltages, and clamps really high stuff to within +/- 1.65V (EDIT: around the centerline, so the voltage range is really 0 to 3.3V with 1.65V being the centerline). You can adjust the resistor higher to give higher swing ranges. Too loose and high voltages get through. You have some leeway if you have a series resistor after the network (like we show), which helps in the case of the piezo voltages, which are short-lived and have very little oompf to them.
Best to simulate this circuit to get a feel for what it does, and also try it out on a breadboard and set the resistors as needed for your situation. More sophisticated approaches can be used (which I use but am not at liberty to show) to yield more nuanced and versatile compression behavior. The simple circuit shown here is not optimum, but might be satisfactory as a piezo drum trigger circuit.
I show a lowpass filter after the compression network. Best to have something to get rid of high frequency noise coming from piezo cable so the op-amp doesn't have to deal with it. The series resistor also adds some protection as mentioned earlier.
You might also have a lowpass filter just before the ADC pin to get rid of any other trash picked up in the circuit and/or to serve as anti-alias filter. In my experience, keep the impedance low coming into the ADC, (say, less than 5K resistance for example -- lower is better) otherwise the Teensy ADC may not be a happy camper and you'll get weird bias voltages building up on the ADC pin (that's been my experience anyway. I've not had anyone explain what's going on there.) The buffer helps greatly in this regard, and so does using a modest resistor value for the final low pass filter.