PIR Sensor and relay problem

Hello to All,

I am brand new to arduino and have a project that is hanging me up. My goal is to hook up 3 PIR sensors through my arduino uno to be able to trigger one 110v power supply have it run for for a set time and then turn off.

I found an example of this using one sensor thinking if I could make this work I could just hook up two more sensors and adjust the code a bit but............
I have everything hooked up as shown on the webpage below however I have a constant on, the PIR doesn't seem to be registering......any thoughts?

I got my schematic and code from here (http://howtomechatronics.com/tutorials/arduino/how-pir-sensor-works-and-how-to-use-it-with-arduino/)

Thanks,
Joey

Hi, and welcome to the forum.

Prepaire three pins for the three PIR sensors, e.g. like this.

int pirSensor1 = 8;
int pirSensor2 = 9;
int pirSensor3 = 10;

Do the same for the three pinModes.

pinMode(pirSensor1, INPUT);
pinMode(pirSensor2, INPUT);
etc.

And for the three sensorValues.

int sensorValue1 = digitalRead(pirSensor1);
etc.

If you want the output to be acitvated by sensor1, or 2, or 3, use the "OR" operator.

if (sensorValue == 1 || sensorValue2 == 1 || sensorValue3 == 1) {

That can be shortened to...

if (sensorValue || sensorValue2 || sensorValue3) {

The code (from the website) relies on the "ON" timing of the PIR.
The Arduino could could do that more accurate with a "delay" (for the "ON" duration) and an "else" statement (to turn things off).
See the various examples that come with the IDE.

If you use the Arduino for the timing, then turn the "time" pot on the PIR fully anti-clockwise.
Leo..

Hi,
Welcome to the Forum

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile: