I have a problem with this "knock sensor". Piezo disc is glued to a wooden surface and it's signal is amplified by a factor of k=1M2/51k + 1 and then compared to a reference voltage on R12 using comparator.
Both op amp and comparator are in the same package, in this case LPV802.
The problem is I don't ever get high output at RB0. I suspected that maybe 1M2 for R12 is too big so I put fixed voltage divider using 10k resistors so I have 2,5V fixed voltage reference at comparator.
I measured expected output voltage from the first op amp, in the range from 0V to 3-4V depending on the force on piezo but when that 3-4V is compared to the 2,5V reference I don't get high voltage, I only get cca. 100mV when "knocking" and around 20mV when not.
I also tried combination of R11 and R10, 600k - 51k, and 600k - 25,5k. Also I replaced LPV802 dual op amp with some other opamp that are both input and output rail to rail like MCP6002 and MCP6232 but the behaviour is identical.
Zener diode is here to limit the piezo voltage to around 4,7V and it tested OK.
Also, I now know that I should have used separate comparator IC rather than op-amp but the PCB is already made and as I don't need very high speeds I don't think that should be a problem here.
Does anybody have a clue what might cause this strange behaviour?