# Adding a delay to a PIR motion sensor

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
Hello dear friends.

I need your valuable help for a little circuit I'm designing.

It is a small circuit to incorporate a delay to a PIR motion sensor that activates a spray that releases compressed air to drive away birds, cats, dogs etc. The detail is that once the sensor is activated, it will be inactive for 5 or 10 minutes (this will prevent it from being retriggered during that time). For space reasons (the PCB must have 2 "x 1.5") I have been trying to do it using only BC547 transistors. Anyway, a circuit with a classic NE555 would also serve me!

The PIR I'm using is a naked PIR without a stabilization circuit. Any ideas are welcome!

The circuit I have done so far uses a darlington array and keeps me on a led for about 30 seconds after activating the switch (which is supposed to act as a PIR sensor). I really do not have a clue where to start. I have done several circuits with NE555 in astable and monostable mode, but that if I keep an active circuit for a second and inactive for 5 minutes I have no idea how to do it. I have a lot of experience programming Arduino, PIC, Raspberry, IoT applications (I am at your command), but some basic electronics issues surpass me.

Thank you very much in advance.

Attached images and Proteus files of what I have done so far.

#### Attachments

• 24 KB Views: 13

#### Dodgydave

Joined Jun 22, 2012
10,139
Ideally you need a set of Normally Open contacts on your pir, so when it detects an object, the contacts close and triggers the timer. Here is a Monostable timer with a 555 Rt 47K and Ct 22uF set the delay, put your pir contacts on the circuit on the right to prevent further triggering when timed out.

#### AnalogKid

Joined Aug 1, 2013
9,621
So, to be clear, when the sensor is triggered the circuit makes a 1-second burst immediately, then inhibits itself for 5 minutes. After that time the circuit sits idle, waiting for another trigger. If the sensor is being triggered when the inhibit releases, the circuit makes a 1-second burst immediately and then inhibits for another 5 minutes. Yes?

A 600 second R-C timer circuit is not very stable, and requires a very low charging current for the capacitor. For example, one time constant would be 1 megohm and a 600 uF capacitor, with a peak charging current of only 9 uA at 9 V. Doable with a CMOS 555, but you actually need two timers - a 1-second pulse driving the output, and a 5-minute inhibit pulse that is triggered by the *trailing* edge of the output pulse. I would start with a CD4093 quad NAND gate. It can do both timers and the inhibit logic in one 14-pin package. Of course, you'll still need a fairly large capacitor, but something like 220 uF and 2.7 M might work.

How much current does the spray actuator (relay, solenoid, etc.) require?

ak

#### KeepItSimpleStupid

Joined Mar 4, 2014
5,090
Since your PIC savvy, why not use a PIC?

#### AnalogKid

Joined Aug 1, 2013
9,621
Agree.
Voltage regulator
8-pin PIC
Output transistor

ak

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
Ideally you need a set of Normally Open contacts on your pir, so when it detects an object, the contacts close and triggers the timer. Here is a Monostable timer with a 555 Rt 47K and Ct 22uF set the delay, put your pir contacts on the circuit on the right to prevent further triggering when timed out.
View attachment 127668
Great! Excelent idea!

The PIR needs a little stabilization circuit to prevent undesired triggering since the output of PIRs generally goes HIGH on power up for 5S, as they equilibrate the infrared field. This action generally has to be squelched or otherwise removed/disabled to avoid an unwanted activation of any following circuitry. Your circuit is very useful for this task!

Thank you very much for your answer!

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
Since your PIC savvy, why not use a PIC?
Agree.
Voltage regulator
8-pin PIC
Output transistor
ak
I agree with you. In fact, I have a similar circuit that works perfectly, programmed in PIC 12F675, but I prefer to leave it for more serious projects. In my Arduino, PIC and NodeMCU prototypes, I am tempted to solve everything using code, but sometimes I prefer to leave some work to the electronics, and I also learn something interesting along the way.

Thanks for your answer!

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
Hello!

Thank you for your response and your excellent advices!

So, to be clear, when the sensor is triggered the circuit makes a 1-second burst immediately, then inhibits itself for 5 minutes. After that time the circuit sits idle, waiting for another trigger. If the sensor is being triggered when the inhibit releases, the circuit makes a 1-second burst immediately and then inhibits for another 5 minutes. Yes?
Yes! That's exactly what I want.

