Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    fipy + PIR sensor

    Scheduled Pinned Locked Moved FiPy
    8 Posts 3 Posters 389 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      Israel
      last edited by

      Hi,
      I have an expansion board 3.0 and a fipy that I have connected to a PIR sensor. The idea I have is to detect motion constantly where there is any motion. The PIR-sensor that I have works now but not exactly how I wanted it to. One of the issues that I have with it is that it cannot detect motion constantly. To test this I move my hands constantly before the sensor for like one minute, however it reports it has detected say, for five seconds and the it says no motion even though I am still waving my hands in front of it. What I want for it to do is to keep detecting motion as long as I am moving my hands and stop as soon as I stop waving. I have rotated the delay to max so now it detects every five seconds and sometimes every four seconds.
      In summary

      1. I want it to be able to keep detecting motion as long as there is motion and not stop detecting like after five seconds "no motion presence" while there is motion.
      pir = Pin(Pin.exp_board.G11,mode=Pin.IN, pull=Pin.PULL_UP)
      
      state = False
      
      while True:
        val = pir()
        #print('Value:', val)
        #print(state)
      
        if state == False:
          if val == 1:
            state = True
            print("presence detected 1111111111111111111111111111111")
        else:
          if val == 0:
            state = False
            print("NO presence")
        sleep(0.1)
      

      I have windows 10, use atom pymakr.

      Thank you in advance

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @Israel
        last edited by

        @Israel You'll have to give more details about the sensor you use, and possibly it's settings and how you connected it.

        Note that many (most?) sensors have a "quiet time" after a detection during which they will not detect anything.

        Also, depending on the sensor, you may have a re-trigger mode which keeps the sensor output high as long as motion is detected.

        1 Reply Last reply Reply Quote 1
        • I Offline
          Israel
          last edited by

          The only configuration I have applied is I just rotated the time-delay sensitivity to low. I have also tested it in single and repeatable triggers using the "Trigger Mode Selection Jumper", it did not create any difference.
          The links lead to the pictures of my sensor.
          https://pasteboard.co/IcYNNUl.jpg
          https://pasteboard.co/IcYOheq.jpg
          https://pasteboard.co/IcYOro1.jpg

          J securigyS 2 Replies Last reply Reply Quote 0
          • J Offline
            jcaron @Israel
            last edited by

            @Israel That looks like an HC-SR501. Set it to re-trigger, and configure the delay appropriately. The signal will go up when you start moving, will stay up for the configured delay, and that delay will be extended as long as you continue moving before the delay expires.

            Once the delay expires, the signal goes down, and there's a short period of a few seconds during which no detection will take place.

            Note that the HC-SR501 is designed to operate with a 5V source, while the Pycom stuff runs on 3.3V. You may experience issues with false negatives or positives.

            I 1 Reply Last reply Reply Quote 0
            • I Offline
              Israel @jcaron
              last edited by Israel

              @jcaron Ok, I tired to put the jumper on re-trigger and also on single trigger as well as adjusted the time delay knob to find an appropriate delay. I tried combining these three adjustments multiple times. Through out this, the only difference I see is that the detection signal stays on longer. Like after the last detection it will continue reporting fake detection for extra nine to te seconds if I adjusted the delay-knob to the max and other wise will stay on for like five to six seconds and keep reporting fake detection as well. After that it will stay on the "quite mode" for a few seconds like between five and nine where it refuses to detect anything even if I wave my hand, like it doesn't keep detecting as long as I keep waving my hands too. The PIR-sensor that I have, does it have a quite-time too? And is there a way to disable it, because it seems very unnatural to me and annoying. The expansion board I use provides 5V so it is fine [ https://docs.pycom.io/datasheets/boards/expansion3.html ]. The best way is to keep detecting as long as there is motion and stop when there isn't any and start again during another detection and so on, without any wired delay in between?

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                jcaron @Israel
                last edited by

                @Israel Uh, the delay it stays up should be a few seconds at the minimum value and minutes at the max (I don't remember exactly, but the max is at least 10 minutes, possibly quite a bit more).

                Are you sure you are adjusting the right potentiometer?

                Can you check voltage levels on your signal pin? Also, I'm not quite sure you need the pull up, though I used it in a different scenario so I can't say for sure.

                You cannot get rid of the quiet time on that PIR.

                I 1 Reply Last reply Reply Quote 0
                • I Offline
                  Israel @jcaron
                  last edited by

                  @jcaron Good to know that I cannot get rid of the annoying "quite time". because I spent a lot of time trying to disable it somehow. I will try with the other adjuster and will update you if I see any difference. I will see if I can check the voltage if I get any instrument to do it as I currently don't have any. With the pill up, I assume you mean the PULL_UP in my code.

                  PULL_UP
                  

                  That will I change to PULL_DOWN and see what happens too, I have seen pull_down has been used in some projects too. https://startiot.telenor.com/learning/lopy-motion-sensor/

                  1 Reply Last reply Reply Quote 0
                  • securigyS Offline
                    securigy @Israel
                    last edited by

                    @Israel How did you know to connect your sensor to P4 ? (based on your photos).
                    I am looking to connect my analog output from the sensor to Expansion Board 3.0 and wonder what pin to use on the Expansion Boar...

                    1 Reply Last reply Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • 1 / 1
                    • First post
                      Last post

                    Pycom on Twitter

                    Pycom