In the figure we show a circuit for sensing vibrations using a piezoelectric sensor for this purpose. The gain of the circuit is basically given by R2 while the resistor R1, together with R2 determine the reference voltage for switching. The circuit can be supplied with a voltage of 5 V which makes its output compatible with TTL logic, and a pull-up resistor on the receiver side is used. Note that this circuit can be used in remote sensing, using common cables.