Doable with a CMOS 555, but you actually need two timers - a 1-second pulse driving the output, and a 5-minute inhibit pulse that is triggered by the *trailing* edge of the output pulse. I would start with a CD4093 quad NAND gate. It can do both timers and the inhibit logic in one 14-pin package. Of course, you'll still need a fairly large capacitor, but something like 220 uF and 2.7 M might work.
Great! I did not know the CD4093. I had first thought of a 556 dual timer, but I was reviewing the datasheet and I was amazed at how versatile CD4093 is! It would suit me very well, because it accepts the CMOS range from 5V to 12V (my circuit uses a 9V battery).

What circuit would you have in mind? Any ideas would be welcome!

How much current does the spray actuator (relay, solenoid, etc.) require?
It does not need much current. The one needed to turn on a small led. I have tried my circuit in Proteus and in a small protoboard.

The PIR appears mounted on the photo, but before testing I disconnected it. Certainly that RC circuit is not very stable. I only managed to keep the led on for about 18 seconds after disconnecting the battery.

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
Check out Timer Blox from Linear Technology for the timing function.
http://www.linear.com/products/timerblox
Surprising tables!

I think the Wake-Up timer with push button control can be used for my issue and for other applications that I have in mind. I will check in detail to see if I get anything useful for the PIR sensor. In any case, it is an excellent source of information.

Thank you my friend!

#### AnalogKid

Joined Aug 1, 2013
9,621
First pass at a non-555 design.
R1-C1 make a 1 s output pulse.
R2-C2 set the 5 minute inhibit interval.
You can add a switch across R2 to reset/disable the 5 minute timer.

ak

#### Attachments

• 10.3 KB Views: 9
Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
Since your PIC savvy, why not use a PIC?
Agree.
Voltage regulator
8-pin PIC
Output transistor

ak
The code for ATTiny or Arduino is something like this (I share it in case anyone needs it):

Code:
#define TRIGGER_TIME  (1000L)  // 1 sec
#define IDLE_TIME (5*60*1000L)  // 5 mins

SimpleTimer timer;

boolean PIRActivated= 1;

void PIRcheck() {
if (PIRActivated == 1) {
// Here goes the code for activate relay etc
PIRActivated=0;
timer.setTimeout(IDLE_TIME, activatePIR);
}
}

void activatePIR() {
PIRActivated=1;
}

void setup()
{
timer.setInterval(TRIGGER_TIME, PIRcheck);
}

void loop()
{
timer.run();
}

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
First pass at a non-555 design.
R1-C1 make a 1 s output pulse.
R2-C2 set the 5 minute inhibit interval.
You can add a switch across R2 to reset/disable the 5 minute timer.

ak
View attachment 127741
Awesome!

Congratulations, my friend. You have pleasantly surprised me. It's an elegant circuit and I think that's all I need. I'm going to order lots of CD4093 right now.

If you have time, it would be nice to see the version with NE555 or NE556 dual timer.

Thanks again!

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
First pass at a non-555 design.
R1-C1 make a 1 s output pulse.
R2-C2 set the 5 minute inhibit interval.
You can add a switch across R2 to reset/disable the 5 minute timer.

ak
View attachment 127741
Hello!

Good morning to all.

Analog Kid.

I have ordered several CD4093 but it should take several days to arrive. So, I tried to simulate the circuit using Proteus and in my configuration it does not seem to work. I know it's something I've done wrong. I have only replaced the diode 1N914 with a 1N4148 which is the one I have on hand. It is supposed to be similar according to a friend. To simulate the pulse of the PIR I have placed a small switch to 9V and in order to simulate the output, a red LED with a 470 ohm resistor.

Have I done something wrong? What do you think it is?

Thanks in advance!

#### Attachments

• 14.9 KB Views: 3

#### AnalogKid

Joined Aug 1, 2013
9,621
I', not familiar with Proteus, so I don't know how it thinks. It might take 5 minutes for C1 to charge up at power-on. Look at the voltage at U1 pin 12.

ak

Thread Starter

#### José Alfredo Sánchez

Joined Feb 1, 2017
20
I', not familiar with Proteus, so I don't know how it thinks. It might take 5 minutes for C1 to charge up at power-on. Look at the voltage at U1 pin 12.

ak
OK! Thank you! I will try again!

Similar threads