# Help needed for dual PIR motion sensor

Status
Not open for further replies.

#### San44

##### New Member
Hello All,

I'm trying to get a circuit for PIR motion sensor. i'll need to use 2 sensor's - first in a single trigger mode and the second one is countinuos trigger mode.

First sensor will trigger the light and will remain on untill the (less)delay set for the first PIR. If any motion detcted on second PIR again the high input goes to OR gate and will keep the lamp on (doenst matter if the delay expired for the first one lamp will be on).

If there is any motion detected on first again it will trigger and switch off the light. (Counter is meant for deactivating the connection )

I'm looking to have it in rest room. First one is right under the rest room door and the second one will be just before the shower area.

Any help will be greatly appreciated.

San

#### Attachments

• 70.5 KB Views: 603

#### alec_t

##### Well-Known Member
Is the rest room single-occupancy, or multi-occupancy?

#### San44

##### New Member
(Counter is meant for deactivating the connection ) - while leaving the restroom.
3.3 V battery in diagram represent the out pur from PIR sensor.

#### San44

##### New Member
I have made few changes. Replaced Q3 - BC547 with 3904.Am i good to use 3904 transistor to drive the relay ? please let me know if you have any suggestions?

#### Attachments

• 40.1 KB Views: 337

#### alec_t

##### Well-Known Member
I don't see the need for Q1,Q2,Q4,Q5. Can't the PIRs drive CMOS logic circuits directly? What is the Vdd voltage?
Your 4017 is configured such that it will output a logic high to the OR gate only when the count is 2 ??
Do you need a counter at all? There is a risk that if a spurious PIR pulse occurs the counter will stay in a non-reset state (so the light will be left on) after a person has left the washroom.
How long does a PIR output stay high when triggered?
How much current does your relay coil draw? Although a 3904 is probably adequate its base current should be about 1/10 the coil current. Standard CD4000 CMOS may not be able to drive the base properly. Consider using 74HC CMOS logic instead.
R8 is unnecessary; the OR gate can turn off Q3.

#### San44

##### New Member
Thanks for your reply. i apologize for not giving enough info. After replacing the Q3 its working like a champ. Counter output i made it that way to just make sure the counting is working. I tried with 1 count, thats also working fine.

The first PIR will be in single trigger mode - should be equal to a single high pulse when motion is detected.

The second will be in continuous trigger mode and the out put will be high and stable for a predefined time - (0-200s ) when motion detected and will reset the timer for any motion within the delay time. ( i was thinking for a 180 sec delay for the second PIR)

Vdd is 5v
PIR out put is 3.3 v for high

Data sheet for PIR below

Last edited:

#### San44

##### New Member
If you don't mind can you please let me know the advantage of 74HC02 over 4071?

Are you saying the PIR output should feed directly to OR (74HC02) ? if so i think both the PIR has to be in a continues trigger mode isn't it ?

Last edited:

#### alec_t

##### Well-Known Member
the advantage of 74HC02 over 4071?
I think you mean 74HC32 (the 74HC02 is a NOR gate, not an OR)? The 74HC logic series can source or sink about ten times as much current as the CD4000 series.
Are you saying the PIR output should feed directly to OR?
Yes, if you want to use an OR. But do you really need to? According to the spec of the PIR it has a range of 7m, so providing your restroom is under 7m wide/long can't you get away with using just one PIR (in continuous trigger mode)?

#### San44

##### New Member
Yes, 74HC32. Sorry for the confusion. The max delay we can set on (in continuous trigger mode) is 200 s ~ 3 min. and the 7M is the range . For my rest room the length is on the higher side. width & height on the lower side too . thats the reason why i was thinking about 2 sensors.

#### alec_t

##### Well-Known Member
Here's how I would do it, with the PIR near the door set for ~1min delay, the other PIR set for max delay, both PIRS set for continuous trigger mode. D1/D2 form an OR gate.
I don't see the need for the counter or any latch. The light would go off ~3 mins after the last movement was sensed.

#### San44

##### New Member
Thanks Alec. Also the data sheet says there is a 1 minute initialization time for PIR and during this time it will send multiple high pulses to output. Not sure how to handle have got a power back up for home so don't think it matters much

#### San44

##### New Member
If you can program a PIC you may want to consider the PDAC circuit I use in my LED lighting system. I have two connectors MS1 and MS2 for Parallax PIR motion sensors. Use any of the input/output connectors and a simple interface circuit to connect to the relay. Program the PIC for logic/timing. You won't need the network circuitry.

Here is the schematic;
http://www.electro-tech-online.com/attachments/led-power-distribution-and-control_rev-b-pdf.85593/
Thanks for the reply. I actually have one Arduino board and of course its flexible to handle delay and output but just want to do it with the network circuitry

#### croberts

##### New Member
One nice thing about putting a microprocessor between sensors and load is if you want to change logic or timing you don't have to start over with a new build or rewiring what you have. Also usually the parts count and cost is the same or lower. PIC16F690 a 20 pin device about $5 -$6 and you don't need any external circuitry (osc, reset, etc) to make it work. Just stick a 20 pin socket on the board and interface circuits for sensors and load and your ready to go. The downside is you have to know how to program the PIC and have/get the developement tools (IDE, Programmer, etc). In any case good luck with your project.

Thanks Roberts !

#### San44

##### New Member
Here's how I would do it, with the PIR near the door set for ~1min delay, the other PIR set for max delay, both PIRS set for continuous trigger mode. D1/D2 form an OR gate.
I don't see the need for the counter or any latch. The light would go off ~3 mins after the last movement was sensed.
View attachment 85655
I made it on the breadboard. had to replace few resistors. May be i was using 5V instead of 6 as you suggested.

#### alec_t

##### Well-Known Member
Not surprised. Transistor gain and relay choice determine those. Hope it works as required.

#### San44

##### New Member
Yes it does . Thanks for your help !