...
Great stuff
...
Thanks gnuarm! That circuit looks perfect. I will of course do software magic to only make sure that putting down a glass won't trigger it. And if it does, then worst case is that a small candle is lit
I tried your circuit in the falstad online circuit simulator, and it seems to work great there. I don't have access to a lab because of corona.
2 questions:
How do I calculate the cut-off frequency of the filter? 1/(2*pi*R4*C1) ? Do I need to consider R3? I think it may depend on the mic, PCB and mic-placement where on the frequency range its easiest to detect claps.
The mic is near to a voltage source (1 kohms) so it is treated as a ground for calculating impedance in the RC. You can add it to R3 if you want to be more precise. Then use the parallel resistance equivalent of R3 and R4. This is because they are acting as a voltage divider. The Thevenin equivalent is the voltage at the R3,R4 junction in series with the paralleled resistance. If you are not familiar with that search on Thevenin and there are tons of resources. That is the resistance to use with the C to get the corner frequency. But it won't be a sharp rolloff because the output is 1 - A*Vin. Even if it was direct it wouldn't be sharp, but this is different still. Since you don't know the dominant frequency of a clap it will be experimenting anyway. With the components given the corner is about 200 Hz.
In low power mode, the output of the mic is 0V. In the circuit simulator this causes a high output of the opamp. I'm therefore concerned about the power drawn due to R5. Any reason of having such a low resistance, could I increase to 1M with no change of behavior?
You may not need R5, but the output won't stay driven high when the mic goes to ground. R5 is there to assure the output goes low when the input is trying to drive it below ground. Op amps can do funny things as the output goes to the rails. Often their drive capability is limited, so the pull down.
Your simulation has to wait for the cap to discharge, then the output will also go to ground and no more current in R5. But you can make R5 bigger. The only rule is when you modify the gain setting resistors, keep R1=R3 and R2=R4. That's not actually a hard requirement, but it makes the circuit easy to analyze. Different values in the same ratios R1/R2 = R3/R4 give the same output but present different resistance at the op amp inputs (to balance the input offset current impact) but that's not important in this circuit. Different ratios give a different gain for the two inputs which will mess with the operation of the circuit.
Ignoring that the inputs to the op amp are both connected to the mic consider them separately. The output of the circuit without the cap is just G * (A-B) where G is the gain (R2/R1) and A and B are the voltages at the two inputs (where the mic is connected). So with both inputs connected the output would be zero. When the cap is included the A input gain drops at higher frequencies. At DC both inputs are the same so the output is zero. At frequencies well above the corner frequency the A gain is zero making the circuit just G * B. Since the bias point (DC gain) is zero, the AC signal is centered at ground. Without a negative supply that means the signal is positive only.
So make sure you pick an op amp that is ok driving the output to ground. Don't go by the part number on the schematic. That's just one I picked from the LTspice library that worked. First I had to go through a bunch that didn't work!