I have put up a simple circuit to control the living room lights.
The former light switches (230V) are working with a 5V relay currently driven by its own power source (in a desperate try to work out the problem) a 9V battery, the schematics are similar to these:
http://arduino.cc/playground/uploads/Main/relays.pdf [although I think I’ve missed the point of “GND” in the schematics as I’ve only connected the “RELAY power GND” just to arduino’s ground]
The pin driving the relay is pin 3 (irrelevant to the case).
I’ve also put an electret microphone with a 2n3904 transistor amplifier being read at analog pin 0.
The code is a modified version of this:
which perfectly fits the needs.
The problem I’m facing is that whenever the relay is turned on, the microphone readings spike every now and then and (the whole mic thing works as a trigger) they are understood as claps.
Don’t know what more to try, I’ve searched google for the past few days and the most valuable resource I could find was this post about “Understanding grounding” (http://jeelabs.org/2011/12/06/how-grounding-works/). If someone could point me in the right direction I’d be greatly appreciated