Go Down

Topic: PIR activated speaker advice (Read 993 times) previous topic - next topic

insertwittyname

I'm trying to turn a speaker off when a PIR sensor detects motion, but have been having some trouble.
I'm guessing the best route is to have the PIR sensor activate a relay that is between the speaker and amplifier, no?
I have had some success activating a relay with my Arduino, but so far, I'm struggling to get the code right this time.
Anyone able to help me with the code by chance? It seems like it should be simple. Perhaps I'm just missing something...
If anyone has an existing bit of code to accomplish this, please help!

Grumpy_Mike

Quote
Perhaps I'm just missing something

We will never know unless you post the code, please use the #icon when posting code.

thebfs

get a relay board thet take a 5v signal low some high to activate. i would use it to turn the amp off.

if(pirSensor == HIGH) // most standalone sensors will give this keep in mind they usualy need                                // to stabilise  to the enviroment.
{
   digitalWrite( relayPin, LOW);
}
thats all u really need arduino vin gnd and signal to relay is all you need

Go Up