To eliminate the 'messy' turn-off entirely and have a snap-action turn-off instead (which might make the AVR happier), a bit of positive feedback can be applied with a third transistor and a second cap :-
In this circuit the second 100k resistor is unnecessary. When T2 starts to turn off, the rise of J3-4 is coupled through the 10nF cap to turn on T3 and so short the 10uF cap to ground, thus turning T2 fully off rapidly. The 1N4148 provides a path for the 10nF recharge current.
The alarm trip delay here is ~4 secs, i.e. is ~ 0.4*C, where C is in microfarads (assuming R=100k and the AVR pull-up = 10k).
In this circuit the second 100k resistor is unnecessary. When T2 starts to turn off, the rise of J3-4 is coupled through the 10nF cap to turn on T3 and so short the 10uF cap to ground, thus turning T2 fully off rapidly. The 1N4148 provides a path for the 10nF recharge current.
The alarm trip delay here is ~4 secs, i.e. is ~ 0.4*C, where C is in microfarads (assuming R=100k and the AVR pull-up = 10k).
Last edited: