1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Delay Circuit for PIR Motion Sensor

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by ingalfsan, May 27, 2017.

  1. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    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.


    darlington.png 555-LED.png
     

    Attached Files:

    Last edited: May 27, 2017
  2. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,005
    Likes:
    538
    Location:
    AZ 86334
    Welcome.

    Is the PIR sensor like this one? If not, post a link to the one you are actually using.

    What is the actuator for the air spray? Solenoid? Operating voltage? Current?
     
    Last edited: May 27, 2017
  3. cowboybob

    cowboybob Well-Known Member Most Helpful Member

    Joined:
    Oct 22, 2011
    Messages:
    2,992
    Likes:
    470
    Location:
    James Island, SC
    So you want the PIR signal to trigger, in order:

    1. the noise maker.
    2. a circuit to disable input from the PIR for 5 to 10 minutes
    3. at then end of 2. above, re-enable input from the PIR to restart from 1. above.

    Is that correct?

    Also, it's useful to note that 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. Is that going to be a problem for you? If it is, it will somewhat complicate the circuit I have in mind .

    Note also that when triggered, the PIR output will stay HIGH for ≈5S.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0

    Hi!

    Thank you for your answer!

    The PIR sensor I am using is like the figure.

    20170508_085845.jpg proximity_pyrosensor.gif typical PIR sensor pinout dtails.jpg

    I have one with stabilization circuit (Identical to the one shown by you), but my client does not :-(

    The actuator is a kind of relay.
     
  6. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0

    Hello!

    Thank you for your response and your excellent advice!

    That's exactly what I want. The PIR input (or the circuit output that activates the spray) should remain inactive for about 3 to 5 minutes before reacting to the PIR again.

    Certainly the sensor while stabilizing stays HIGH for about 5 seconds. That would be no problem. I could devise a small stabilizing circuit for that.

    What circuit do you have in mind?

    Thanks in advance.
     
  7. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,005
    Likes:
    538
    Location:
    AZ 86334
    So we still need to know what voltage it operates from, and how much current it needs.

    So you are being hired as a consultant, doing work for pay, and you expect us to hand you a solution that you get paid for?
     
  8. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Hi!

    Nop, the circuit is actually for a client who was charged for an Arduino prototype for climate monitoring. It's actually a favor he asked me because the animals come to the greenhouse and they mess up the plants. I did not charge him because I thought it was a simple thing, but suddenly it got complicated. In fact I have a similar circuit that works perfectly, programmed in PIC 12F675, but the client that I mention does not reside in my country, and does not have a PIC programmer at hand. The voltage is 9V, by the way.

    Thanks for your help.
     
  9. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    A friend has facilitated this circuit to me.

    controlproyector.gif

    It works this way:

    When the LCD screen turns off, turn off the lamp as well, and keep the power on for about 5 minutes so that the fans continue to run. This will cool the cabinet by removing all the residual heat from the lamp. He have been walking it for several years and it has never failed.

    The timer part consists of Q2, Q3, the r of 47k and the capacitor of 1000uF, the diodes are to avoid voltages in other parts of the circuit.

    I don't know if it could serve to you who has more experience with hard electronics.
     
  10. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Hi!

    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. I want to test the delay circuit first, because the PIR needs a little stabilization circuit, so that at the moment of feeding it does not interpret the 5 second HIGH as there is an animal nearby, as CowboyBob saids :) That is another problem that I must solve later.

    photo2.jpg

    Then, I changed later the resistance of 2.7K by 47K and now the led takes about 18 seconds ON. It is gradually getting closer to the result. I have thought that if I put something like a transistor on the output as a negator, I can do that instead of turning it ON, it will be OFF for that time.

    Will I be on the right path?

    Thanks in advance for your suggestions.
     
    Last edited: May 28, 2017
  11. cowboybob

    cowboybob Well-Known Member Most Helpful Member

    Joined:
    Oct 22, 2011
    Messages:
    2,992
    Likes:
    470
    Location:
    James Island, SC
    Unfortunately, I only understand English. So I can't exactly fully understand your attached schematic :(.

    Could you post the exact schematic that you used to populate the protoboard (including inputs and outputs)? Especially this part:
    upload_2017-5-28_7-58-56.png ...some sort of SMPS? And what is its purpose?

    And I unsure what the PIR is exhibiting such that it requires a "little stabilization circuit". And on that note, the PIR's "bare bones" (i.e., no enclosure to limit its "window") condition is likely to exhibit repeated false positives that will have your noise maker firing off to excess (perhaps this is the reason you need the stabilization circuit??). I've seen unfocused PIRs respond to a momentary change in the air temperature in front of an unrestricted field of view.
     
  12. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Yes. That part is the power connector of an ATX motherboard, from a switched-mode power supply. Actually my friend passed me that circuit to show me this part, which is exactly like my circuit, only that it is mirrored.

    this.gif


    That's my circuit. The PIR appears mounted on the proto, but It's disconnected. I only managed to keep the led on for about 18 seconds after disconnecting the battery.
    proto.jpg darlington.png

    Very interesting. I certainly have to put a Fresnel lens to the PIR to avoid false positives. Truthfully, I've never tried a PIR sensor without that little coverage.
    fresnel.gif

    In fact, when I referred to a naked PIR I meant that it does not have the stabilization circuit that has an HC-SR01, for example, with trimmers to adjust time and sensitivity.

    Sensor_PIR_SR501_8-300x268.jpg

    I've never actually used a PIR alone. Do you have any idea for this?

    Thanks in advance, my friend!
     
    Last edited: May 28, 2017
  13. cowboybob

    cowboybob Well-Known Member Most Helpful Member

    Joined:
    Oct 22, 2011
    Messages:
    2,992
    Likes:
    470
    Location:
    James Island, SC
    Thank you. I should have paid more attention to the pinout #s.
    Well, to achieve the delay period you're suggesting (5 or 10 minutes), the only reasonable, simple analog circuit will have to use at least 2 555 timers, which will, of course, have to be powered for, at the least, the duration of the delay plus a few seconds.
    No. I'd strongly suggest you get a PIR like this one: All you have to deal with is mounting and focusing (if it needs focusing).
    A suggested circuit:
    upload_2017-5-28_10-55-44.png

    Suggested relay.
     
  14. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Thanks a lot!

    I will try this with a 556 dual timer for space reasons.

    Thanks again!
     
  15. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Someone asked me how it could be solved using code. The code for ATTiny or Arduino is something like this:

    Code (text):

    #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();
    }

     
    [/QUOTE]
     
  16. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Hi!

    Thanks to the excellent advice from all of you, in particular from cowboybob and MikeMl, I have achieved what I needed. I have a timer that activates a led for about 0.69 seconds and another led every 1.15 minutes, using a 1N4148 diode between pin 7 and pin 6. Actually, what I want to do is to activate a device to scare animals, which I do not want to be retriggered for 1 minute.

    PIR.png

    The timer works fine, but I have not been able to activate it with the PIR motion sensor. The cycle should be activated every time the PIR is triggered, and then wait for 1 minute, but I can not make it run correctly with the PIR. Each time the PIR is activated, the cycle starts again instead of waiting for one minute.

    Any suggestions?

    Thanks in advance.
     
  17. cowboybob

    cowboybob Well-Known Member Most Helpful Member

    Joined:
    Oct 22, 2011
    Messages:
    2,992
    Likes:
    470
    Location:
    James Island, SC
    My previous circuit was inadequate. My apologies.

    Circuit below is part of a considerably more complex design that is currently working in a commercial application that responds to a "presence" by playing an MP3 file. It ignores any additional PIR signals until the MP3 file terminates (at which point a different MP3 file is cued and then plays with the next PIR pulse):
    upload_2017-6-19_13-11-23.png
    Current values of both pots and C1/C2 allow Noise Maker Controller trigger timing from 0 to 1.1 seconds and PIR Disable timer from 0 to 110 seconds. Change C1 and/or C2 to alter timing as needed. You can, of course, replace the pots with resistors of your choice.

    I should note that the relay was the best, easiest and most reliable solution for providing the interruption of unwanted PIR signal(s). If you can find a 9VDC NC SPST relay, feel free to use it instead of the SPDT shown (which I used in the circuit referenced above).

    <EDIT> Left out D1 - relay kick-back snubber. Also, the five second duration noted in point 1. of the sequence listing is a typical PIR device's pulse duration, not how long I held down the POS switch button.
     
    Last edited: Jun 19, 2017
  18. ingalfsan

    ingalfsan New Member

    Joined:
    May 27, 2017
    Messages:
    13
    Likes:
    0
    Excellent! It looks great. Surprising design.

    Now I'll try something like this. I will keep you informed of my progress.

    Thank you!
     

Share This Page