Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. PIR Sensor false trigger every 10 minutes, same time node comes out of sleep.

PIR Sensor false trigger every 10 minutes, same time node comes out of sleep.

Scheduled Pinned Locked Moved Troubleshooting
12 Posts 6 Posters 3.5k Views 6 Watching
  • 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.
  • CravecodeC Cravecode

    I'm running the following: (PIR Node, MySensors Library v2.1.1) > (ESP8266 Gateway, MySensors Library v2.1.1) < (Home Assistant, 0.50.2).

    The PIR node is currently on a breadboard powered by my test bench power supply to rule out as many factors as possible.

    In my Home Assistant logbook, I can see the PIR is triggered every 10 minutes, all day long. At the end of my loop(){...}, I have the following code:

    unsigned long SLEEP_TIME = 600000; // (10 minutes), Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3  // The digital input you attached your motion sensor. 
    
    /* ... */
    
    void loop()
    {
    
     // Read digital motion value
      bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
    
      Serial.println(tripped);
      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
    
      wait(500);
    
    /**
    defined by Arduino: 
      CHANGE = 1
    **/ 
      sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    }
    

    I have verified that I do not get the false triggers if i disconnect the PIR sensor from the Arduino's pin 3. So, I know it's the actual PIR reacting to the Arduino coming out of sleep.

    Could this be noise on the power rail from the Arduino or the NRF24L01+? If so, what are my options? I currently have a 4.7uf cap bridged across the NRF24L01's power connections. I will try adding a wait(500); before I actually read pin 3's value.

    FYI: I don't have a scope to test power noise :(

    NeverDieN Offline
    NeverDieN Offline
    NeverDie
    Hero Member
    wrote on last edited by NeverDie
    #2

    @Cravecode
    Which PIR sensor are you using? For instance, the SR501 is well known to false trigger on fast changes in voltage. even very small ones. Given the timing of what you're reporting, it sounds like either that or something simillar is what's happening in your case?

    CravecodeC 1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #3

      Try adding a bigger capacitor near the pir sensor

      1 Reply Last reply
      0
      • CravecodeC Cravecode

        I'm running the following: (PIR Node, MySensors Library v2.1.1) > (ESP8266 Gateway, MySensors Library v2.1.1) < (Home Assistant, 0.50.2).

        The PIR node is currently on a breadboard powered by my test bench power supply to rule out as many factors as possible.

        In my Home Assistant logbook, I can see the PIR is triggered every 10 minutes, all day long. At the end of my loop(){...}, I have the following code:

        unsigned long SLEEP_TIME = 600000; // (10 minutes), Sleep time between reports (in milliseconds)
        #define DIGITAL_INPUT_SENSOR 3  // The digital input you attached your motion sensor. 
        
        /* ... */
        
        void loop()
        {
        
         // Read digital motion value
          bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
        
          Serial.println(tripped);
          send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
        
          wait(500);
        
        /**
        defined by Arduino: 
          CHANGE = 1
        **/ 
          sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
        }
        

        I have verified that I do not get the false triggers if i disconnect the PIR sensor from the Arduino's pin 3. So, I know it's the actual PIR reacting to the Arduino coming out of sleep.

        Could this be noise on the power rail from the Arduino or the NRF24L01+? If so, what are my options? I currently have a 4.7uf cap bridged across the NRF24L01's power connections. I will try adding a wait(500); before I actually read pin 3's value.

        FYI: I don't have a scope to test power noise :(

        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #4

        @Cravecode you set your sleep time to 10 minutes, so you can expect your sensor to wakeup every 10 minutes and send a message ...
        Try if updating to development 2.2.x of the library makes a difference; I fixed some sleeping related bugs there.
        Furthermore check the parameters of the sleep function and explicitly write all parameters in your code. A few overloaded variants exist with default parameters. Not very handy; I accidently picked the wrong version in the past.

        http://yveaux.blogspot.nl

        sundberg84S 1 Reply Last reply
        0
        • YveauxY Yveaux

          @Cravecode you set your sleep time to 10 minutes, so you can expect your sensor to wakeup every 10 minutes and send a message ...
          Try if updating to development 2.2.x of the library makes a difference; I fixed some sleeping related bugs there.
          Furthermore check the parameters of the sleep function and explicitly write all parameters in your code. A few overloaded variants exist with default parameters. Not very handy; I accidently picked the wrong version in the past.

          sundberg84S Offline
          sundberg84S Offline
          sundberg84
          Hardware Contributor
          wrote on last edited by
          #5

          @Yveaux i have the same experience. I upgraded the library and the sleep function was better.

          Controller: Proxmox VM - Home Assistant
          MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
          MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
          RFLink GW - Arduino Mega + RFLink Shield, 433mhz

          1 Reply Last reply
          0
          • CravecodeC Offline
            CravecodeC Offline
            Cravecode
            wrote on last edited by
            #6

            Thanks for the replies!
            I'll checkout the 2.2.x dev branch. I tried various sizes for capacitors with no luck.

            1 Reply Last reply
            0
            • wallyllamaW Offline
              wallyllamaW Offline
              wallyllama
              wrote on last edited by
              #7

              Do pir modules trigger when power is first applied? If you are cutting power to it when you sleep, maybe it needs time to settle before you take a reading.

              CravecodeC 1 Reply Last reply
              0
              • CravecodeC Offline
                CravecodeC Offline
                Cravecode
                wrote on last edited by
                #8

                I tried the 2.2.x development branch of the MySensors library per @Yveaux's suggestion. The development branch appears to have fixed my issue!

                1 Reply Last reply
                0
                • wallyllamaW wallyllama

                  Do pir modules trigger when power is first applied? If you are cutting power to it when you sleep, maybe it needs time to settle before you take a reading.

                  CravecodeC Offline
                  CravecodeC Offline
                  Cravecode
                  wrote on last edited by
                  #9

                  @wallyllama I'm not cutting the power to the PIR sensor. Just putting the Arduino and radio to sleep.

                  1 Reply Last reply
                  0
                  • NeverDieN NeverDie

                    @Cravecode
                    Which PIR sensor are you using? For instance, the SR501 is well known to false trigger on fast changes in voltage. even very small ones. Given the timing of what you're reporting, it sounds like either that or something simillar is what's happening in your case?

                    CravecodeC Offline
                    CravecodeC Offline
                    Cravecode
                    wrote on last edited by
                    #10

                    @NeverDie I'm using the HC-SR501. Google turns up lots of related info for the HC-SR501 and false triggers. I'll see what others are doing too.

                    NeverDieN 1 Reply Last reply
                    0
                    • CravecodeC Cravecode

                      @NeverDie I'm using the HC-SR501. Google turns up lots of related info for the HC-SR501 and false triggers. I'll see what others are doing too.

                      NeverDieN Offline
                      NeverDieN Offline
                      NeverDie
                      Hero Member
                      wrote on last edited by
                      #11

                      @Cravecode IIRC, bypassing its LDO may help?

                      CravecodeC 1 Reply Last reply
                      0
                      • NeverDieN NeverDie

                        @Cravecode IIRC, bypassing its LDO may help?

                        CravecodeC Offline
                        CravecodeC Offline
                        Cravecode
                        wrote on last edited by
                        #12

                        @NeverDie said in PIR Sensor false trigger every 10 minutes, same time node comes out of sleep.:

                        IIRC, bypassing its LDO may help?

                        I've actually already done that, to reduce power consumption.

                        I'm running some tests now. It really looks like the 2.2.x version of the MySensors library helps. On my test piece, it has not had a false trigger in over an hour.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        19

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.1k

                        Posts


                        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • MySensors
                        • OpenHardware.io
                        • Categories
                        • Recent
                        • Tags
                        • Popular