So I've been trying to build a clap detector which switches a relay on and off when a clap is detected. I ended up with this schematic (modified from some website)
. As far as I can tell, it amplifies whatever the microphone puts out, triggers the 555 which sends out a pulse to the clock pin of the 4017, making Q1 go high. When another clap is detected Q2 goes high, resetting the 4017 back to 0. If I disconnect Q1 from the resistor and check the state of Q1 with an led to ground then things work as expected, it turns on when I clap once and turns off when I clap again. However, if I attach Q1 back to the resistor - enabling the relay -, then whenever I clap Q1 goes high and within a few milliseconds it goes low again as if it had reset itself! I've messed around with the resistor value and adding a diode across the relay without success. Does anyone know what could be wrong?