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. Development
  3. NodeManager
  4. SensorDoor + Backup Send

SensorDoor + Backup Send

Scheduled Pinned Locked Moved NodeManager
5 Posts 4 Posters 837 Views 3 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.
  • N Offline
    N Offline
    Nalith
    wrote on last edited by
    #1

    Hi All

    I have a simple sensor I want to use for my doors and windows that is interrupt based however I have noticed that if a door/window is opened and closed too quickly the incorrect value could be sent through to my controller. I was hoping to be able to force my node to update all its sensor values every xx minutes even if there has been no change however for the life of my I can't seem to figure this out. Is there a way I can force a interrupt based sensor to send updated values through at specific intervals as a backup to the normal interval based send?

    Thanks

    YveauxY 1 Reply Last reply
    0
    • skywatchS Offline
      skywatchS Offline
      skywatch
      wrote on last edited by
      #2

      You can do this, but be aware that if the nodes are battery powered it will drain the batteries much more quickly.

      I have a microwave motion sensor that on the controller seems to 'stick' on a high trigger level. For some reason the return to a low state doesn't always get through it seems.

      1 Reply Last reply
      0
      • N Nalith

        Hi All

        I have a simple sensor I want to use for my doors and windows that is interrupt based however I have noticed that if a door/window is opened and closed too quickly the incorrect value could be sent through to my controller. I was hoping to be able to force my node to update all its sensor values every xx minutes even if there has been no change however for the life of my I can't seem to figure this out. Is there a way I can force a interrupt based sensor to send updated values through at specific intervals as a backup to the normal interval based send?

        Thanks

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

        @nalith See the sleeping section in the API description.
        The sleep function takes one or two interrupts to wake up the node on triggering, and an optional ms parameter that defines the amount of milleseconds to sleep before waking up anyway.
        The return code of the sleep function indicates what woke the node, e.g. (untested!):

        #define PIN_DOORALARM          (2)            // only 2 & 3 are supported on ATMega328!
        #define SLEEP_TIME_MS          (60*1000)      // sleep 60.000 milliseconds -> 60 seconds
        #define DEBOUNCE_TIME_MS       (15)
        
        void setup ()
        {
            pinMode(PIN_DOORALARM,  INPUT_PULLUP);
        }
        
        void loop()
        {
            // ... do whatever you like ...
        
            // Sleep until node wakes up by interrupt or timeout
            uint8_t result = sleep( digitalPinToInterrupt(PIN_DOORALARM), FALLING, SLEEP_TIME_MS );
            if ( MY_WAKE_UP_BY_TIMER  == result )
            {
                // woke by timer -> e.g. send current status
            }    
            else if ( digitalPinToInterrupt(PIN_DOORALARM) == result )
            {
                // woke by interrupt -> send current status / raise alarm
        
                // debounce might be required; depending on your switches
                delay(DEBOUNCE_MS);
            }    
        }
        
        

        http://yveaux.blogspot.nl

        zboblamontZ 1 Reply Last reply
        0
        • YveauxY Yveaux

          @nalith See the sleeping section in the API description.
          The sleep function takes one or two interrupts to wake up the node on triggering, and an optional ms parameter that defines the amount of milleseconds to sleep before waking up anyway.
          The return code of the sleep function indicates what woke the node, e.g. (untested!):

          #define PIN_DOORALARM          (2)            // only 2 & 3 are supported on ATMega328!
          #define SLEEP_TIME_MS          (60*1000)      // sleep 60.000 milliseconds -> 60 seconds
          #define DEBOUNCE_TIME_MS       (15)
          
          void setup ()
          {
              pinMode(PIN_DOORALARM,  INPUT_PULLUP);
          }
          
          void loop()
          {
              // ... do whatever you like ...
          
              // Sleep until node wakes up by interrupt or timeout
              uint8_t result = sleep( digitalPinToInterrupt(PIN_DOORALARM), FALLING, SLEEP_TIME_MS );
              if ( MY_WAKE_UP_BY_TIMER  == result )
              {
                  // woke by timer -> e.g. send current status
              }    
              else if ( digitalPinToInterrupt(PIN_DOORALARM) == result )
              {
                  // woke by interrupt -> send current status / raise alarm
          
                  // debounce might be required; depending on your switches
                  delay(DEBOUNCE_MS);
              }    
          }
          
          
          zboblamontZ Offline
          zboblamontZ Offline
          zboblamont
          wrote on last edited by
          #4

          @yveaux In addition to what you explained, if the Int were triggered on "change" and a hi/low check made on the pin before update to the Gateway, would this not report either correct state short of inhuman speed?
          I recall having the opposite problem with the gas meter reed lasting ca 6 seconds in hi state, solved by a short while/sleep to verify it had gone Lo before entering deep sleep. A variant in this case might be to check which state it is in after updating to ensure it hadn't changed prior to sleeping.

          YveauxY 1 Reply Last reply
          0
          • zboblamontZ zboblamont

            @yveaux In addition to what you explained, if the Int were triggered on "change" and a hi/low check made on the pin before update to the Gateway, would this not report either correct state short of inhuman speed?
            I recall having the opposite problem with the gas meter reed lasting ca 6 seconds in hi state, solved by a short while/sleep to verify it had gone Lo before entering deep sleep. A variant in this case might be to check which state it is in after updating to ensure it hadn't changed prior to sleeping.

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

            @zboblamont said in SensorDoor + Backup Send:

            would this not report either correct state short of inhuman speed?

            I guess it would, but there's always the chance of missing a message, so a regular status update could help there.

            http://yveaux.blogspot.nl

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


            14

            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