Electronic – Convert analog piezo “transition” to digital signal

level-shiftingpiezosignal processing

I'm trying to get what amounts to a knock indication into a microcontroller input from a piezo sensor. It's looking fairly good now at the fifth iteration, and about ready to provide digital levels for input to a 3v3 MCU.

I started with an "instrumentation amp" but changed that to a charge amplifier as suggested by @Circuitfantasist. Also based on a comment he made elsewhere, I then changed the hacked 'rectifier' I had before into a standard "precision rectifier". The third change was the addition of the RC pair and a diode to ensure the output stays high for a "little while" after the strike is first registered. The fourth change was the addition of the two-transistor schmitt trigger on the output. Change five replaced the discrete schmitt with an IC comparator using positive feedback for hysteresis and having an open collector output to get the levels set up right for the MCU.

Here's the circuit now:

schematic

simulate this circuit – Schematic created using CircuitLab

It seems to work quite well. Yellow is the input signal raw from the piezo device (the signal is essentially the ringing sound of a chunk of steel being hit with a hammer), blue is the output. It's intended to trigger an interrupt with the falling edge:

enter image description here

From here, I think it's ready to have the final output put into an MCU. If that actually changes anything, I'll update here.

As a side note, I learned a lot about verifying the 9v battery you're using is actually still good. This thing oscillated in most curious ways for a while, and I eventually realized that it was the supply rails drooping when things changed state, and that in turn was because my little PP3 9v battery was essentially dead, and putting out about 8.3v with no load. This also reduced the noise on the signal quite a bit. Oh, the joy of learning 🙂

Best Answer