In my current project I am using a piezoelectric element to detect vibrations of an object. In a test sketch I can easily trigger an event by polling an analog input where the piezo is attached, but for my actual project the code is too busy to constantly be executing analogRead.
My needs can be met perfectly by using an external interrupt on pin 2, and the code works fine when I substitute a button for the piezo. My difficulty lies in getting the piezo to reliably trigger the hardware interrupt.
I have tried using a single NPN transistor as well as a Darlington pair with the piezoelectric element, and I haven't been able to get the interrupt to reliably trigger.
Is there some other way I can use transistors, capacitors, op-amps, et cetera to amplify or strengthen the pulse from the piezo? Thanks for your help.