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

  • 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;
      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
    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 😞

  • Hero Member

    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?

  • Mod

    Try adding a bigger capacitor near the pir sensor

  • Mod

    @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.

  • Hardware Contributor

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

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

  • 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.

  • 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!

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

  • @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.

  • Hero Member

    @Cravecode IIRC, bypassing its LDO may help?

  • @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.

Log in to reply

Suggested Topics