Interrupt-based triggers for analog sensors

I’m trying to write an interrupt-driven piezo sensor. The samples in the playground are a good start, but my project needs an interrupt-driven approach to work. Functions like “attachInterrupt” expect to see a >>digital<< port as input so I need to translate that analog output of from a tap on the piezo into a (TTL i assume) line-high or line-low on a digital port.

Any advice from anyone?

Seems like I should be able to do the following:

  1. Carefully measure the voltage and amperage from a standard “tap” given to the piezo
  2. Find an IC with an embedded Schmitt trigger that has a hysteresis that matches the voltage threshold
  3. Plug that into the circuit and hook the output into the digital port on the arduino
  4. Tell attachInterrupt to fire off an interrupt when that port does the right thing (i.e. goes low or high etc…)

Specifically, I’m asking:
A) Has anyone ever done this before? If so, what technique did you use?
B) If no one has done this, any good suggestions on the model numbers of ICs that have low trigger voltages?

Thanks very much. :smiley:


I don't think you don't need anything complicated: a standard 29 cent op-amp will amplify voltage ranges in the millivolts. The general task is basically to add a little gain and clamp it at 5v, so in essence you turn the wavy piezo voltage into a nice square 5V pulse. try an op-am p set to a gain of 100, and powered form a 5V supply. Some say also that you should have a zener across the piezo, to clamp the potentially nast voltages the piezo generates momentarily, but in practice i have never damages an IC with one.

You could also try something like this ingenious solution: Only requires a 4069, a diode and a couple of parts... Only real old school engineers think of solutions like that. It's excellent actually.