Introduction: Arduino Controlling Multiple P.I.R Sensor on Same Bord
Today I will tell you how to connect multiple PIR Sensors with single Arduino Bord
>here i have also used 4 channel relay module for some extra functionality.
ARDUINO + 4 Channel Relay Module + 4 PIR Sensor (OR You can used as many pin your arduino has )
Step 1: Hardware Required
Step 2: Hardware Connection
Arduino________________TO_____________________PIR SENSORS(PIR1,PIR2,PIR3,PIR4)
Arduino PIN 3........................................PIR1-output pin
Arduino PIN 4........................................PIR2-output pin
Arduino PIN 5........................................PIR3-output pin
Arduino PIN 6........................................PIR3-output pin
Arduino 5v..............................................PIR1,PIR2,PIR3,PIR4(VCC )//connect all Vcc pin of pir1, pir2 , pir3 , pir4
//to the Arduino 5 v
Arduino GND..........................................PIR1,PIR2,PIR3,PIR4(GND )
ARDUINO________________TO________________________REALY MODULE
Arduino PIN 9.................................................................IN1 RELAY
Arduino PIN 10.................................................................IN2 RELAY
Arduino PIN 11...............................................................IN3 RELAY
Arduino PIN 12................................................................IN4 RELAY
Arduino GND..................................................................Relay GND
Arduino Vin.....................................................................Relay VCC
12 v -2A Power Supply .................................................to...........................................Relay Model 12v Input &GND (Some Relay Module Does not have 12 v power input so you need a 12 v to 5 v converter ......or you can distribute power by yourself .
Step 3: Programming Part
Here Programming is most important part
while in this project I face lots of problem in programming only.
- here i have used a Arduino internal pulled up resistor
- I used (IF-Statement) Without else Statement for stability
If you face any problem do not forget to comment
9 Comments
6 months ago on Introduction
I am trying to connect multiple motion sensors to the same relay with or || signs and it is just leaving the light on. I have If (lightVal<50 && motion3||motion4||motion5||motion6== HIGH)
digitalWrite(relay, HIGH);
delay(dv);
for some reason the light just stays on regardless of motion.
I also have an else of digitalWrite (relay, LOW);
1 year ago
I think you missed one combination, I see 15 and there should be 16 I guess.
In that case, the code can be simplified using arrays:
(the alignment is removed by posts sadly, replace ~ by spaces).
1 year ago
Hi, I have a question. I've read your code and I've seen that you did 14 "if cases" in order to control each PIR state. I was wondering if you could replace in the code these 14 structures with 4 if cases written as follow:
if (proximity1==HIGH){
digitalWrite(RELAY1, HIGH);
}
else{
digitalWrite (RELAY1, LOW);
}
1 year ago
cant see code
Question 1 year ago on Step 3
Hey I want to increase their time, and i don't want to add delay as it pause the program, also not from the PIR delay, is there any other option to increase their time?
1 year ago on Step 3
code please
Reply 1 year ago
Code is in the end.
Question 3 years ago on Introduction
How to add buzzer and gsm module for this
Answer 1 year ago
Have you already known how? I also need it for my project